I was trying to put the if
condition in a single line of the helm template:
- name: ENV_VARIABLE
value: {{- if .Values.condition }}"Value1"{{- else }}"Value2"{{- end }}
However, I'm getting error:
Error: YAML parse error on chart/templates/deployment.yaml: error converting YAML to JSON: yaml: line NN: could not find expected ':'
So I've ended up with multi-line condition:
- name: ENV_VARIABLE
{{- if .Values.condition }}
value: "Value1"
{{- else }}
value: "Value2"
{{- end }}
which is working fine, but is very uncompact.
Is there a way to use one-liner if
condition in helm?