title: helm - programmatically override subchart values.yaml
body: <p>I'm writing a helm chart that uses the <a href="https://github.com/helm/charts/tree/master/stable/redis" rel="noreferrer">stable/redis</a> chart as a subchart.</p>
  
  <p>I need to override the storage class name used for both microservices within my chart, and within the redis chart.</p>
  
  <p>I'm using helm 2.12.3</p>
  
  <p>I would like to be able to specify redis.master.persistence.storageClass in terms of a template, like so</p>
  
  <pre><code>storage:
    storageClasses:
      name: azurefile
  
  redis:
    usePassword: false
    master:
      persistence:
        storageClass: {{ $.Values.storage.storageClasses.name }}
  </code></pre>
  
  <p>Except, as I understand, templates aren't supported within values.yaml</p>
  
  <p>As this is a public chart, I'm not able to modify it to depend on a global value as described here in <a href="https://github.com/helm/helm/blob/master/docs/chart_template_guide/subcharts_and_globals.md" rel="noreferrer">the documentation</a></p>
  
  <p>I considered using <code>{{ $.Values.redis.master.persistence.storageClass }}</code> elsewhere in my chart rather than <code>{{ $.Values.storage.storageClasses.name }}</code>, but this would:</p>
  
  <ul>
  <li>Not hide the complexity of the dependencies of my chart</li>
  <li>Not scale if I was to add yet another subchart dependency</li>
  </ul>
  
  <p>In my values.yaml file I have:</p>
  
  <pre><code>storage:
    storageClasses:
      name: azurefile
  
  redis:
    master:
      persistence:
        storageClass: azurefile
  
  </code></pre>
  
  <p>I would like to specify a single value in values.yaml that can be overwritten at chart deploy time.</p>
  
  <p>e.g. like this</p>
  
  <pre><code>helm install --set storage.storageClasses.name=foo mychart
  </code></pre>
  
  <p>rather than</p>
  
  <pre><code>helm install --set storage.storageClasses.name=foo --set redis.master.persistence.storageClass mychart
  </code></pre>