From a6c781499054e9e337bad843c40b13dc064bdb62 Mon Sep 17 00:00:00 2001 From: Marco Donadoni Date: Tue, 30 May 2023 17:05:42 +0200 Subject: [PATCH] helm: allow customisation of SMTP SSL/STARTTLS Closes reanahub/reana#670 --- helm/reana/templates/cronjobs.yaml | 21 +++++++++++++-------- helm/reana/templates/reana-server.yaml | 9 ++++++++- helm/reana/templates/secrets.yaml | 4 ++-- 3 files changed, 23 insertions(+), 11 deletions(-) diff --git a/helm/reana/templates/cronjobs.yaml b/helm/reana/templates/cronjobs.yaml index c9158bba..0c4b22bb 100644 --- a/helm/reana/templates/cronjobs.yaml +++ b/helm/reana/templates/cronjobs.yaml @@ -42,10 +42,6 @@ spec: {{- if .Values.debug.enabled }} - name: FLASK_ENV value: "development" - - name: REANA_EMAIL_SMTP_SERVER - value: {{ printf "%s-mail" (include "reana.prefix" .) }} - - name: REANA_EMAIL_SMTP_PORT - value: "30025" {{- else }} - name: REANA_DB_USERNAME valueFrom: @@ -57,10 +53,21 @@ spec: secretKeyRef: name: {{ include "reana.prefix" . }}-db-secrets key: password + {{- end }} + - name: REANA_EMAIL_SENDER + value: {{ .Values.notifications.email_config.sender }} - name: REANA_EMAIL_SMTP_SERVER - value: {{ .Values.notifications.email_config.smtp_server }} + value: {{ .Values.notifications.email_config.smtp_server | default (printf "%s-mail" (include "reana.prefix" .)) }} - name: REANA_EMAIL_SMTP_PORT - value: "{{ .Values.notifications.email_config.smtp_port }}" + value: "{{ .Values.notifications.email_config.smtp_port | default "30025" }}" + - name: REANA_EMAIL_SMTP_SSL + value: {{ .Values.notifications.email_config.smtp_ssl | default "false" | quote }} + {{- if .Values.debug.enabled }} + - name: REANA_EMAIL_SMTP_STARTTLS + value: "false" + {{- else }} + - name: REANA_EMAIL_SMTP_STARTTLS + value: {{ .Values.notifications.email_config.smtp_starttls | default "true" | quote }} - name: REANA_EMAIL_LOGIN valueFrom: secretKeyRef: @@ -74,8 +81,6 @@ spec: {{- end }} - name: REANA_COMPONENT_PREFIX value: {{ include "reana.prefix" . }} - - name: REANA_EMAIL_SENDER - value: {{ .Values.notifications.email_config.sender }} - name: REANA_ADMIN_ACCESS_TOKEN valueFrom: secretKeyRef: diff --git a/helm/reana/templates/reana-server.yaml b/helm/reana/templates/reana-server.yaml index c26ae4f4..ed551cef 100644 --- a/helm/reana/templates/reana-server.yaml +++ b/helm/reana/templates/reana-server.yaml @@ -186,7 +186,14 @@ spec: value: {{ .Values.notifications.email_config.smtp_server | default (printf "%s-mail" (include "reana.prefix" .)) }} - name: REANA_EMAIL_SMTP_PORT value: "{{ .Values.notifications.email_config.smtp_port | default "30025" }}" - {{- if not .Values.debug.enabled }} + - name: REANA_EMAIL_SMTP_SSL + value: {{ .Values.notifications.email_config.smtp_ssl | default "false" | quote }} + {{- if .Values.debug.enabled }} + - name: REANA_EMAIL_SMTP_STARTTLS + value: "false" + {{- else }} + - name: REANA_EMAIL_SMTP_STARTTLS + value: {{ .Values.notifications.email_config.smtp_starttls | default "true" | quote }} - name: REANA_EMAIL_LOGIN valueFrom: secretKeyRef: diff --git a/helm/reana/templates/secrets.yaml b/helm/reana/templates/secrets.yaml index fb22f668..2e165571 100644 --- a/helm/reana/templates/secrets.yaml +++ b/helm/reana/templates/secrets.yaml @@ -70,8 +70,8 @@ metadata: "helm.sh/resource-policy": keep type: Opaque data: - REANA_EMAIL_LOGIN: {{ .Values.notifications.email_config.login | default "team@reana.io" | b64enc }} - REANA_EMAIL_PASSWORD: {{ .Values.notifications.email_config.password | default "CHANGEME" | b64enc }} + REANA_EMAIL_LOGIN: {{ .Values.notifications.email_config.login | default "" | b64enc | quote }} + REANA_EMAIL_PASSWORD: {{ .Values.notifications.email_config.password | default "" | b64enc | quote }} {{- end }} --- {{- if and .Values.ingress.enabled .Values.ingress.tls.self_signed_cert }}