<p>I am trying to create a helm chart of kind ConfigMap that will replace the following command from kubernates.</p>
<pre><code>kubectl create configmap my-config -n $namespace --from-file=./my-directory
</code></pre>
<p><code>my-directory</code> contains around 5 files, 2 of them are properties file and 2 of them jpg file. I see the following result for <code>kubectl get cm</code>, I can see <code>4</code> DATA files in configMap</p>
<pre><code>[admin@cluster ~]$ kubectl get cm
NAME                   DATA   AGE
warm-up-config         4      41m
</code></pre>
<p>I created a template as follows, it work if I specify only properties file but If I add jpg files it doesn't work at all</p>
<pre><code>apiVersion: v1
kind: ConfigMap
metadata:
  name: my-config
data:
{{ (.Files.Glob &quot;resources/*&quot;).AsConfig | nindent 2 }}
</code></pre>
<p>Does anyone know how I make this work.</p>

<p>JPG files are binary, and should be added as such.</p>
<pre><code>data:
  binaryData:
    {{ .Files.Get &quot;/path/to/file.jpg&quot; }}
</code></pre>
<p>Files in <code>binaryData</code> field must be encoded with base64, so:</p>
<pre><code>{{ .Files.Get &quot;/path/to/file.jpg&quot; | b64enc }}
</code></pre>
<p>Don't forget proper indentation:</p>
<pre><code>{{ .Files.Get &quot;/path/to/file.jpg&quot; | b64enc | nindent 4 }}
</code></pre>
