Skip to content

Helm snippets

Variable rendering in values.yaml

Source

{{- with .Values.keycloak.extraEnv }}
{{ tpl . $ | indent 12 }}
{{- end }}

So it treats extraEnv as a string, sends it through the tpl function so that it is evaluated as part of the template and ensures that the correct indenting is applied. This is interesting as it allows values to be set like:

extraEnv: |
 — name: KEYCLOAK_LOGLEVEL
   value: DEBUG
 — name: HOSTNAME
   value: {{ .Release.Name }}-keycloak

Escape {} in helm

foobar: {{`In this string are some {} which shouldn't interpreted via helm.`}}

or

foobar: {{ printf "In this string are some {} which shouldn't interpreted via helm." }}