Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[kube-prometheus-stack] Add downward compat for Prom CRD #4906

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

schnatterer
Copy link
Contributor

What this PR does / why we need it

Running the latest prom-stack versions on legacy OpenShift clusters with no influence on the preinstalled CRDs results in errors such as this:

failed to create typed patch object (..): .spec.scrapeConfigNamespaceSelector: field not declared in schema

This PR provides a workaround using this values.yaml:

prometheus:
  prometheusSpec:
    scrapeConfigNamespaceSelector: null
    scrapeConfigSelectorNilUsesHelmValues: null
    scrapeConfigSelector: null

Yes, this is no ideal solution, but that seems to be what the enterprise-world requires 😐️

At runtime, the operator yields some warnings about the missing fields, but apparently everything else works.

Special notes for your reviewer

As discussed with @jkroepke I'm launching another try to include this feature 🙂

This is the same functionality as in #4818, which unfortunately was reverted in #4883, because it hit a bug in helm helm/helm#12879.

If we go for my original minimally invasive approach, there is no breaking change we won't cause #4878 again.

It won't work for sub charts (because of aforementioned bug in helm) but at least for direct users of kps chart.

Checklist

  • DCO signed
  • Chart Version bumped
  • Title of the PR starts with chart name (e.g. [prometheus-couchdb-exporter])

… fields

Running the latest prom-stack versions on legacy OpenShift clusters with no influence on the preinstalled CRDs results in errors such as this:

failed to create typed patch object (..): .spec.scrapeConfigNamespaceSelector: field not declared in schema

This patch provides a workaround using this values.yaml:

prometheus:
  prometheusSpec:
    scrapeConfigNamespaceSelector: null
    scrapeConfigSelectorNilUsesHelmValues: null
    scrapeConfigSelector: null

Signed-off-by: Johannes Schnatterer <[email protected]>
scrapeConfigSelector: {}
{{- end }}
{{- if .Values.prometheus.prometheusSpec.scrapeConfigNamespaceSelector }}
scrapeConfigNamespaceSelector:
{{ tpl (toYaml .Values.prometheus.prometheusSpec.scrapeConfigNamespaceSelector | indent 4) . }}
{{ else }}
{{ else if not (eq .Values.prometheus.prometheusSpec.scrapeConfigNamespaceSelector nil) }}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what not ne instead of not (eq ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants