<p>I am creating a Helm chart. When doing a dry run I get a error:</p>

<pre><code>Error: YAML parse error on vstsagent/templates/vsts-buildrelease-agent.yaml: error converting YAML to JSON: yaml: line 28: found character that cannot start any token
</code></pre>

<p>The dry run also outputs the secret and deployment YAML file which I created. The part where it goes wrong in the deployment shows:</p>

<pre><code>      - name: ACCOUNT
        valueFrom:
          secretKeyRef:
            name: %!s(&lt;nil&gt;)-%!s(&lt;nil&gt;)
            key: ACCOUNT
      - name: TOKEN
        valueFrom:
          secretKeyRef:
            name:  %!s(&lt;nil&gt;)-%!s(&lt;nil&gt;)
            key: TOKEN
</code></pre>

<p>The output from the dry run for the secret looks fine.</p>

<p>The templates I created:</p>

<pre><code>apiVersion: v1
kind: Secret
metadata:
  name: {{ template "chart.fullname" . }}
type: Opaque
data:
 ACCOUNT: {{ .Values.chart.secret.account }}
 TOKEN: {{ .Values.chart.secret.token }}


apiVersion: apps/v1
kind: Deployment
metadata:
  name: {{ template "chart.fullname" . }}
  labels:
    app: {{ template "chart.name" . }}
    chart: {{ .Chart.Name }}-{{ .Chart.Version }}
    release: {{ .Release.Name }}
    heritage: {{ .Release.Service }}
spec:
  updateStrategy:
    type: RollingUpdate
  template:
    metadata:
      labels:
        release: {{ .Release.Name }}
        app: {{ template "chart.name" . }}
      annotations:
        agentVersion: {{ .Values.chart.image.tag }}
      spec:
        containers:
          - name: {{ template "chart.name" . }}
            image: {{ .Values.chart.image.name }}
            imagePullPolicy: {{ .Values.chart.image.pullPolicy }}
            env:
              - name: ACCOUNT
                valueFrom:
                  secretKeyRef:
                    name: {{ template "chart.fullname" }}
                    key: ACCOUNT
              - name: TOKEN
                valueFrom:
                  secretKeyRef:
                    name:  {{ template "chart.fullname" }}
                    key: TOKEN
</code></pre>

<p>The _helper.tpl looks like this:</p>

<pre><code>{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "chart.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
*/}}
{{- define "chart.fullname" -}}
{{- $name := default .Chart.Name .Values.nameOverride -}}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
{{- end -}}
</code></pre>

<p>Where am I going wrong in this?</p>

bramvdk
<p>I missed 2 dots....</p>

<pre><code>      - name: ACCOUNT
        valueFrom:
          secretKeyRef:
            name: {{ template "chart.fullname" . }}
            key: ACCOUNT
      - name: TOKEN
        valueFrom:
          secretKeyRef:
            name:  {{ template "chart.fullname" . }}
            key: TOKEN
</code></pre>
