Helm Variables: Difference between revisions
Jump to navigation
Jump to search
Line 15: | Line 15: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Variables are less frequently used, as an alternative preferred construct is the [[Helm_Named_Templates|named template]]. | Variables are less frequently used, as an alternative preferred construct is the [[Helm_Named_Templates|named template]]. | ||
=Variable Scope= | =Variable Scope= |
Revision as of 01:04, 8 October 2020
External
Internal
Overview
A variable is a named reference to another built-in object or a constant. It is assigned and referred using the $<name> syntax. := is used as assignment operator.
{{- $relname := .Release.Name -}}
{{- $color := "green" -}}
...
data:
release: {{ $relname }}
color: {{ $color }}
Variables are less frequently used, as an alternative preferred construct is the named template.
Variable Scope
Variables are normally not "global". They are scoped to the block in which they are declared. However, there is one variable that is aways global: $. This variable will always point to the root context:
{{ $.Chart.AppVersion }}