<p>Is it best practice to include installation of sub-charts in global part of <code>values.yaml</code>. Example..</p>

<p>Root level <code>values.yaml</code></p>

<pre><code>global:
  foo: bar

  subchartA:
    enable: true
</code></pre>

<p>Or the best practice is to have subcharts out of the global part as shown.</p>

<pre><code>global:
  foo: bar

subchartA:
  enable: true
</code></pre>

<p>Please provide a brief explanation why. Thank you</p>

Shammir
<p>Subchart configuration settings need to be at the top level, outside a <code>global:</code> block.</p>

<p>At a style level, each chart should be independently installable, whether or not it's used as a subchart.  Something like the <a href="https://github.com/helm/charts/tree/master/stable/mysql" rel="nofollow noreferrer">stable/mysql</a> chart is a reasonable example: you can manually <code>helm install mysql stable/mysql --set mysqlPassword=...</code> without mentioning <code>global</code>.  That means when you include it as a dependency its settings need to be under the subchart's key in the <code>values.yaml</code> file.</p>

<p>At a mechanical level, when the subchart is run, the <code>subchartA</code> settings are promoted up to be <code>.Values</code> and then the original <code>global:</code> is merged with that (see <a href="https://helm.sh/docs/topics/chart_template_guide/subcharts_and_globals/" rel="nofollow noreferrer">Subcharts and Globals</a>).  So the subchart itself needs to be aware of the difference</p>

<pre><code>{{/* Option 1 */}}
{{ .Values.global.subchartA.enabled }}

{{/* Option 2 (within subchartA) */}}
{{ .Values.enabled }}
</code></pre>

<p>and at the top level you need to use the form that's compatible with the included chart.</p>

<p>(If you browse through the <a href="https://github.com/helm/charts/tree/master/stable" rel="nofollow noreferrer">"stable" Helm chart repository</a> you'll see <code>global</code> used fairly sparingly; <code>rabbitmq</code> allows you to declare <code>global.imagePullSecrets</code> but that's close to it.)</p>
