<p>I have a cronjob running in an aks. Its rollout with an helm chart:</p>
<pre><code>apiVersion: batch/v1
kind: CronJob
metadata:
  name: {{ include &quot;gdp-chart.fullname&quot; . }}-importjob
  labels:
    {{- include &quot;gdp-chart.labels&quot; . | nindent 4 }}
spec:
  suspend: {{ .Values.import.suspend }}
  schedule: {{ .Values.import.schedule }}
  jobTemplate:
    metadata:
      name: import-job
    spec:
      template:
        spec:
          containers:
          - image: curlimages/curl
            name: import-job
            args:
            - &quot;$(GDP_INT_IMPORT_URL)&quot;
            {{- with .Values.import.env}}
            env:
              {{- toYaml . | nindent 12}}
            {{- end}}
          restartPolicy: Never

</code></pre>
<p>I want to set, <code>spec.schedule</code> with helm command, what works if the first character is an number:</p>
<p><code>helm upgrade --reuse-values --set import.schedule='1 13 8 12 *'  gdp gdp-api</code></p>
<p>But if its <code>*</code> it fails:</p>
<p><code>helm upgrade --reuse-values --set import.schedule='* 13 8 12 *'  gdp gdp-api</code></p>
<p><code>Error: UPGRADE FAILED: YAML parse error on gdp-api/templates/cronjob.yaml: error converting YAML to JSON: yaml: line 12: did not find expected alphabetic or numeric character</code></p>
<p>why is that so and can i somehow escape this? What also surprises me is that the error in another line.</p>

DaveVentura
<p>If a YAML value starts with a <code>*</code> then it is a YAML <a href="https://yaml.org/spec/1.2.2/#71-alias-nodes" rel="nofollow noreferrer">alias node</a> that refers to another <code>&amp;anchor</code> node earlier in the document.  (It's somewhat unusual to use this particular YAML feature in Kubernetes and especially with Helm; you see it occasionally in Docker Compose setups.)</p>
<pre class="lang-yaml prettyprint-override"><code>schedule: * 13 8 12 *

# looks like (not valid Kubernetes syntax)
x-schedule: &amp;sched '* 13 8 12 *'
schedule: *sched
</code></pre>
<p>To avoid this, you need to quote the output value, so it doesn't look like a YAML anchor.</p>
<pre class="lang-yaml prettyprint-override"><code>schedule: &quot;* 13 8 12 *&quot;
</code></pre>
<p>There are a couple of ways to do this in a Helm chart; either directly insert the quotes, or the naïve <code>quote</code> helper, or the more robust but less-documented <code>toJson</code> helper.</p>
<pre class="lang-yaml prettyprint-override"><code>{{/* any of these will work */}}
schedule: &quot;{{ .Values.import.schedule }}&quot;
schedule: {{ quote .Values.import.schedule }}
schedule: {{ .Values.import.schedule | quote }}
schedule: {{ toJson .Values.import.schedule }}
</code></pre>
