<p>I'm working on an umbrella chart which has several child charts.
On the top level, I have a file values-ext.yaml which contains some values which are used in the child charts.</p>
<pre><code>sql:
  common:
    host: &lt;SQL Server host&gt;
    user: &lt;SQL user&gt;
    pwd: &lt;SQL password&gt;
</code></pre>
<p>These settings are read in configmap.yaml of a child chart. In this case, a SQL Server connection string is built up from these settings.</p>
<pre><code>apiVersion: v1
kind: ConfigMap
metadata:
  name: &quot;childchart-config&quot;
  labels:
    app: some-app
    chart: my-child-chart
data:
  ConnectionStrings__DbConnection: Server={{ .Values.sql.common.host }};Database=some-db
</code></pre>
<p>I test the chart from the umbrella chart dir like this: <code>helm template --values values-ext.yaml .</code>
It gives me this error:</p>
<pre><code>executing &quot;my-project/charts/child-chart/templates/configmap.yaml&quot; at &lt;.Values.sql.common.host&gt;: 
nil pointer evaluating interface {}.host
</code></pre>
<p>So, it clearly can't find the values that I want to read from the values-ext.yaml file.
I should be able to pass in additional values files like this, right?
I also tried with <code>$.Values.sql.common.host</code> but it doesn't seem to matter.</p>
<p>What's wrong here?</p>

<p>When the child charts are rendered, their <code>.Values</code> are <a href="https://docs.helm.sh/docs/topics/charts/#scope-dependencies-and-values" rel="nofollow noreferrer">a subset of the parent chart values</a>.  Using <code>$.Values</code> to &quot;escape&quot; the current scope doesn't affect this at all.  So within <code>child-chart</code>, .Values in effect refers to what <code>.Values.child-chart</code> would have referred to in the parent.</p>
<p>There's three main things you can do about this:</p>
<ol>
<li><p>Move the settings down one level in the YAML file; you'd have to repeat them for each child chart, but they could be used unmodified.</p>
<pre class="lang-yaml prettyprint-override"><code>child-chart:
  sql:
    common: { ... }
</code></pre>
</li>
<li><p>Move the settings under a <a href="https://docs.helm.sh/docs/topics/charts/#global-values" rel="nofollow noreferrer"><code>global:</code></a> key.  All of the charts that referenced this value would have to reference <code>.Values.global.sql...</code>, but it would be consistent across the parent and child charts.</p>
<pre class="lang-yaml prettyprint-override"><code>global:
  sql:
    common: { ... }
</code></pre>
<pre class="lang-yaml prettyprint-override"><code>ConnectionStrings__DbConnection: Server={{ .Values.global.sql.common.host }};...
</code></pre>
</li>
<li><p>Create the ConfigMap in the parent chart and indirectly refer to it in the child charts.  It can help to know that all of the charts will be installed as part of the same Helm release, and if you're using the standard <code>{{ .Release.Name }}-{{ .Chart.Name }}-suffix</code> naming pattern, the <code>.Release.Name</code> will be the same in all contexts.</p>
<pre class="lang-yaml prettyprint-override"><code># in a child chart, that knows it's being included by the parent
env:
  - name: DB_CONNECTION
    valueFrom:
      configMapKeyRef:
        name: '{{ .Release.Name }}-parent-dbconfig'
        key: ConnectionStrings__DbConnection
</code></pre>
</li>
</ol>
