From 6e0b7c86e17fff78464aef34726c091b645cb8c9 Mon Sep 17 00:00:00 2001 From: roschaefer Date: Wed, 18 Sep 2019 01:19:50 +0200 Subject: [PATCH] Conditionally deploy mailserver --- .../human-connection/templates/configmap.yml | 5 +++ .../templates/deployment-mailserver.yaml | 34 +++++++++++++++++++ .../templates/service-mailserver.yaml | 16 +++++++++ deployment/helm/human-connection/values.yaml | 1 + 4 files changed, 56 insertions(+) create mode 100644 deployment/helm/human-connection/templates/deployment-mailserver.yaml create mode 100644 deployment/helm/human-connection/templates/service-mailserver.yaml diff --git a/deployment/helm/human-connection/templates/configmap.yml b/deployment/helm/human-connection/templates/configmap.yml index dec2c2bac..4c57a7e94 100644 --- a/deployment/helm/human-connection/templates/configmap.yml +++ b/deployment/helm/human-connection/templates/configmap.yml @@ -10,5 +10,10 @@ data: SENTRY_DSN_WEBAPP: {{ .Values.sentryDsnWebapp }} SENTRY_DSN_BACKEND: {{ .Values.sentryDsnBackend }} COMMIT: {{ .Values.commit }} +{{- if .Values.developmentMailserverDomain }} + SMTP_HOST: {{ .Release.Name }}-mailserver + SMTP_PORT: "25" +{{- else }} SMTP_HOST: {{ .Values.smtpHost }} SMTP_PORT: {{ .Values.smtpPort }} +{{- end }} diff --git a/deployment/helm/human-connection/templates/deployment-mailserver.yaml b/deployment/helm/human-connection/templates/deployment-mailserver.yaml new file mode 100644 index 000000000..685cabea0 --- /dev/null +++ b/deployment/helm/human-connection/templates/deployment-mailserver.yaml @@ -0,0 +1,34 @@ +{{- if .Values.developmentMailserverDomain }} +apiVersion: extensions/v1beta1 +kind: Deployment +metadata: + name: {{ .Release.Name }}-mailserver +spec: + replicas: 1 + minReadySeconds: 15 + progressDeadlineSeconds: 60 + selector: + matchLabels: + human-connection.org/selector: deployment-mailserver + template: + metadata: + labels: + human-connection.org/selector: deployment-mailserver + name: mailserver + spec: + containers: + - name: mailserver + image: djfarrelly/maildev + imagePullPolicy: {{ .Values.pullPolicy }} + ports: + - containerPort: 80 + - containerPort: 25 + envFrom: + - configMapRef: + name: {{ .Release.Name }}-configmap + - secretRef: + name: {{ .Release.Name }}-secrets + restartPolicy: Always + terminationGracePeriodSeconds: 30 +status: {} +{{- end}} diff --git a/deployment/helm/human-connection/templates/service-mailserver.yaml b/deployment/helm/human-connection/templates/service-mailserver.yaml new file mode 100644 index 000000000..e5e22aa37 --- /dev/null +++ b/deployment/helm/human-connection/templates/service-mailserver.yaml @@ -0,0 +1,16 @@ +{{- if .Values.developmentMailserverDomain }} +apiVersion: v1 +kind: Service +metadata: + name: {{ .Release.Name }}-mailserver +spec: + ports: + - name: web + port: 80 + targetPort: 80 + - name: smtp + port: 25 + targetPort: 25 + selector: + human-connection.org/selector: deployment-mailserver +{{- end}} diff --git a/deployment/helm/human-connection/values.yaml b/deployment/helm/human-connection/values.yaml index 77d799861..6db2f87fd 100644 --- a/deployment/helm/human-connection/values.yaml +++ b/deployment/helm/human-connection/values.yaml @@ -3,6 +3,7 @@ commit: 889a7cdd24dda04a139b2b77d626e984d6db6781 pullPolicy: Always # configs +developmentMailserverDomain: "nitro-mailserver.human-connection.org" smtpHost: "mailserver.human-connection" smtpPort: "25" smtpUsername: