toYaml output indented wrongly
CommontoYaml returns several lines. indent only indents them, so text before the call shifts the first line; the error appears once the value has more than one line.
Confirm
helm template RELEASE . -s templates/FILE.yaml --debug
The first line of the block further right than the rest, or the block at the wrong level
Fix
- Put the call at the start of its line with a dash and nindent: {{- toYaml .Values.podLabels | nindent 4 }}, with 4 being the indentation the block needs.
labels:
{{- toYaml .Values.podLabels | nindent 4 }}Reproduced on Helm 3.18.2: rendered both labels under labels:.