<p>I am getting the below error while executing the helm chart.</p>
<p>Error: YAML parse error on helmcharts/templates/route.yaml: error converting YAML to JSON: yaml: line 25: could not find expected ':'</p>
<p>The chart works fine if I remove the multiline string &quot;|-&quot; from the Values.yaml file while referring the certificate to route.yaml. Since I remove &quot;|-&quot; the cert contents are not preserved with proper indentation while it's copied to route.yaml and the route fail to create.</p>
<pre><code>    key:   &lt;--- works if I don't provide multiline &quot;|-&quot;
      -----BEGIN CERTIFICATE-----
      [...]
      -----END CERTIFICATE-----
    certificate:
      -----BEGIN CERTIFICATE-----
      [...]
      -----END CERTIFICATE-----
    caCertificate:
      -----BEGIN CERTIFICATE-----
      [...]
      -----END CERTIFICATE-----
</code></pre>
<p>How I can solve this issue? Is it a proper way to provide the cert content in values.yaml file and passing it route.yaml. In the case of Ingress, it's pretty simple just creating a tls secret object and passing the filename in values.yaml but how can we achieve the same in openshift route?</p>
<p>Values.yaml</p>
<pre><code>route:
  Enabled: true
  annotations:
    haproxy.router.openshift.io/cookie_name: SESSION_XLD
    haproxy.router.openshift.io/disable_cookies: &quot;false&quot;
    haproxy.router.openshift.io/rewrite-target: /
  path: /
  hosts:
    - www.example.com
  tls:
    key: |-       &lt;--- Doesn't work if i provide this &quot;|-&quot;
      -----BEGIN CERTIFICATE-----
      [...]
      -----END CERTIFICATE-----
    certificate: |- &lt;--- Doesn't work if I provide this &quot;|-&quot;
      -----BEGIN CERTIFICATE-----
      [...]
      -----END CERTIFICATE-----
    caCertificate: |- &lt;--- Doesn't work if i provide this &quot;|-&quot;
      -----BEGIN CERTIFICATE-----
      [...]
      -----END CERTIFICATE-----
    insecureEdgeTerminationPolicy: Redirect
</code></pre>
<p>route.yaml</p>
<pre><code>    25  {{- if $.Values.route.tls }}
    26    tls:
    27    {{- with $.Values.route.tls }}
    28      key: |-
    29        {{ .key }}
    30      certificate: |-
    31        {{ .certificate }}
    32      caCertificate: |-
    33        {{ .caCertificate }}
    34      insecureEdgeTerminationPolicy: {{ .insecureEdgeTerminationPolicy }}
    35    {{- end }}
    36      termination: edge
    37  {{- end }}
</code></pre>

chandrashekar
<p><code>.Values.route.tls.key</code> (for example) is a multi-line string, but the way you're embedding it, you're only indenting the first line.  If you run <code>helm template</code> on this, I'd expect you see (with exactly this indentation):</p>
<pre class="lang-yaml prettyprint-override"><code>      key: |-
              -----BEGIN CERTIFICATE-----
[...]
-----END CERTIFICATE-----
</code></pre>
<p>You can use the <a href="https://docs.helm.sh/docs/chart_template_guide/function_list/#indent" rel="nofollow noreferrer"><code>indent</code></a> template function to indent the whole string:</p>
<pre class="lang-yaml prettyprint-override"><code>key: |-
{{ .key | indent 8 }}
</code></pre>
<p><code>indent</code> also indents the first line; the amount of indentation should be 2 more than the number of spaces on the <code>key:</code> line.</p>
