Interview Prep/Helm/Templating: Go Templates & Sprig

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.

All Helm questions Roadmap: Helm

More on Templating: Go Templates & Sprig