Interview Prep/Helm/Chart Structure & Metadata

What do `.Files.Glob`, `.AsConfig` and `.AsSecrets` do?

IntermediateConceptChart Structure & Metadata
Answer

.Files.Glob returns all files matching a pattern; .AsConfig turns them into ConfigMap data entries and .AsSecrets into base64-encoded Secret data.

apiVersion: v1
kind: ConfigMap
metadata:
  name: {{ include "shop.fullname" . }}-migrations
data:
{{ (.Files.Glob "migrations/*.sql").AsConfig | indent 2 }}

Each file name becomes a key. This is how the hands-on lab ships SQL migrations into a hook Job.

All Helm questions Roadmap: Helm

More on Chart Structure & Metadata