How can I pass the entire JSON string to a Helm chart value?
I have values.yml
where the config value should contain entire JSON with a configuration of an application
...
config: some JSON here
...
and I need to pass this value to a secret template and then mount it as a volume to a Kubernetes pod.
{{- $env := default "integration" .Values.env}}
apiVersion: v1
kind: Secret
metadata:
name: {{ .Release.Name }}-{{ $env }}
type: Opaque
data:
config.json: {{ .Values.config | b64enc | quote }}
However the obvious approach of passing single quoted string like '{"redis": "localhost:6379"}'
fails because Helm for some reason deletes all double quotes in the string (even if I escape them) so I end up with {redis: localhost:6379}
which is not a valid JSON.
Is there any other possibility how to pass configuration to the pod all at once without loading template files with tpl
function and making all needed fields accessible via values.yml
separately?