Interview Prep/Helm/Chart Structure & Metadata

How do you include non-template files such as config files in a chart?

IntermediateConceptChart Structure & Metadata
Answer

Place them anywhere in the chart outside templates/ (for example files/ or config/) and read them with .Files:

apiVersion: v1
kind: ConfigMap
metadata:
  name: {{ include "shop.fullname" . }}-nginx
data:
  nginx.conf: |-
{{ .Files.Get "files/nginx.conf" | indent 4 }}

.Files cannot read files in templates/ or files excluded by .helmignore. Files in files/ are not rendered, so if they need values, wrap with tpl (.Files.Get "files/nginx.conf") ..

All Helm questions Roadmap: Helm

More on Chart Structure & Metadata