What does `define` do?
BeginnerConceptTemplating: Go Templates & Sprig
Answer
define creates a named template that renders nothing on its own:
{{- define "shop.image" -}}
{{- printf "%s:%s" .repository (.tag | default "latest" | toString) -}}
{{- end }}
You render it with include or template. Names are global across the parent chart and all subcharts, and a later definition with the same name silently overrides an earlier one, which is why names are always prefixed with the chart name.
More on Templating: Go Templates & Sprig
What template language does Helm use?BeginnerWhat does the dot (`.`) mean in a Helm template?BeginnerWhat is `$` and when do you need it?IntermediateHow does whitespace control (`{{-` and `-}}`) work?BeginnerHow do `if`, `else if` and `else` evaluate truthiness?BeginnerWhat do `and`, `or`, `not`, `eq`, `ne`, `lt`, `gt` look like in Helm?Beginner