<p>I am using helm 3 with k8s, with two siblings charts on root folder: <code>&lt;my-folder&gt;/&lt;chart-1&gt;</code> and <code>&lt;my-folder&gt;/&lt;chart-2&gt;</code>.</p>
<p>The kubectl version:</p>
<blockquote>
<p>Client Version: version.Info{Major:&quot;1&quot;, Minor:&quot;21&quot;,
GitVersion:&quot;v1.21.6&quot;,
GitCommit:&quot;d921bc6d1810da51177fbd0ed61dc811c5228097&quot;,
GitTreeState:&quot;clean&quot;, BuildDate:&quot;2021-10-27T17:50:34Z&quot;,
GoVersion:&quot;go1.16.9&quot;, Compiler:&quot;gc&quot;, Platform:&quot;linux/amd64&quot;} Server
Version: version.Info{Major:&quot;1&quot;, Minor:&quot;21&quot;, GitVersion:&quot;v1.21.6&quot;,
GitCommit:&quot;d921bc6d1810da51177fbd0ed61dc811c5228097&quot;,
GitTreeState:&quot;clean&quot;, BuildDate:&quot;2021-10-27T17:44:26Z&quot;,
GoVersion:&quot;go1.16.9&quot;, Compiler:&quot;gc&quot;, Platform:&quot;linux/amd64&quot;}</p>
</blockquote>
<p>Helm version:</p>
<blockquote>
<p>version.BuildInfo{Version:&quot;v3.3.4&quot;,
GitCommit:&quot;a61ce5633af99708171414353ed49547cf05013d&quot;,
GitTreeState:&quot;clean&quot;, GoVersion:&quot;go1.14.9&quot;}</p>
</blockquote>
<ol>
<li>I have some common data that is used for both charts.</li>
</ol>
<p>I want to use common data for both of the charts, event they do do not participate the same folders.</p>
<p>In <code>yaml</code> files something like:
`{{ include from specific common directory + file }}</p>
<ol start="2">
<li>In <code>values.yaml</code> file I need to add a dynamic variable, that is used in different attributes.</li>
</ol>
<p>i.e. in the file:</p>
<pre><code>mybasevar: &quot;text&quot;
myvariable: {{mybasevar}}-test

myvalue: {{ myvariable }}-tag1
myvalue2: {{ myvariable }}-tag2
</code></pre>
<p>In general, I didn't see an option for variables in <code>yaml</code> (maybe some <em>Go-Lang</em> code, or maybe this is basic on <code>yaml</code> files).</p>
<p>How can I the above?</p>
<p>Thanks.</p>

Eitan
<p>After reading your message carefully and trying to understand what you want to achieve, I would advice to use Helm <a href="https://helm.sh/docs/chart_template_guide/subcharts_and_globals/" rel="nofollow noreferrer">Subcharts and Global Values</a></p>
<p>Let me explain. You could create your Chart (parent) which contains <strong>componentA</strong> and <strong>componentB</strong> as subcharts. In the  <code>Chart.yaml</code> of the parent chart, you would define the next dependencies:</p>
<pre><code>dependencies:
    - name: componentA 
      version: &quot;0.0.1&quot;
      repository: &quot;file://../componentA&quot;
      condition: componentA.enabled
    - name: componentB 
      version: &quot;0.0.1&quot;
      repository: &quot;file://../componentB&quot;
      condition: componentB .enabled
</code></pre>
<p>At this point, you can deploy both components as a whole by using</p>
<pre><code>helm install test parent/
</code></pre>
<p>Going back to your specific case:</p>
<blockquote>
<ol>
<li>I have some common data that is used for both charts.</li>
</ol>
</blockquote>
<p>Then, define it as global in the <code>values.yaml</code> of the parent chart. For example,</p>
<pre><code>autoscaling:
  enabled: false
</code></pre>
<blockquote>
<ol start="2">
<li>In values.yaml file I need to add a dynamic variable, that is used in different attributes.</li>
</ol>
</blockquote>
<p>In this case, add the name of the component in the <code>values.yaml</code> of the parent in the next way:</p>
<pre><code>componentA:
  service:
    port: 80
componentB:
  service:
    port: 90
</code></pre>
<p>At this point, the variables will be dynamically filled in the subchart level. I think this approach would cover your needs nicely.</p>
