What do `and`, `or`, `not`, `eq`, `ne`, `lt`, `gt` look like in Helm?
BeginnerConceptTemplating: Go Templates & Sprig
Answer
They are prefix functions, not infix operators:
{{- if and .Values.autoscaling.enabled (gt (int .Values.autoscaling.maxReplicas) 1) }}
{{- if or (eq .Values.env "prod") (eq .Values.env "staging") }}
{{- if not .Values.serviceAccount.create }}
{{- if ne .Values.service.type "ClusterIP" }}
Comparisons are type-strict: eq 1 "1" errors or is false, and values from YAML are often float64, so convert with int before comparing numbers.
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?BeginnerHow do `if`, `else if` and `else` evaluate truthiness?BeginnerHow does `with` work, and what is its common pitfall?Intermediate