Bug description
Enabling prometheus.monitor.enabled: true on the azure-resourcemanager-exporter chart
(tested with chart 1.3.6, appVersion 26.1.0) makes helm template fail with:
error converting YAML to JSON: yaml: line 6: mapping values are not allowed in this context
Root cause
charts/azure-resourcemanager-exporter/templates/prometheus/servicemonitor.yaml line 8:
labels: {{ include "azure-resourcemanager-exporter.labels" . | indent 4 }}
uses indent 4 instead of nindent 4. Every other template in this same chart
(deployment.yaml, networkpolicy.yaml) correctly uses nindent 4 for the same helper.
This line has actually been broken since 1.2.3 too, but it "accidentally" worked because
_helpers.tpl used to define the label block without trimming the trailing whitespace:
{{- define "azure-resourcemanager-exporter.labels" }} # chart <= 1.2.3
so the include's output began with a newline, which made indent behave like nindent.
Starting in chart 1.3.0, the define was changed to trim trailing whitespace:
{{- define "azure-resourcemanager-exporter.labels" -}} # chart >= 1.3.0
which removed that leading newline and exposed the pre-existing indent/nindent bug —
so any chart >= 1.3.0 with prometheus.monitor.enabled: true fails to render.
Steps to reproduce
helm repo add webdevops https://webdevops.github.io/helm-charts/
helm repo update
helm template test webdevops/azure-resourcemanager-exporter \
--version 1.3.6 \
--set prometheus.monitor.enabled=true
Expected
Valid YAML manifest for the ServiceMonitor.
Suggested fix
- labels: {{ include "azure-resourcemanager-exporter.labels" . | indent 4 }}
+ labels: {{- include "azure-resourcemanager-exporter.labels" . | nindent 4 }}
Bug description
Enabling
prometheus.monitor.enabled: trueon theazure-resourcemanager-exporterchart(tested with chart
1.3.6, appVersion26.1.0) makeshelm templatefail with:Root cause
charts/azure-resourcemanager-exporter/templates/prometheus/servicemonitor.yamlline 8:uses
indent 4instead ofnindent 4. Every other template in this same chart(
deployment.yaml,networkpolicy.yaml) correctly usesnindent 4for the same helper.This line has actually been broken since
1.2.3too, but it "accidentally" worked because_helpers.tplused to define the label block without trimming the trailing whitespace:so the include's output began with a newline, which made
indentbehave likenindent.Starting in chart
1.3.0, the define was changed to trim trailing whitespace:which removed that leading newline and exposed the pre-existing
indent/nindentbug —so any chart >= 1.3.0 with
prometheus.monitor.enabled: truefails to render.Steps to reproduce
Expected
Valid YAML manifest for the ServiceMonitor.
Suggested fix