Interview Prep/Helm/Templating: Go Templates & Sprig

How do comments work in templates, and which kind ends up in the manifest?

BeginnerConceptTemplating: Go Templates & Sprig
Answer
  • {{/* This is a template comment */}} is removed during rendering (use {{- /* ... */}} to also trim whitespace).
  • # This is a YAML comment stays in the rendered output and is visible in helm get manifest.

Use template comments to document helper parameters and YAML comments only when the reader of the rendered manifest benefits. Never put secrets or internal notes in YAML comments.

All Helm questions Roadmap: Helm

More on Templating: Go Templates & Sprig