8000 fix(barman): render PrometheusRule with empty rules spec by sarankumar1325 · Pull Request #2067 · adfinis/helm-charts · GitHub
[go: up one dir, main page]

Skip to content

fix(barman): render PrometheusRule with empty rules spec - #2067

Open
sarankumar1325 wants to merge 1 commit into
adfinis:mainfrom
sarankumar1325:fix/barman-prometheusrule-rendering
Open

sarankumar1325 wants to merge 1 commit into
adfinis:mainfrom
sarankumar1325:fix/barman-prometheusrule-rendering

Conversation

@sarankumar1325
Copy link
Copy Markdown

Description

Setting prometheus.rules.enabled=true in the barman chart without also setting prometheus.rules.spec makes helm template/helm install fail:

Error: YAML parse error on barman/templates/prometheus/prometheusrules.yaml: error converting YAML to JSON: yaml: line 17: could not find expected ':'

The template rendered rules: with the toYaml output 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.selector and prometheus.rules.additionalLabels are rendered as labels, and examples/barman.yaml sets selector as a map. Their [] defaults made helm print warning: destination for barman.prometheus.rules.selector is a table. Ignoring non-table value ([]). They now default to {}, and the README is updated to match.
  • Fixed the odd indentation of the namespace conditional.

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 lint is 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 *.enabled toggle switched on.

Checklist

  • This PR contains a description of the changes I'm making
  • I updated the version in Chart.yaml
  • I updated the changelog with an artifacthub.io/changes annotation in Chart.yaml, check the example in the documentation.
  • I updated applicable README.md files using pre-commit run
  • I documented any high-level concepts I'm introducing in docs/
  • CI is currently green and this is ready for review
  • I am ready to test changes after they are applied and released

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).
@sarankumar1325
sarankumar1325 requested a review from a team as a code owner October 31, 2026 02:25

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

0