<p>First, a little context: I have 4 Kubernetes clusters, one for each environment (develop, staging, testing, prod). Each cluster has its own <code>values.yaml</code> file with env-specific configuration of all helm charts that we've written. </p>

<p>So, when our CD pipeline deploys <code>mychart</code> to the <code>develop</code> cluster, it essentially does the following:</p>

<p><code>helm install -f base-values.yaml -f develop-values.yaml ./mychart.tgz</code></p>

<p>Now, let's presume <code>mychart</code> has a <code>requirements.yaml</code> file which specifies <a href="https://github.com/helm/charts/tree/master/stable/mongodb" rel="nofollow noreferrer">the mongodb chart</a> as a subchart dependency. The mongodb chart references, for example, <code>.Values.mongodbRootPassword</code>. When included as a subchart by <code>mychart</code>, I can set <code>.Values.mongodb.mongodbRootPassword</code> in <code>mychart</code>'s default <code>values.yaml</code> to change this value.</p>

<p>My problem is that given my current CD pipeline, if I set <code>.Values.mongodb.mongodbRootPassword</code> in <code>develop-values.yaml</code>, it will be taken for <em>all</em> mongodb instances that are deployed to the <code>develop</code> cluster - not just <code>mychart</code>'s. </p>

<p>So, my questions:</p>

<ul>
<li>using per-environment <code>values.yaml</code> files, how would I go about setting <code>mychart</code>'s mongodb's root password in one of the cluster-specific <code>values.yaml</code> files?</li>
<li>is this even possible? Or is my current CD approach (per-environment values files) an anti-pattern?</li>
<li>if this is not possible or an anti-pattern, how would you go about setting the values of helm individual charts and subcharts on a per-environment basis?</li>
</ul>

ventolin
<blockquote>
  <ul>
  <li>using per-environment <code>values.yaml</code> files, how would I go about setting <code>mychart</code>'s mongodb's root password in one of the cluster-specific <code>values.yaml</code> files?</li>
  </ul>
</blockquote>

<p>You can override YAML files with <a href="https://github.com/helm/helm/blob/master/docs/charts.md#using-the-cli-with-tags-and-conditions" rel="nofollow noreferrer"><code>--set</code></a> option from <code>install</code></p>

<p><strong>Example:</strong></p>

<p><code>helm install -f base-values.yaml -f develop-values.yaml --set someSection.someValue=1234 ./mychart.tgz</code></p>

<p>Then, you can set CI command call with environment settings and have just one YAML.</p>

<blockquote>
  <ul>
  <li>is this even possible? Or is my current CD approach (per-environment values files) an anti-pattern?</li>
  </ul>
</blockquote>

<p>Nope, that's a feature :-)</p>

<blockquote>
  <ul>
  <li>if this is not possible or an anti-pattern, how would you go about setting the values of helm individual charts and subcharts on a per-environment basis?</li>
  </ul>
</blockquote>

<p>It would be nice also. Perhaps, if your infrastructure grow fast and you have a lot of environments, apps or else, this could be better to manage.</p>
