diff --git a/helm/mail/templates/_helpers.tpl b/helm/mail/templates/_helpers.tpl index a4ef7f0..17f519a 100644 --- a/helm/mail/templates/_helpers.tpl +++ b/helm/mail/templates/_helpers.tpl @@ -76,3 +76,14 @@ checksum/configmap: {{ include (print $.Template.BasePath "/configmap.yaml") . | configmap.reloader.stakater.com/reload: "{{ include "mail.fullname" . }}" {{- end -}} +{{/* +Return the secret containing HTTPS/TLS certificates +*/}} +{{- define "tls.SecretName" -}} +{{- $secretName := .Values.certs.existingSecret -}} +{{- if $secretName -}} + {{- printf "%s" (tpl $secretName .) -}} # Use '.' for context, not '$' +{{- else -}} + {{- printf "%s-cert" (include "smtp-relay-mail-certs" .) -}} +{{- end -}} +{{- end -}} \ No newline at end of file diff --git a/helm/mail/templates/statefulset.yaml b/helm/mail/templates/statefulset.yaml index 1d0ebd2..1fd7bd3 100644 --- a/helm/mail/templates/statefulset.yaml +++ b/helm/mail/templates/statefulset.yaml @@ -195,7 +195,7 @@ spec: defaultMode: 0755 - name: certs secret: - secretName: {{ .Values.certs.name }} + secretName: {{ include "keycloak.tlsSecretName" . }} {{- end }} # Socket directories {{- if and .Values.persistence.enabled .Values.persistence.existingClaim }} diff --git a/helm/mail/values.yaml b/helm/mail/values.yaml index e66ba9b..e32f353 100644 --- a/helm/mail/values.yaml +++ b/helm/mail/values.yaml @@ -129,8 +129,8 @@ certs: create: false # Provide existing cert existing: false - # Provide Cert Name - name: "smtp-relay-mail-certs" + # Provide existing secret name + existingSecret: "" # Define data which should be stored in a Secret # (and shared with the pod as environment variables)