<p>I have deployed many things with Helm into my Kubernetes cluster. My values.yaml file contains a lot of fields.</p>
<p>The only modification I want to perform is add an additional environment variable to my cron job. (This cron job creates a pod where a python script should be able to read this environment variable)</p>
<pre><code>apiVersion: batch/v1beta1
kind: CronJob
...
...
    containers:
        - env:
            - name: existing_env_var
              value: &quot;dummy_value&quot;
            - name: new_env_var                # I want to add this one
              value: &quot;this is the new one&quot;
</code></pre>
<p>The update must be done keeping the old unmodified values. The command:
<code>helm upgrade [name] [path] --reuse-values</code></p>
<p>The problem is that cron job is not upgraded, meaning my python script can not use the new env variable. Only reason I can think of that no changes were made in the context of helm because none of the values were modified.</p>
<p>How could I upgrade my CronJob while reusing the old values. Any help appreciated.</p>

Robert
<p>This has got to do with the definition of the <code>--reuse-values</code> flag. As per the documentation <a href="https://helm.sh/docs/helm/helm_upgrade/" rel="nofollow noreferrer">here</a>:</p>
<pre><code>--reuse-values : when upgrading, reuse the last release's values and merge in any overrides from the command line via --set and -f
</code></pre>
<p>Trying overrides directly from within the chart while using <code>--reuse-values</code> would not work. Pass the new value (which is the only value you want to add to this chart) via --set or -f.</p>
<p>This will presumably mean you will have to tweak your chart a bit to pass the environment variables to your cron job via values file.</p>
<p>This <a href="https://medium.com/@kcatstack/understand-helm-upgrade-flags-reset-values-reuse-values-6e58ac8f127e" rel="nofollow noreferrer">article</a> explains its usage very well.</p>
