How not to overwrite randomly generated secrets in Helm templates
问题 I want to generate a password in a Helm template, this is easy to do using the randAlphaNum function. However the password will be changed when the release is upgraded. Is there a way to check if a password was previously generated and then use the existing value? Something like this: apiVersion: v1 kind: Secret metadata: name: db-details data: {{ if .Secrets.db-details.db-password }} db-password: {{ .Secrets.db-details.db-password | b64enc }} {{ else }} db-password: {{ randAlphaNum 20 |