I've created some secrets and I'm trying to import the file in this way:
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 }}
The file is under the secrets
dir. When I run the install, the broker.ks
secret is not there. However the secret is under the secrets
folder. Any idea?
Here the dir struct
├── Chart.yaml
├── README.md
├── secrets
│ ├── broker.ks
│ ├── broker_cert
│ ├── client.ks
│ └── client.ts
├── templates
│ ├── NOTES.txt
│ ├── _helpers.tpl
└── values.yaml
The solution to this is, as per the docs, the following:
{{- $root := . -}}
{{- range $path, $bytes := .Files.Glob "secrets/broker.ks" }}
{{ base $path }}: '{{ $root.Files.Get $path | b64enc }}'
{{- end }}
You can also pull all the files of a specific type in the folder with .Files.Glob "secrets/*.ks"
Also make sure that the folder has not been added to .helmignore
otherwise the files won't be accessible.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With