patternyamlMinor
Helm/ YAML indentation issue
Viewed 0 times
issueyamlhelmindentation
Problem
I am etting weird YAML indentation with some conditional stuff, effectively I'm doing:
But the final line is indented by 10, not 8 as it should be. in fact I can indent it by 0, 10, 100 - but it's always indented 10. any ideas? (edited)
output:
resources:
{{ toYaml .Values.resources | indent 10 }}
{{- if .Values.filebeat.enabled -}}
- name: elastic-loggerBut the final line is indented by 10, not 8 as it should be. in fact I can indent it by 0, 10, 100 - but it's always indented 10. any ideas? (edited)
.Values.resources is for one container, and if filebeat.enabled then I'm adding another container to the arrayoutput:
resources:
{}
- name: elastic-loggerSolution
Turns out
I get a blank line, but don't really care, considering!
-}} is a special syntax which says 'eat up any following whitespace'. Removing the - fixed this.I get a blank line, but don't really care, considering!
Context
StackExchange DevOps Q#4461, answer score: 1
Revisions (0)
No revisions yet.