I need read a field file
from values.yml
for a configMap setup, it's my template:
{{- if .Values.configMap.enabled }}
{{- range .Values.configMapMount }}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ .name }}
data:
{{ .file }}: {{ $.Files.Get "files/{{ .file }}" | printf "%s" | indent 4 }}
{{- end }}
{{- end }}
Obviously this template doesn't work...there is a way to read {{ .file }}
inside "files/{{ .file }}"
?
Thanks
You can't nest template actions. Use a variable instead.
Something like this:
{{- if .Values.configMap.enabled }}
{{- range .Values.configMapMount }}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ .name }}
data:
{{- $f := printf "files/%s" .file }}
{{ .file }}: {{ $.Files.Get $f | printf "%s" | indent 4 }}
{{- end }}
{{- end }}