-
Notifications
You must be signed in to change notification settings - Fork 5.3k
[kube-prometheus-stack] explicitly allow a null Prometheus ruleSelector #6178
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
base: main
Are you sure you want to change the base?
Conversation
ba07eed
to
4926a47
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please extend the unit tests in that case, maybe start by copy this file:
charts/kube-prometheus-stack/templates/prometheus/prometheus.yaml
Outdated
Show resolved
Hide resolved
Signed-off-by: Brock Alberry <brock.alberry@cse-cst.gc.ca>
Signed-off-by: Brock Alberry <brock.alberry@cse-cst.gc.ca>
Signed-off-by: Brock Alberry <brock.alberry@cse-cst.gc.ca>
Signed-off-by: Brock Alberry <brock.alberry@cse-cst.gc.ca>
7f93f9d
to
1f63d34
Compare
done! |
43b84df
to
ed3fb09
Compare
Signed-off-by: Brock Alberry <brock.alberry@cse-cst.gc.ca>
ed3fb09
to
cc66cbc
Compare
Signed-off-by: Brock Alberry <61976254+ba-work@users.noreply.github.com>
for anyone that happens to stumble on this before its merged or closed, turns out you can get the same behavior but it relies on the way the operator currently handles on config precedence: if there are keys with the same name, the latter wins. so that means, as of this comment, the following will result helm install -g charts/kube-prometheus-stack \
--set prometheus.prometheusSpec.ruleSelectorNilUsesHelmValues=false \
--set prometheus.prometheusSpec.ruleSelector=null \
--set prometheus.prometheusSpec.additionalConfig.ruleSelector=null Really, this will make helm generate this: ---
# Source: kube-prometheus-stack/templates/prometheus/prometheus.yaml
apiVersion: monitoring.coreos.com/v1
kind: Prometheus
...
spec:
...
ruleSelector: {}
...
ruleSelector: null # this one wins |
Signed-off-by: Jan-Otto Kröpke <mail@jkroepke.de>
Signed-off-by: Brock Alberry <brock.alberry@cse-cst.gc.ca>
Head branch was pushed to by a user without write access
@jkroepke renovate-bot necessitated another version bump. sorry! |
Signed-off-by: Jan-Otto Kröpke <mail@jkroepke.de>
What this PR does / why we need it
This PR enables the user to explicitly set a
Prometheus
CRD'sspec.ruleSelector
value tonull
. This is a supported/documented value that prevents the operator from importing anyPrometheusRule
s. You can check this withkubectl explain prometheus.spec.ruleSelector
or see it documented hereI encountered a situation where this is required (CRs created and validated, but not imported), and this chart doesn't allow explicitly setting
prometheus.prometheusSpec.ruleSelector=null
; currently it always coalesces to{}
.I made it also require
prometheus.prometheusSpec.ruleSelectorNilUsesHelmValues=false
since that seemed like the most intuitive and backwards compatible with current behavior.Tested with:
Special notes for your reviewer
Checklist
[prometheus-couchdb-exporter]
)