Skip to content

Commit

Permalink
[kube-prometheus-stack] Add downward compatibility for Prometheus CRD…
Browse files Browse the repository at this point in the history
… CRD 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 <johannes.schnatterer@cloudogu.com>
  • Loading branch information
schnatterer committed Aug 28, 2024
1 parent cb5ae1e commit 7157047
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion charts/kube-prometheus-stack/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ name: kube-prometheus-stack
sources:
- https://github.com/prometheus-community/helm-charts
- https://github.com/prometheus-operator/kube-prometheus
version: 62.3.0
version: 62.4.0
appVersion: v0.76.0
kubeVersion: ">=1.19.0-0"
home: https://github.com/prometheus-operator/kube-prometheus
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -253,13 +253,13 @@ spec:
scrapeConfigSelector:
matchLabels:
release: {{ $.Release.Name | quote }}
{{ else }}
{{ else if not (eq .Values.prometheus.prometheusSpec.scrapeConfigSelector nil) }}
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) }}
scrapeConfigNamespaceSelector: {}
{{- end }}
{{- if .Values.prometheus.prometheusSpec.storageSpec }}
Expand Down

0 comments on commit 7157047

Please sign in to comment.