-
Notifications
You must be signed in to change notification settings - Fork 5.1k
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 (#4906)
Co-authored-by: Jan-Otto Kröpke <github@jkroepke.de>
- Loading branch information
1 parent
d3f6d15
commit 30ae44d
Showing
5 changed files
with
77 additions
and
3 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
29 changes: 29 additions & 0 deletions
29
charts/kube-prometheus-stack/unittests/prometheus/scrape_config_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 scrapeConfigNamespaceSelector | ||
templates: | ||
- prometheus/prometheus.yaml | ||
tests: | ||
- it: should be empty by default | ||
asserts: | ||
- equal: | ||
path: spec.scrapeConfigNamespaceSelector | ||
value: {} | ||
- it: should be set to a specific label | ||
set: | ||
prometheus: | ||
prometheusSpec: | ||
scrapeConfigNamespaceSelector: | ||
matchLabels: | ||
abc: def | ||
asserts: | ||
- equal: | ||
path: spec.scrapeConfigNamespaceSelector.matchLabels.abc | ||
value: def | ||
- it: should be ignored, if set to null | ||
set: | ||
prometheus: | ||
prometheusSpec: | ||
scrapeConfigNamespaceSelector: null | ||
asserts: | ||
- notExists: | ||
path: spec.scrapeConfigNamespaceSelector |
41 changes: 41 additions & 0 deletions
41
charts/kube-prometheus-stack/unittests/prometheus/scrape_config_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,41 @@ | ||
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json | ||
suite: test scrapeConfigSelector | ||
templates: | ||
- prometheus/prometheus.yaml | ||
tests: | ||
- it: should match the release name by default | ||
asserts: | ||
- equal: | ||
path: spec.scrapeConfigSelector.matchLabels.release | ||
value: RELEASE-NAME | ||
- it: should be set to a specific label | ||
set: | ||
prometheus: | ||
prometheusSpec: | ||
scrapeConfigSelector: | ||
abc: def | ||
asserts: | ||
- equal: | ||
path: spec.scrapeConfigSelector | ||
value: | ||
abc: def | ||
- it: should be set to a specific label | ||
set: | ||
prometheus: | ||
prometheusSpec: | ||
scrapeConfigSelector: | ||
matchLabels: | ||
abc: def | ||
asserts: | ||
- equal: | ||
path: spec.scrapeConfigSelector.matchLabels.abc | ||
value: def | ||
- it: should be ignored, if set to null | ||
set: | ||
prometheus: | ||
prometheusSpec: | ||
scrapeConfigSelector: null | ||
scrapeConfigSelectorNilUsesHelmValues: null | ||
asserts: | ||
- notExists: | ||
path: spec.scrapeConfigSelector |
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