diff --git a/helm/reana/README.md b/helm/reana/README.md index a98d4752..d5c39ac8 100644 --- a/helm/reana/README.md +++ b/helm/reana/README.md @@ -8,7 +8,7 @@ This Helm automatically prefixes all names using the release name to avoid colli | Parameter | Description | Default value | |----------------------------------------------------------|--------------------------------------------------------------------------------------|-------------------------------------------------| -| `components.reana_db.enabled` | Instantiate a PostgreSQL database inside the cluster | true | +| `components.reana_db.enabled` | Instantiate a PostgreSQL database inside the cluster | true | | `components.reana_job_controller.image` | [REANA-Job-Controller image](https://hub.docker.com/repository/docker/reanahub/reana-job-controller) to use | `reanahub/reana-job-controller:` | | `components.reana_message_broker.image` | [REANA-Meessage-Broker image](https://hub.docker.com/repository/docker/reanahub/reana-message-broker) to use | `reanahub/reana-message-broker:` | | `components.reana_message_broker.imagePullPolicy` | REANA-Message-Broker image pull policy | IfNotPresent | @@ -33,6 +33,14 @@ This Helm automatically prefixes all names using the release name to avoid colli | `ingress.annotations.kubernetes.io/ingress.class` | Type of ingress controller | traefik | | `ingress.annotations.traefik.frontend.entryPoints` | Entrypoints allowed by the ingress controller | "http,https" | | `ingress.enabled` | Create an ingress resource to access the REANA instance from outside the cluster | true | +| `notifications.email_config.login` | Password for the sender email address | None | +| `notifications.email_config.password` | Login email address | None | +| `notifications.email_config.receiver` | Email address which will be receiving the notifications | None | +| `notifications.email_config.sender` | Email address which will be sending the notifications | None | +| `notifications.email_config.smtp_server` | SMTP email server host | None | +| `notifications.email_config.smtp_port` | SMTP email server port | None | +| `notifications.enabled` | Enable REANA system events notifications | false | +| `notifications.system_status` | Cronjob pattern representing how often the system status notification should be sent. Leave it empty to deactivate it | "0 0 * * *" | | `secrets.cern.sso.CERN_CONSUMER_KEY` | CERN SSO consumer key | None | | `secrets.cern.sso.CERN_CONSUMER_SECRET` | **[Do not use in production, use secrets instead]** CERN SSO consumer secret | None | | `secrets.database.pasword` | **[Do not use in production, use secrets instead]** PostgreSQL database password | None | diff --git a/helm/reana/templates/cronjobs.yaml b/helm/reana/templates/cronjobs.yaml new file mode 100644 index 00000000..5adee7ef --- /dev/null +++ b/helm/reana/templates/cronjobs.yaml @@ -0,0 +1,39 @@ +{{- if .Values.notifications.enabled }} +{{- if .Values.notifications.system_status }} +apiVersion: batch/v1beta1 +kind: CronJob +metadata: + name: {{ include "reana.prefix" . }}-system-status +spec: + schedule: {{ .Values.notifications.system_status }} + jobTemplate: + spec: + template: + spec: + containers: + - name: {{ include "reana.prefix" . }}-system-status + image: {{ .Values.components.reana_server.image }} + args: + - /bin/sh + - -c + - flask reana-admin status-report --email {{ Values.notifications.email_config.receiver }} + env: + - name: REANA_SMTP_SERVER + value: {{ .Values.notifications.email_config.smtp_server }} + - name: REANA_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: + 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 + restartPolicy: Never +{{- end }} +{{- end }} diff --git a/helm/reana/templates/secrets.yaml b/helm/reana/templates/secrets.yaml index 44c89896..134a1c3a 100644 --- a/helm/reana/templates/secrets.yaml +++ b/helm/reana/templates/secrets.yaml @@ -32,3 +32,16 @@ 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 }} +--- +apiVersion: v1 +kind: Secret +metadata: + name: {{ include "reana.prefix" . }}-mail-notification-sender-password + annotations: + "helm.sh/resource-policy": keep +type: Opaque +data: + REANA_EMAIL_LOGIN: {{ .Values.notifications.email_config.login | b64enc }} + REANA_EMAIL_PASSWORD: {{ .Values.notifications.email_config.password | b64enc }} +{{- end }} diff --git a/helm/reana/values.yaml b/helm/reana/values.yaml index 8b1eccfb..ac1123de 100644 --- a/helm/reana/values.yaml +++ b/helm/reana/values.yaml @@ -78,6 +78,11 @@ components: imagePullPolicy: IfNotPresent image: reanahub/reana-ui:0.6.0-48-gbe42a5d +notifications: + enabled: false + email_config: {} + system_status: "0 0 * * *" + # Accessing the cluster from outside world ingress: enabled: true