Search code examples
kuberneteskubernetes-helm

What is single $ sign in tpl function


Having such Helm code snippet.

{{ if .Values.configOverrides }}
# Overrides
{{- range $key, $value := .Values.configOverrides }}
# {{ $key }}
{{ tpl $value $ }}
{{- end }}
{{- end }}

What is $ sign in {{ tpl $value $ }}?


Solution

  • From the documentation:

    However, there is one variable that is always global - $ - this variable will always point to the root context. This can be very useful when you are looping in a range and you need to know the chart's release name.

    So the expression you show in your question...

    {{ tpl $value $ }}
    

    ...is passing root context as the set of values to be used when expanding the template in $value.