<p>Deployment.yaml</p>

<pre><code>...
env: {{ .Values.env}}
...
</code></pre>

<p>Values.yaml:</p>

<pre><code>env:
- name: "DELFI_DB_USER"
  value: "yyy"
- name: "DELFI_DB_PASSWORD"
  value: "xxx"
- name: "DELFI_DB_CLASS"
  value: "com.mysql.jdbc.Driver"
- name: "DELFI_DB_URL"
  value: "jdbc:sqlserver://dockersqlserver:1433;databaseName=ddbeta;sendStringParametersAsUnicode=false"
</code></pre>

<p>feels like I'm missing something obvious.<br>
linter says: ok<br>
template says:</p>

<blockquote>
  <p>env: [map[name:DELFI_DB_USER value:yyy] map[name:DELFI_DB_PASSWORD
  value:xxx] map[name:DELFI_DB_CLASS value:com.mysql.jdbc.Driver]
  map[value:jdbc:mysql://dockersqlserver.{{ .Release.Namespace
  }}.svc.cluster.local:3306/ddbeta\?\&amp;amp\;useSSL=true\&amp;amp\;requireSSL=false
  name:DELFI_DB_URL]]</p>
</blockquote>

<p>upgrade says:</p>

<blockquote>
  <p>Error: UPGRADE FAILED: YAML parse error on
  xxx/templates/deployment.yaml: error converting YAML to JSON: yaml:
  line 35: found unexpected ':'</p>
</blockquote>

<p>solution:</p>

<pre><code>env:
{{- range .Values.env }}
- name: {{ .name | quote }}
  value: {{ .value | quote }}
{{- end }}
</code></pre>

<p>The current Go template expansion will give output which is not YAML: </p>

<pre><code>env: {{ .Values.env}}
</code></pre>

<p>becomes:</p>

<pre><code>env: env: [Some Go type stuff that isn't YAML]...
</code></pre>

<p>The Helm Go template needs to loop over the keys of the source YAML dictionary.
This is described in the <a href="https://docs.helm.sh/chart_template_guide/#looping-with-the-range-action" rel="nofollow noreferrer">Helm docs</a>.</p>

<p>The correct Deployment.yaml is:</p>

<pre><code>...
env:
{{- range .Values.env }}
  - name: {{ .name | quote }}
    value: {{ .value | quote }}
{{- end }}
...
</code></pre>
