<p>I am trying to pass entire set of yamls from <code>values.yaml</code> in helm to the <code>templates</code>, so that whatever yaml inputs I pass in the values.yaml section goes in the templates yaml as it is :</p>
<p>For example :</p>
<p><code>values.yaml</code></p>
<pre><code>...
...
metallbConfig: |-
  apiVersion: metallb.io/v1beta2
  kind: BGPPeer
  metadata:
    creationTimestamp: null
    name: peer1
    namespace: metallb-system
  spec:
    holdTime: 3s
    keepaliveTime: 0s
    myASN: 64026
    passwordSecret: {}
    peerASN: 65227
    peerAddress: 10.252.254.194
  status: {}
</code></pre>
<p><code>templates/resources.yaml</code> :</p>
<pre><code>{{ toYaml .Values.metallbConfig }}
</code></pre>
<p>Essentially what I want to achieve is whole <code>BGPPeer</code> section to be present in the <code>resources.yaml</code> when I deploy the chart.</p>
<p>Currently I am getting this error :</p>
<pre><code># helm template metallbcnf . --output-dir outputs --debug
...
...
Error: YAML parse error on metallb/templates/resources.yaml: error unmarshaling JSON: while decoding JSON: json: cannot unmarshal string into Go value of type releaseutil.SimpleHead
helm.go:84: [debug] error unmarshaling JSON: while decoding JSON: json: cannot unmarshal string into Go value of type releaseutil.SimpleHead
</code></pre>
<p>Kindly help me resolve the same.</p>

<p>If you want to embed the yaml entirely, you don't need the <code>|-</code></p>
<p>For example, I have this in <code>values.yaml</code></p>
<pre class="lang-yaml prettyprint-override"><code>...
probes:
  livenessProbe:
    httpGet:
      path: /ping
      port: 80
    initialDelaySeconds: 15
    periodSeconds: 60
    successThreshold: 1
    timeoutSeconds: 5
    failureThreshold: 3
  readinessProbe:
    httpGet:
      path: /ping
      port: 80
    initialDelaySeconds: 15
    periodSeconds: 60
    successThreshold: 1
    timeoutSeconds: 5
    failureThreshold: 3
...
</code></pre>
<p>Then use this in my helm deployment:</p>
<pre class="lang-yaml prettyprint-override"><code>apiVersion: apps/v1
kind: Deployment
...
spec:
  ...
  template:
    ...
    spec:
      ...
      containers:
        - name: {{ .Chart.Name }}
          image: &quot;{{ .Values.image.repository }}:{{ .Values.image.tag}}&quot;
          imagePullPolicy: {{ .Values.image.pullPolicy }}

          {{- toYaml .Values.probes | nindent 10 }}
           ...
      ...
</code></pre>
<p>You'll notice I need to be explicit about the indenting using <code>nindent</code> otherwise helm just pastes in the yaml as in the <code>values.yaml</code> which breaks the parsing</p>
