I found the issue.
This is how I finally made it work as I expected:
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ .Values.configMapName }}
labels:
app: {{ .Release.Name }}
data:
{{- range $path, $bytes := .Files.Glob "config/*.yaml" }}
{{ base $path }}: |
{{ tpl (toString $bytes | indent 2) $ | indent 4 }}
{{- end }}
The trick is in the range before the .Files.Glob, and the toString
of the file value (as Glob returns a byte array).