I have a custom helm chart that I wrote which has a deployment.yaml
, service.yaml
and other yamls. Now, I want to included a sealed-secret.yaml template file such as following in it:
{{- if .Values.sealedSecrets -}}
apiVersion: bitnami.com/v1alpha1
kind: SealedSecret
metadata:
creationTimestamp: null
name: {{ include "mychart.fullname" . }}-sealedsecret
namespace: {{ .Release.Namespace }}
labels:
{{- include "mychart.labels" . | nindent 4 }}
annotations:
"helm.sh/hook": pre-install
spec:
encryptedData:
{{- range .Values.sealedSecrets }}
{{ .key }}: {{ .value }}
{{- end }}
template:
data: null
metadata:
creationTimestamp: null
name: {{ include "mychart.fullname" . }}-sealedsecret
namespace: {{ .Release.Namespace }}
{{- end }}
However, when I install my app using the Helm chart I don't see the secret being generated. I also checked the Helm manifest for the deployed app and I don't see the sealed-secret.yaml file in it.
Do I need to do something special for a sealed secret?
I hope this example helps to you :) @Katlock
create a new chart:
see original chart files
remove unnecessary files for testing
create SealedSecret helm template file
create a values.yaml file for key-value secrets
see last file status
run helm template command to see created SealedSecret k8s object