I have a list of properties defined in values.yaml
as follows:
files:
- "file1"
- "file2"
Then in my template I want to create config maps out of my values.
I came up with the following template:
{{- range $value := .Values.files }}
---
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ $value }}
data:
{{ $value }}: {{ .Files.Get (printf "%s/%s" "files" $value) | indent 4 }}
{{- end }}
As you can see I want to have configmaps with same name as files. I mixed up several parts of documentation, however my template does not work as expected.
How can I achieve configmap creation through templates?
//EDIT I expect to have the following ConfigMap:
apiVersion: v1
kind: ConfigMap
metadata:
name: file1
data:
file1: <file1 content>
---
apiVersion: v1
kind: ConfigMap
metadata:
name: file2
data:
file2: <file2 content>