How do `if`, `else if` and `else` evaluate truthiness?
BeginnerConceptTemplating: Go Templates & Sprig
Answer
A pipeline is false if it is false, 0, nil, an empty string, or an empty map, list or slice. Everything else is true.
{{- if .Values.ingress.enabled }}
...
{{- else if .Values.route.enabled }}
...
{{- end }}
Watch for numeric zero: if .Values.replicaCount is false for 0, which may be a legitimate value (scale to zero). Use hasKey or kindIs "invalid" to distinguish "unset" from "zero".
More on Templating: Go Templates & Sprig
What template language does Helm use?BeginnerWhat does the dot (`.`) mean in a Helm template?BeginnerWhat is `$` and when do you need it?IntermediateHow does whitespace control (`{{-` and `-}}`) work?BeginnerWhat do `and`, `or`, `not`, `eq`, `ne`, `lt`, `gt` look like in Helm?BeginnerHow does `with` work, and what is its common pitfall?Intermediate