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.
More on Chart Structure & Metadata
What files does `helm create mychart` generate and which ones matter?BeginnerWhat are the required fields in `Chart.yaml`?BeginnerWhat is the difference between `version` and `appVersion`?BeginnerWhy should `appVersion` be quoted in `Chart.yaml`?BeginnerWhat does `type: library` vs `type: application` mean?BeginnerWhat is the `kubeVersion` field used for?Intermediate