[kube-prometheus-stack] Allow disabling individual default Grafana dashboards#7015
Open
alien2003 wants to merge 1 commit into
Open
Conversation
6f96dc4 to
8a76d02
Compare
…shboards The default Grafana dashboards could only be turned on or off as a group via grafana.defaultDashboardsEnabled. Disabling a single noisy or irrelevant dashboard meant overriding its ConfigMap out of band, which the chart overwrites on the next upgrade. Add grafana.defaultDashboardsDisabled, a map keyed by dashboard name (the file name under templates/grafana/dashboards-1.14 without the .yaml suffix). A name set to true drops that dashboard's ConfigMap and its GrafanaDashboard CR while leaving the rest in place. The default is an empty map, so existing installs render the same dashboards as before. The guard is generated, so the clause is added to hack/sync_grafana_dashboards.py and applied to the rendered templates. This mirrors the existing defaultRules.disabled opt-out for alerts. Closes prometheus-community#3763 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Signed-off-by: alien2003 <alien2003@protonmail.ch>
8a76d02 to
8394757
Compare
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #3763
Today the curated Grafana dashboards can only be toggled as a group through
grafana.defaultDashboardsEnabled. Dropping a single dashboard means overriding its ConfigMap out of band, which the chart overwrites on the next upgrade.This adds
grafana.defaultDashboardsDisabled, a map keyed by dashboard name (the file name undertemplates/grafana/dashboards-1.14without the.yamlsuffix). A name set totruestops that dashboard's ConfigMap and its optionalGrafanaDashboardCR from rendering while the rest stay:The default is an empty map, so existing installs render the same dashboards as before. The approach mirrors the existing
defaultRules.disabledopt-out for alerts.indexis used instead of dot access because dashboard names contain dashes.The dashboard templates are generated, so the guard clause was added to
hack/sync_grafana_dashboards.pyand applied to the rendered files; the committed files are identical to the generator output for this change.How this was tested
helm unittest --strict --file 'unittests/**/*.yaml' charts/kube-prometheus-stack(64 tests pass, including a newunittests/grafana/default_dashboards_disabled_test.yamlcovering the default render, a disabled dashboard rendering 0 documents, an unrelated dashboard still rendering, and theGrafanaDashboardCR path).Backward compatibility
No breaking change. New optional value, default
{}preserves current output. Minor version bump 86.2.3 -> 86.3.0.