<p>For context I have an application, and it depends on the <code>mysql</code> chart. I've set up the <a href="https://github.com/helm/charts/tree/master/stable/mysql" rel="nofollow noreferrer">mysql stable</a> chart as a dependent chart in <code>myapp</code> chart.</p>
<p>I have a very large set of sql files, and due to their size, I need to pack them into a specialized seed container. Using the standard helm chart, I can pass in a seed container to init my database as shown in the below <code>values.yaml</code> snippet.</p>
<p>Are there any strategies to get subchart values created at runtime into my <code>values.yaml</code>?</p>
<pre><code>mysql:
  extraInitContainers: |
    - name: init-seed
      image: foobar/seed:0.1.0
      env: 
      - name: MYSQL_HOSTNAME
        value: foobar-mysql
      - name: MYSQL_USER
        value: foo
      - name: MYSQL_PASS
        value: bar
</code></pre>
<p>I've tried ways to do the below, but to no avail.</p>
<p>a. Templatize and pass a service name into the <code>MYSQL_HOSTNAME</code> env var</p>
<p>b. Pass the <code>{{ include &quot;mangos_zero.fullname&quot; . }}</code> helper into this value</p>
<p>c. Find the name of the other container within the <code>mysql</code> pod at runtime?</p>
<p>How can I get the service name of the <code>mysql-chart</code> or it's container name passed into my init pod?</p>

<p>Not into your <code>values.yaml</code> but yes into your templates. Assuming you are using Helm v3 you can use the <a href="https://helm.sh/docs/chart_template_guide/functions_and_pipelines/#using-the-lookup-function" rel="nofollow noreferrer">lookup function</a>. For example, wherever you need the service name from your MySQL DB to create your seed data.</p>
<pre class="lang-yaml prettyprint-override"><code>(lookup &quot;v1&quot; &quot;Service&quot; &quot;mynamespace&quot; &quot;mysql-chart&quot;).metadata.name
</code></pre>
