79145265

Date: 2024-10-31 15:16:56
Score: 0.5
Natty:
Report link

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).

Reasons:
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (0.5):
Posted by: Alessandro D'Armiento