You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
675 B
YAML
23 lines
675 B
YAML
# store the secret-name as variable
|
|
{{- $secret_name := "iam-secrets" -}}
|
|
---
|
|
apiVersion: v1
|
|
kind: Secret
|
|
metadata:
|
|
name: "{{ $secret_name }}"
|
|
annotations:
|
|
"helm.sh/resource-policy": "keep"
|
|
data:
|
|
# try to get the old secrets
|
|
# keep in mind, that a dry-run only returns an empty map
|
|
{{- $previous := lookup "v1" "Secret" .Release.Namespace $secret_name }}
|
|
|
|
# check, if a secret is already set
|
|
{{- if or (not $previous) (not $previous.data) }}
|
|
# if not set, then generate a new password
|
|
JWT_SECRET: "{{ .Values.iam.jwt.secret | b64enc }}"
|
|
{{ else }}
|
|
# if set, then use the old value
|
|
JWT_SECRET: "{{ index $previous.data "JWT_SECRET" }}"
|
|
{{ end }}
|