<p>I've created some secrets and I'm trying to import the file in this way:</p>

<pre><code>apiVersion: v1
kind: Secret
metadata:
  name: {{ template "amq.broker.fullname" . }}-tls
  labels:
    app: {{ template "amq.name" . }}
    chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
    component: "{{ .Values.broker.name }}"
    release: "{{ .Release.Name }}"
    heritage: "{{ .Release.Service }}"
type: Opaque
data:
{{ (.Files.Glob "secrets/broker.ks").AsSecrets | indent 2 }}
</code></pre>

<p>The file is under the <code>secrets</code> dir. When I run the install, the <code>broker.ks</code> secret is not there. However the secret is under the <code>secrets</code> folder. Any idea?</p>

<p>Here the dir struct</p>

<pre><code>├── Chart.yaml
├── README.md
├── secrets
│   ├── broker.ks
│   ├── broker_cert
│   ├── client.ks
│   └── client.ts
├── templates
│   ├── NOTES.txt
│   ├── _helpers.tpl
└── values.yaml
</code></pre>

<p>The solution to this is, as per the <a href="https://helm.sh/docs/chart_template_guide/accessing_files/#configmap-and-secrets-utility-functions" rel="nofollow noreferrer">docs</a>, the following:</p>
<pre><code>{{- $root := . -}}
{{- range $path, $bytes := .Files.Glob &quot;secrets/broker.ks&quot; }}
{{ base $path }}: '{{ $root.Files.Get $path | b64enc }}'
{{- end }}
</code></pre>
<p>You can also pull all the files of a specific type in the folder with <code>.Files.Glob &quot;secrets/*.ks&quot;</code></p>
<p>Also make sure that the folder has not been added to <code>.helmignore</code> otherwise the files won't be accessible.</p>
