Interview Prep/Helm/Templating: Go Templates & Sprig

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.

All Helm questions Roadmap: Helm

More on Templating: Go Templates & Sprig