How do you quote values safely?
BeginnerConceptTemplating: Go Templates & Sprig
Answer
Use quote (double quotes, with escaping) or squote:
env:
- name: LOG_LEVEL
value: {{ .Values.logLevel | quote }}
- name: FEATURE_FLAG
value: {{ .Values.featureFlag | quote }} # true -> "true", required for env values
Environment variable values and annotations must be strings; an unquoted true or 8080 fails with cannot unmarshal bool into Go struct field EnvVar.value of type string. Do not quote fields that must be integers, such as containerPort or replicas.
More on Templating: Go Templates & Sprig
What template language does Helm use?BeginnerWhat does the dot (`.`) mean in a Helm template?BeginnerWhat is `$` and when do you need it?IntermediateHow does whitespace control (`{{-` and `-}}`) work?BeginnerHow do `if`, `else if` and `else` evaluate truthiness?BeginnerWhat do `and`, `or`, `not`, `eq`, `ne`, `lt`, `gt` look like in Helm?Beginner