<p>We are using helm to deploy many charts, but for simplicity let's say it is two charts. A parent chart and a child chart: </p>

<pre><code>helm/parent 
helm/child
</code></pre>

<p>The parent chart has a <code>helm/parent/requirements.yaml</code> file which specifies:</p>

<pre><code>dependencies:
  - name: child
    repository: file://../child
    version: 0.1.0
</code></pre>

<p>The child chart requires a bunch of environment variables on startup for configuration, for example in <code>helm/child/templates/deployment.yaml</code> </p>

<pre><code>apiVersion: extensions/v1beta1
kind: Deployment
spec:
  replicas: 1
  strategy:
    type: Recreate
  template:
    spec:
      containers:
        env:
        - name: A_URL
          value: http://localhost:8080
</code></pre>

<p>What's the best way to override the child's environment variable from the parent chart, so that I can run the parent using below command and set the <code>A_URL</code> env variable for this instance to e.g. <code>https://www.mywebsite.com</code>?</p>

<pre><code>helm install parent --name parent-release --namespace sample-namespace
</code></pre>

<p>I tried adding the variable to the parent's <code>helm/parent/values.yaml</code> file, but to no avail</p>

<pre><code>global:
  repository: my_repo
  tag: 1.0.0-SNAPSHOT
child:
  env:
    - name: A_URL
      value: https://www.mywebsite.com
</code></pre>

<p>Is the syntax of the parent's value.yaml correct? Is there a different approach? </p>

Bernie Lenz
<p>In the child chart you have to explicitly reference a value from the configuration.  (Having made this change you probably need to run <code>helm dependency update</code> from the parent chart directory.)</p>

<pre class="lang-yaml prettyprint-override"><code># child/templates/deployment.yaml, in the pod spec
env:
- name: A_URL
  value: {{ .Values.aUrl | quote }}
</code></pre>

<p>You can give it a default value for the child chart.</p>

<pre class="lang-yaml prettyprint-override"><code># child/values.yaml
aUrl: "http://localhost:8080"
</code></pre>

<p>Then in the parent chart's values file, you can provide an override value for that.</p>

<pre class="lang-yaml prettyprint-override"><code># parent/values.yaml
child:
  aUrl: "http://elsewhere"
</code></pre>

<p>You can't use Helm to override or inject arbitrary YAML, except to the extent the templates allow for it.</p>
