In one of my Deployment resource template I have something like this (the problem will be the same if using simple yaml resource file) :
...
spec:
containers:
- name: {{ .Release.Name }}
image: {{ template "common.image" . }}
env:
- name: EMAIL_PASSWORD
valueFrom:
secretKeyRef:
name: {{ include "common.fullname" . }}
key: email-password
....
When I run a helm template command, this template generates the following yaml output :
...
spec:
containers:
- env:
- name: BASIC_AUTH_USER
- value: @myPa$$word
...
As you can see, the password starts with a special character "@". Because of that, it generates the following error when I run a helm install or template :
error: error parsing deployment.yaml: error converting YAML to JSON: yaml: line 62: found character that cannot start any token
If I change the password and remove the "@" everything works fine. But I'd like to be sure I will not encounter this error and for that, I need to be able to quote the generated value :
...
spec:
containers:
- env:
- name: BASIC_AUTH_USER
- value: "@myPa$$word"
...
But I didn't find any way to do it. I could add a quote in the secret value but it's not really clean: how to know if the quotes are part of the password or not. If anyone has a solution, I'm very interested. I didn't find anything while Googling.