From bcf73645eb8bf15820172234f71e4ec142777392 Mon Sep 17 00:00:00 2001 From: Diego Rodriguez Date: Fri, 1 May 2020 16:08:46 +0200 Subject: [PATCH] helm: add mail service for development faces --- helm/configurations/values-dev.yaml | 8 +++++ helm/reana/templates/cronjobs.yaml | 17 +++++++--- helm/reana/templates/reana-mail.yaml | 44 ++++++++++++++++++++++++++ helm/reana/templates/reana-server.yaml | 20 ++++++++++++ helm/reana/templates/secrets.yaml | 2 +- helm/reana/values.yaml | 11 +++++-- 6 files changed, 94 insertions(+), 8 deletions(-) create mode 100644 helm/reana/templates/reana-mail.yaml diff --git a/helm/configurations/values-dev.yaml b/helm/configurations/values-dev.yaml index a5b5eabc..07e78ea5 100644 --- a/helm/configurations/values-dev.yaml +++ b/helm/configurations/values-dev.yaml @@ -16,3 +16,11 @@ components: image: reanahub/reana-message-broker reana_ui: image: reanahub/reana-ui + +notifications: + enabled: true + email_config: + # No login nor password as we use a dev mail service + receiver: team@reana.io + sender: notifications@reana.io + system_status: "0 0 * * *" diff --git a/helm/reana/templates/cronjobs.yaml b/helm/reana/templates/cronjobs.yaml index 5adee7ef..55b1cbb1 100644 --- a/helm/reana/templates/cronjobs.yaml +++ b/helm/reana/templates/cronjobs.yaml @@ -16,14 +16,18 @@ spec: args: - /bin/sh - -c - - flask reana-admin status-report --email {{ Values.notifications.email_config.receiver }} + - flask reana-admin status-report --email {{ .Values.notifications.email_config.receiver }} env: - - name: REANA_SMTP_SERVER + {{- if .Values.debug.enabled }} + - name: REANA_EMAIL_SMTP_SERVER + value: {{ include "reana.prefix" . }}-mail + - name: REANA_EMAIL_SMTP_PORT + value: "30025" + {{- else }} + - name: REANA_EMAIL_SMTP_SERVER value: {{ .Values.notifications.email_config.smtp_server }} - - name: REANA_SMTP_PORT + - name: REANA_EMAIL_SMTP_PORT value: {{ .Values.notifications.email_config.smpt_port }} - - name: REANA_EMAIL_SENDER - value: {{ .Values.notifications.email_config.sender }} - name: REANA_EMAIL_LOGIN valueFrom: secretKeyRef: @@ -34,6 +38,9 @@ spec: secretKeyRef: name: {{ include "reana.prefix" . }}-mail-notification-sender-password key: REANA_EMAIL_PASSWORD + {{- end }} + - name: REANA_EMAIL_SENDER + value: {{ .Values.notifications.email_config.sender }} restartPolicy: Never {{- end }} {{- end }} diff --git a/helm/reana/templates/reana-mail.yaml b/helm/reana/templates/reana-mail.yaml new file mode 100644 index 00000000..032b0298 --- /dev/null +++ b/helm/reana/templates/reana-mail.yaml @@ -0,0 +1,44 @@ +{{- if .Values.debug.enabled }} +--- +apiVersion: v1 +kind: Service +metadata: + name: {{ include "reana.prefix" . }}-mail +spec: + type: "NodePort" + ports: + - port: 30025 + targetPort: 25 + nodePort: 30025 + name: "smtp" + protocol: TCP + - port: 32580 + targetPort: 80 + nodePort: 32580 + name: "ui" + protocol: TCP + selector: + app: {{ include "reana.prefix" . }}-mail +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "reana.prefix" . }}-mail +spec: + replicas: 1 + selector: + matchLabels: + app: {{ include "reana.prefix" . }}-mail + template: + metadata: + labels: + app: {{ include "reana.prefix" . }}-mail + spec: + containers: + - name: maildev + image: maildev/maildev + imagePullPolicy: IfNotPresent + ports: + - containerPort: 80 + - containerPort: 25 +{{- end }} diff --git a/helm/reana/templates/reana-server.yaml b/helm/reana/templates/reana-server.yaml index a0c868a1..7508e5a6 100644 --- a/helm/reana/templates/reana-server.yaml +++ b/helm/reana/templates/reana-server.yaml @@ -111,7 +111,25 @@ spec: value: "" - name: GIT_SSL_NO_VERIFY value: "true" + - name: REANA_EMAIL_SMTP_SERVER + value: {{ include "reana.prefix" . }}-mail + - name: REANA_EMAIL_SMTP_PORT + value: "30025" {{- else }} + - name: REANA_EMAIL_SMTP_SERVER + value: {{ .Values.notifications.email_config.smtp_server }} + - name: REANA_EMAIL_SMTP_PORT + value: {{ .Values.notifications.email_config.smpt_port }} + - name: REANA_EMAIL_LOGIN + valueFrom: + secretKeyRef: + name: {{ include "reana.prefix" . }}-mail-notification-sender-password + key: REANA_EMAIL_LOGIN + - name: REANA_EMAIL_PASSWORD + valueFrom: + secretKeyRef: + name: {{ include "reana.prefix" . }}-mail-notification-sender-password + key: REANA_EMAIL_PASSWORD - name: REANA_DB_USERNAME valueFrom: secretKeyRef: @@ -123,6 +141,8 @@ spec: name: {{ include "reana.prefix" . }}-db-secrets key: password {{- end }} + - name: REANA_EMAIL_SENDER + value: {{ .Values.notifications.email_config.sender }} - name: scheduler image: {{ .Values.components.reana_server.image }} imagePullPolicy: {{ .Values.components.reana_server.imagePullPolicy }} diff --git a/helm/reana/templates/secrets.yaml b/helm/reana/templates/secrets.yaml index 134a1c3a..164b4704 100644 --- a/helm/reana/templates/secrets.yaml +++ b/helm/reana/templates/secrets.yaml @@ -32,7 +32,7 @@ data: REANA_GITLAB_OAUTH_APP_ID: {{ .Values.secrets.gitlab.REANA_GITLAB_OAUTH_APP_ID | default "reana_gitlab_oauth_app_id" | b64enc }} REANA_GITLAB_OAUTH_APP_SECRET: {{ .Values.secrets.gitlab.REANA_GITLAB_OAUTH_APP_SECRET | default "reana_gitlab_oauth_app_secret" | b64enc }} REANA_GITLAB_HOST: {{ .Values.secrets.gitlab.REANA_GITLAB_HOST | default "gitlab.cern.ch" | b64enc }} -{{- if .Values.notifications.enabled }} +{{- if and .Values.notifications.email_config.login .Values.notifications.email_config.password }} --- apiVersion: v1 kind: Secret diff --git a/helm/reana/values.yaml b/helm/reana/values.yaml index ac1123de..0f61ff08 100644 --- a/helm/reana/values.yaml +++ b/helm/reana/values.yaml @@ -6,6 +6,8 @@ # `reana_url` should be set for third party integrations to work and for # production deployments to be secure. +reana_url: mb-rodrigdi.cern.ch + debug: enabled: false eos: @@ -29,9 +31,14 @@ shared_storage: secrets: database: {} - gitlab: {} + gitlab: + REANA_GITLAB_OAUTH_APP_ID: abf3561308abbbde3ecdcd82eef209a847fe391999f8686a7b26653771839edc + REANA_GITLAB_OAUTH_APP_SECRET: 9d6b9c4f34c93f3454b31c9771a96f9a683a6478b7c1cd1b0487bae798d2e303 + REANA_GITLAB_HOST: gitlab-test.cern.ch cern: - sso: {} + sso: + CERN_CONSUMER_KEY: mb-rodrigdi + CERN_CONSUMER_SECRET: 1tWTBq11jQqKfN6p0ifZT5eE1bYBIygiK0wfOKLL6Cs1 # External database service configuration db_env_config: