Repository navigation
fix(barman): render PrometheusRule with empty rules spec - #2067
Open
sarankumar1325 wants to merge 1 commit into
Open
sarankumar1325 wants to merge 1 commit into
sarankumar1325 wants to merge 1 commit into
Conversation
Enabling prometheus.rules without setting prometheus.rules.spec rendered 'rules:' followed by '[]' at the same indentation, which helm fails to parse. Indent the rules list under its key so the empty default renders. Also default prometheus.rules.selector and additionalLabels to maps, since they are rendered as labels and the example sets them as maps (the list defaults made helm warn about overriding a table with a non-table value).
This branch has not been deployed
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.
Description
Setting
prometheus.rules.enabled=truein the barman chart without also settingprometheus.rules.specmakeshelm template/helm installfail:The template rendered
rules:with thetoYamloutput at the same indentation (nindent 4). A block list at that level is valid, but the empty default ([]) is not. The list is now indented under its key (nindent 6). Non-empty specs render the same YAML as before.Two smaller fixes in the same template/values:
prometheus.rules.selectorandprometheus.rules.additionalLabelsare rendered as labels, andexamples/barman.yamlsetsselectoras a map. Their[]defaults made helm printwarning: destination for barman.prometheus.rules.selector is a table. Ignoring non-table value ([]). They now default to{}, and the README is updated to match.namespaceconditional.I added
tests/prometheusrules_test.yaml(helm-unittest). It covers the default (nothing rendered), enabled with an empty spec, and the example values with namespace and additional labels. The empty-spec case fails on the current main and passes with this change.helm lintis clean.I used an AI assistant to help write this change. I reviewed and tested it myself.
Issues
None. Found by rendering the chart with each
*.enabledtoggle switched on.Checklist
artifacthub.io/changesannotation inChart.yaml, check the example in the documentation.pre-commit rundocs/