I want to generate complex JSON with HELM template
I have a template:
apiVersion: v1
kind: ConfigMap
metadata:
name: test
data:
config.json: |
{
"test": "{{ $Value }}",
"services": {
{{- range $k, $v := $.Values.services }}
"{{ $k | upper }}_PATH": "{{ $k }}",
{{- end }}
}
}
Helm chars generates json:
{
"test": "test",
"services": {
"S1_PATH": "/t1",
"S2_PATH": "/t2",
"S2_PATH": "/t3",
}
}
Problem is that JSON is not valid as it has a trailing comma. How to update the template to resolve this?