'Helm Template Range
i'm trying to generate a a python dictionary using a values.yaml of a helm.
The values.yaml entry is
replicator:
targets:
- namespace: ns1
- { configmap: ns1cm1, entry: something.yml }
- namespace: ns2
- { configmap: ns2cm1, entry: ns2cm1.yml }
- { configmap: ns2cm2, entry: ns2cm2.yml }
With that input i desire to generate the following:
{
'ns1': [
{'ns1cm1': [ 'something.ym' ]},
],
'ns2': [
{'ns2cm1': [ 'ns2cm1.yml' ]},
{'ns2cm2': [ 'ns2cm2.yml' ]}
],
}
the ConfigMap template is:
data:
targets.py: |
targets = {
{{- range $target := .Values.replicator.targets }}
'{{ $target.namespace }}': [
{{- range $data := .Values.replicator.targets.$target }}
{ '$data.configmap': ['$data.entry'] },
{{- end}}
]
{{- end}}
}
But i'm getting the error Error: cannot load values.yaml: error converting YAML to JSON: did not find expected key but i don't undertand why.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
