diff --git a/helm/oncall/templates/_env.tpl b/helm/oncall/templates/_env.tpl index f6f13471..25072fc1 100644 --- a/helm/oncall/templates/_env.tpl +++ b/helm/oncall/templates/_env.tpl @@ -229,3 +229,28 @@ name: {{ template "snippet.redis.password.secret.name" . }} key: redis-password {{- end }} + +{{- define "snippet.oncall.smtp.env" -}} +{{- if .Values.oncall.smtp.enabled -}} +- name: FEATURE_EMAIL_INTEGRATION_ENABLED + value: {{ .Values.oncall.smtp.enabled | toString | title | quote }} +- name: EMAIL_HOST + value: {{ .Values.oncall.smtp.host | quote }} +- name: EMAIL_PORT + value: {{ .Values.oncall.smtp.port | default "587" | quote }} +- name: EMAIL_HOST_USER + value: {{ .Values.oncall.smtp.username | quote }} +- name: EMAIL_HOST_PASSWORD + valueFrom: + secretKeyRef: + name: {{ include "oncall.fullname" . }}-smtp + key: smtp-password +- name: EMAIL_USE_TLS + value: {{ .Values.oncall.smtp.tls | toString | title | quote }} +- name: DEFAULT_FROM_EMAIL + value: {{ .Values.oncall.smtp.fromEmail | quote }} +{{- else -}} +- name: FEATURE_EMAIL_INTEGRATION_ENABLED + value: {{ .Values.oncall.smtp.enabled | toString | title | quote }} +{{- end -}} +{{- end }} diff --git a/helm/oncall/templates/celery/_deployment.tpl b/helm/oncall/templates/celery/_deployment.tpl index 5378c834..0892c0cb 100644 --- a/helm/oncall/templates/celery/_deployment.tpl +++ b/helm/oncall/templates/celery/_deployment.tpl @@ -41,6 +41,7 @@ spec: {{- include "snippet.oncall.env" . | nindent 12 }} {{- include "snippet.oncall.slack.env" . | nindent 12 }} {{- include "snippet.oncall.telegram.env" . | nindent 12 }} + {{- include "snippet.oncall.smtp.env" . | nindent 12 }} {{- include "snippet.mysql.env" . | nindent 12 }} {{- include "snippet.rabbitmq.env" . | nindent 12 }} {{- include "snippet.redis.env" . | nindent 12 }} diff --git a/helm/oncall/templates/engine/deployment.yaml b/helm/oncall/templates/engine/deployment.yaml index 216d3055..5b1f7776 100644 --- a/helm/oncall/templates/engine/deployment.yaml +++ b/helm/oncall/templates/engine/deployment.yaml @@ -47,6 +47,7 @@ spec: {{- include "snippet.oncall.env" . | nindent 12 }} {{- include "snippet.oncall.slack.env" . | nindent 12 }} {{- include "snippet.oncall.telegram.env" . | nindent 12 }} + {{- include "snippet.oncall.smtp.env" . | nindent 12 }} {{- include "snippet.mysql.env" . | nindent 12 }} {{- include "snippet.rabbitmq.env" . | nindent 12 }} {{- include "snippet.redis.env" . | nindent 12 }} diff --git a/helm/oncall/templates/engine/job-migrate.yaml b/helm/oncall/templates/engine/job-migrate.yaml index 5bfc3019..8778f420 100644 --- a/helm/oncall/templates/engine/job-migrate.yaml +++ b/helm/oncall/templates/engine/job-migrate.yaml @@ -43,6 +43,7 @@ spec: python manage.py migrate env: {{- include "snippet.oncall.env" . | nindent 12 }} + {{- include "snippet.oncall.smtp.env" . | nindent 12 }} {{- include "snippet.mysql.env" . | nindent 12 }} {{- include "snippet.rabbitmq.env" . | nindent 12 }} {{- include "snippet.redis.env" . | nindent 12 }} diff --git a/helm/oncall/templates/secrets.yaml b/helm/oncall/templates/secrets.yaml index 88b4eaed..64d1e22c 100644 --- a/helm/oncall/templates/secrets.yaml +++ b/helm/oncall/templates/secrets.yaml @@ -40,4 +40,13 @@ type: Opaque data: redis-password: {{ required "externalRedis.password is required if not redis.enabled" .Values.externalRedis.password | b64enc | quote }} {{- end }} - +--- +{{ if .Values.oncall.smtp.enabled -}} +apiVersion: v1 +kind: Secret +metadata: + name: {{ include "oncall.fullname" . }}-smtp +type: Opaque +data: + smtp-password: {{ required "oncall.smtp.password is required if oncall.smtp.enabled" .Values.oncall.smtp.password | b64enc | quote }} +{{- end }} diff --git a/helm/oncall/values.yaml b/helm/oncall/values.yaml index 4d1b6791..db665bd6 100644 --- a/helm/oncall/values.yaml +++ b/helm/oncall/values.yaml @@ -88,6 +88,14 @@ oncall: enabled: false token: ~ webhookUrl: ~ + smtp: + enabled: false + host: ~ + port: ~ + username: ~ + password: ~ + tls: ~ + fromEmail: ~ # Whether to run django database migrations automatically migrate: