-
Notifications
You must be signed in to change notification settings - Fork 5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[kube-prometheus-stack] Add downward compat for Prom CRD (#4818)
Co-authored-by: Jan-Otto Kröpke <joe@cloudeteer.de> Co-authored-by: Jan-Otto Kröpke <github@jkroepke.de>
- Loading branch information
1 parent
efa9ef7
commit 25f32d6
Showing
17 changed files
with
495 additions
and
156 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{{- if .Values.checkDeprecation }} | ||
# The *NilUsesHelmValues can be removed 09/25, about a year after deprecation | ||
{{- if .Values.prometheus.prometheusSpec.podMonitorSelectorNilUsesHelmValues }} | ||
{{ fail "`podMonitorSelectorNilUsesHelmValues` no longer exists. See https://github.com/prometheus-community/helm-charts/tree/main/charts/kube-prometheus-stack#from-62x-to-63x" }} | ||
{{- end }} | ||
{{- if .Values.prometheus.prometheusSpec.probeSelectorNilUsesHelmValues }} | ||
{{ fail "`probeSelectorNilUsesHelmValues` no longer exists. See https://github.com/prometheus-community/helm-charts/tree/main/charts/kube-prometheus-stack#from-62x-to-63x" }} | ||
{{- end }} | ||
{{- if .Values.prometheus.prometheusSpec.ruleSelectorNilUsesHelmValues }} | ||
{{ fail "`ruleSelectorNilUsesHelmValues` no longer exists. See https://github.com/prometheus-community/helm-charts/tree/main/charts/kube-prometheus-stack#from-62x-to-63x" }} | ||
{{- end }} | ||
{{- if .Values.prometheus.prometheusSpec.serviceMonitorSelectorNilUsesHelmValues }} | ||
{{ fail "`serviceMonitorSelectorNilUsesHelmValues` no longer exists. See https://github.com/prometheus-community/helm-charts/tree/main/charts/kube-prometheus-stack#from-62x-to-63x" }} | ||
{{- end }} | ||
{{- if .Values.prometheus.prometheusSpec.scrapeConfigSelectorNilUsesHelmValues }} | ||
{{ fail "`scrapeConfigSelectorNilUsesHelmValues` no longer exists. See https://github.com/prometheus-community/helm-charts/tree/main/charts/kube-prometheus-stack#from-62x-to-63x" }} | ||
{{- end }} | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
charts/kube-prometheus-stack/unittests/prometheus/pod_monitor_namespace_selector_test.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json | ||
suite: test podMonitorNamespaceSelector | ||
templates: | ||
- prometheus/prometheus.yaml | ||
tests: | ||
- it: should be empty by default | ||
asserts: | ||
- equal: | ||
path: spec.podMonitorNamespaceSelector | ||
value: {} | ||
- it: should be set to a specific label | ||
set: | ||
prometheus: | ||
prometheusSpec: | ||
podMonitorNamespaceSelector: | ||
matchLabels: | ||
abc: def | ||
asserts: | ||
- equal: | ||
path: spec.podMonitorNamespaceSelector.matchLabels.abc | ||
value: def | ||
- it: should be ignored, if set to null | ||
set: | ||
prometheus: | ||
prometheusSpec: | ||
podMonitorNamespaceSelector: null | ||
asserts: | ||
- notExists: | ||
path: spec.podMonitorNamespaceSelector |
39 changes: 39 additions & 0 deletions
39
charts/kube-prometheus-stack/unittests/prometheus/pod_monitor_selector_test.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json | ||
suite: test podMonitorSelector | ||
templates: | ||
- prometheus/prometheus.yaml | ||
tests: | ||
- it: should match the release name by default | ||
asserts: | ||
- equal: | ||
path: spec.podMonitorSelector.matchLabels.release | ||
value: RELEASE-NAME | ||
- it: should be empty, when matchLabels is null | ||
set: | ||
prometheus: | ||
prometheusSpec: | ||
podMonitorSelector: | ||
matchLabels: null | ||
asserts: | ||
- equal: | ||
path: spec.podMonitorSelector | ||
value: {} | ||
- it: should be set to a specific label | ||
set: | ||
prometheus: | ||
prometheusSpec: | ||
podMonitorSelector: | ||
matchLabels: | ||
abc: def | ||
asserts: | ||
- equal: | ||
path: spec.podMonitorSelector.matchLabels.abc | ||
value: def | ||
- it: should be ignored, if set to null | ||
set: | ||
prometheus: | ||
prometheusSpec: | ||
podMonitorSelector: null | ||
asserts: | ||
- notExists: | ||
path: spec.podMonitorSelector |
29 changes: 29 additions & 0 deletions
29
charts/kube-prometheus-stack/unittests/prometheus/probe_namespace_selector_test.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json | ||
suite: test probeNamespaceSelector | ||
templates: | ||
- prometheus/prometheus.yaml | ||
tests: | ||
- it: should be empty by default | ||
asserts: | ||
- equal: | ||
path: spec.probeNamespaceSelector | ||
value: {} | ||
- it: should be set to a specific label | ||
set: | ||
prometheus: | ||
prometheusSpec: | ||
probeNamespaceSelector: | ||
matchLabels: | ||
abc: def | ||
asserts: | ||
- equal: | ||
path: spec.probeNamespaceSelector.matchLabels.abc | ||
value: def | ||
- it: should be ignored, if set to null | ||
set: | ||
prometheus: | ||
prometheusSpec: | ||
probeNamespaceSelector: null | ||
asserts: | ||
- notExists: | ||
path: spec.probeNamespaceSelector |
39 changes: 39 additions & 0 deletions
39
charts/kube-prometheus-stack/unittests/prometheus/probe_selector_test.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json | ||
suite: test probeSelector | ||
templates: | ||
- prometheus/prometheus.yaml | ||
tests: | ||
- it: should match the release name by default | ||
asserts: | ||
- equal: | ||
path: spec.probeSelector.matchLabels.release | ||
value: RELEASE-NAME | ||
- it: should be empty, when matchLabels is null | ||
set: | ||
prometheus: | ||
prometheusSpec: | ||
probeSelector: | ||
matchLabels: null | ||
asserts: | ||
- equal: | ||
path: spec.probeSelector | ||
value: {} | ||
- it: should be set to a specific label | ||
set: | ||
prometheus: | ||
prometheusSpec: | ||
probeSelector: | ||
matchLabels: | ||
abc: def | ||
asserts: | ||
- equal: | ||
path: spec.probeSelector.matchLabels.abc | ||
value: def | ||
- it: should be ignored, if set to null | ||
set: | ||
prometheus: | ||
prometheusSpec: | ||
probeSelector: null | ||
asserts: | ||
- notExists: | ||
path: spec.probeSelector |
Oops, something went wrong.