<p>I am new to kubernetes helm chart. There is a yaml file named configmap. This file containing all the configuration which are related to the application. Since this file containing a lot of data, I was trying to put some data to the new file and access using FILE object. So created two different file with the name:
<strong>data1.yaml</strong> and <strong>data2.yaml</strong> <br>
<strong>data1.yaml</strong> file have only static data. On the other hand <strong>data2.yaml</strong> file contains dynamic data (some variables also like <code>$.Values.appUrl</code>).
I am able to read static file (data1.yaml) to the configmap.yaml file using FILE object. I am also able to read data2.yaml file but since this file containing some variable also, the variable value is not replacing by actual value. It printing the same variable in configmap file. So my question is,
Is there any way to access dynamic file (which contains variable type data) ? <br>
Below is the example data shown.<br><br>
configmap.yaml file is-&gt;</p>
<pre><code>kind: ConfigMap
apiVersion: v1
metadata:
  name: example-configmap
  namespace: default
data1: {{ .File.Get &quot;data1.yaml&quot; | indent 2 }}
data2: {{ .File.Get &quot;data2.yaml&quot; | indent 2 }}
</code></pre>
<p>data1.yaml file is -&gt;</p>
<pre><code>data1:
  ui.type:2
  ui.color1:red
  ui.color2:green
</code></pre>
<p>data2.yaml file is -&gt;</p>
<pre><code>system.data.name: &quot;app-name&quot;
  system.data.url: {{ $.Values.appUrl }}   # variable
  system.data.type_one: &quot;app-type-xxx&quot;
  system.data.value: &quot;3&quot;
  system.interface.properties: |  
</code></pre>
<p>Values.yaml file is -&gt;</p>
<pre><code>appUrl: &quot;https://app-name.com&quot;
</code></pre>
<p>Output:</p>
<pre><code>kind: ConfigMap
apiVersion: v1
metadata:
  name: example-configmap
  namespace: default
data1:
  ui.type:2
  ui.color1:red
  ui.color2:green
data2:
  system.data.name: &quot;app-name&quot;
  system.data.url: {{ $.Values.appUrl }}    # here should be &quot;https://app-name.com&quot; 
  system.data.type_one: &quot;app-type-xxx&quot;
  system.data.value: &quot;3&quot;
  system.interface.properties: |
</code></pre>

<pre><code>{{ (tpl (.Files.Glob &quot;data2.yaml&quot;).AsConfig . ) | indent 2 }}
</code></pre>
<p>Using above syntax it's picking the actual value of variables. But it also printing the file name like below:</p>
<pre><code>data2.yaml: |-
</code></pre>
<p>So I resolve the issue by using below syntax:</p>
<pre><code>{{ (tpl (.Files.Get &quot;data2.yaml&quot;) . ) | indent 2 }}
</code></pre>
