I have a helm values file (yaml) containing the following block:
env:
- name: <key>
value: <value>
- name: <key1>
value: <value1>
I would like to inject the above block into a kubernetes configmap definition. The result should look the following:
data:
key: value
key1: value1
I tried the following, however the resulting file would contain a yaml sequence instead of a yaml map:
{{ toYaml .Values.env }}
Any advise helping me to solve the problem is appreciated.
You should be able to use:
{{- range .Values.env }}
{{ .name }}:{{ .value}}
{{- end }}