2 min read | by Jordi Prats
Maybe one of the main challenges about helm is the complexity of it's template rendering engine: It's not very intuitive
{{ if .Values.debug }}
# Do something
{{ else }}
# Do something else
{{ end }}
{{ if .Values.debug.info }}
# Do something
{{ else if .Values.debug.err }}
# Do something else
{{ else }}
# Default
{{ end }}
When working with more complex expressions is when we will start to feel the pain. Since they have been implemented as functions, the resulting expression looks like follows:
{{ if and .Values.aws.lambda .Values.aws.ecs }}
{{ if or .Values.aws.lambda .Values.aws.ecs }}
{{ if eq .Values.aws.defaultAccount "blue" }}
{{ if ne .Values.aws.defaultAccount "blue" }}
{{ if contains .Values.aws.environment "test" }}
{{ if not .Values.aws.lambda.enabled }}
If you need to negate the result of a comparison you can nest both expressions:
{{ if not (contains .Values.aws.environment "test") }}
Posted on 14/07/2021