What does `tpl` do and why is it powerful?
AdvancedConceptTemplating: Go Templates & Sprig
Answer
tpl STRING CONTEXT renders a string as a template at runtime. It lets values themselves contain template expressions:
# values.yaml
api:
env:
DB_HOST: "{{ .Release.Name }}-postgres"
# template
value: {{ tpl .Values.api.env.DB_HOST . | quote }}
It is also used to template external files: tpl (.Files.Get "files/app.conf") .. Power cost: users can execute arbitrary template logic through values, rendering is slower, and errors point to tpl rather than a file line. Use it only for values documented as templatable.
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