From 0d4fcaa08eafe3483e9abd54c52069f6f68dca46 Mon Sep 17 00:00:00 2001 From: Adam <41971533+jcadam14@users.noreply.github.com> Date: Tue, 13 Feb 2024 17:09:25 -0500 Subject: [PATCH 1/3] Adding mailpit charts --- mailpit_chart/Chart.yaml | 7 ++++ mailpit_chart/templates/deployment.yaml | 54 +++++++++++++++++++++++++ mailpit_chart/templates/mapping.yml | 13 ++++++ mailpit_chart/templates/service.yaml | 20 +++++++++ mailpit_chart/values.yaml | 5 +++ 5 files changed, 99 insertions(+) create mode 100644 mailpit_chart/Chart.yaml create mode 100644 mailpit_chart/templates/deployment.yaml create mode 100644 mailpit_chart/templates/mapping.yml create mode 100644 mailpit_chart/templates/service.yaml create mode 100644 mailpit_chart/values.yaml diff --git a/mailpit_chart/Chart.yaml b/mailpit_chart/Chart.yaml new file mode 100644 index 0000000..ca1c1b4 --- /dev/null +++ b/mailpit_chart/Chart.yaml @@ -0,0 +1,7 @@ +apiVersion: v2 +name: mailpit +description: A simple Helm Chart for mailpit + +type: application + +version: 0.1.0 diff --git a/mailpit_chart/templates/deployment.yaml b/mailpit_chart/templates/deployment.yaml new file mode 100644 index 0000000..7fe8750 --- /dev/null +++ b/mailpit_chart/templates/deployment.yaml @@ -0,0 +1,54 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: mailpit + namespace: regtech + labels: + mailing.app: mailpit +spec: + replicas: 1 + selector: + matchLabels: + mailing.app: mailpit + template: + metadata: + labels: + mailing.app: mailpit + spec: + serviceAccountName: secrets-csi-sa + volumes: + - name: mailing-api-secrets + csi: + driver: secrets-store.csi.k8s.io + readOnly: true + volumeAttributes: + secretProviderClass: regtech-provider + containers: + - name: mailpit + image: "axllent/mailpit" + imagePullPolicy: Always + volumeMounts: + - name: mailing-api-secrets + mountPath: "/mnt/secrets-store" + readOnly: true + env: + - name: MP_SMTP_AUTH_ACCEPT_ANY + value: "0" + - name: MP_SMTP_AUTH_ALLOW_INSECURE + value: "1" + - name: MP_SMTP_AUTH + value: "$(SMTP_USERNAME):$(SMTP_PASSWORD)" + - name: SMTP_USERNAME + valueFrom: + secretKeyRef: + name: mailing-api-secrets + key: SMTP_USERNAME + - name: SMTP_PASSWORD + valueFrom: + secretKeyRef: + name: mailing-api-secrets + key: SMTP_PASSWORD + ports: + - containerPort: 8025 + - containerPort: 1025 + resources: {} \ No newline at end of file diff --git a/mailpit_chart/templates/mapping.yml b/mailpit_chart/templates/mapping.yml new file mode 100644 index 0000000..77441a8 --- /dev/null +++ b/mailpit_chart/templates/mapping.yml @@ -0,0 +1,13 @@ +{{- if .Values.mapping.enabled }} +apiVersion: getambassador.io/v2 +kind: Mapping +metadata: + name: mailpit + namespace: regtech +spec: + ambassador_id: + --apiVersion-v3alpha1-only--default + host: {{ .Values.mapping.host }} + prefix: {{ .Values.mapping.prefix }} + service: mailpit +{{- end }} \ No newline at end of file diff --git a/mailpit_chart/templates/service.yaml b/mailpit_chart/templates/service.yaml new file mode 100644 index 0000000..6a17918 --- /dev/null +++ b/mailpit_chart/templates/service.yaml @@ -0,0 +1,20 @@ +apiVersion: v1 +kind: Service +metadata: + name: mailpit + namespace: regtech + labels: + mailing.app: mailpit +spec: + type: ClusterIP + ports: + - port: 80 + targetPort: 8025 + protocol: TCP + name: http + - port: 1025 + targetPort: 1025 + protocol: TCP + name: smpt-port + selector: + mailing.app: mailpit diff --git a/mailpit_chart/values.yaml b/mailpit_chart/values.yaml new file mode 100644 index 0000000..0febc3c --- /dev/null +++ b/mailpit_chart/values.yaml @@ -0,0 +1,5 @@ +mapping: + enabled: true + host: mailpit-devpub-cd-eval.dev-public.aws.cfpb.gov + prefix: / + From 56bf30bab124b28fb9ca005464f5b19871c4bfa9 Mon Sep 17 00:00:00 2001 From: Adam <41971533+jcadam14@users.noreply.github.com> Date: Tue, 13 Feb 2024 19:10:11 -0500 Subject: [PATCH 2/3] Added charts for mailpit, update for using SecretStr with login --- mailpit_chart/templates/deployment.yaml | 4 ++-- mailpit_chart/values.yaml | 2 +- regtech_mail_api/api.py | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/mailpit_chart/templates/deployment.yaml b/mailpit_chart/templates/deployment.yaml index 7fe8750..a590227 100644 --- a/mailpit_chart/templates/deployment.yaml +++ b/mailpit_chart/templates/deployment.yaml @@ -36,8 +36,6 @@ spec: value: "0" - name: MP_SMTP_AUTH_ALLOW_INSECURE value: "1" - - name: MP_SMTP_AUTH - value: "$(SMTP_USERNAME):$(SMTP_PASSWORD)" - name: SMTP_USERNAME valueFrom: secretKeyRef: @@ -48,6 +46,8 @@ spec: secretKeyRef: name: mailing-api-secrets key: SMTP_PASSWORD + - name: MP_SMTP_AUTH + value: "$(SMTP_USERNAME):$(SMTP_PASSWORD)" ports: - containerPort: 8025 - containerPort: 1025 diff --git a/mailpit_chart/values.yaml b/mailpit_chart/values.yaml index 0febc3c..1067488 100644 --- a/mailpit_chart/values.yaml +++ b/mailpit_chart/values.yaml @@ -1,5 +1,5 @@ mapping: enabled: true - host: mailpit-devpub-cd-eval.dev-public.aws.cfpb.gov + host: mailpit-eks.dev-public.aws.cfpb.gov prefix: / diff --git a/regtech_mail_api/api.py b/regtech_mail_api/api.py index 31f6221..d769c4e 100644 --- a/regtech_mail_api/api.py +++ b/regtech_mail_api/api.py @@ -43,8 +43,8 @@ mailer = SmtpMailer( settings.smtp_host, # type: ignore settings.smtp_port, - settings.smtp_username, # type: ignore - settings.smtp_password, # type: ignore + settings.smtp_username.get_secret_value(), # type: ignore + settings.smtp_password.get_secret_value(), # type: ignore settings.smtp_use_tls, ) case EmailMailerType.MOCK: From e7e5a3448ed311b7d743232b0bcdc75b89ad8e09 Mon Sep 17 00:00:00 2001 From: Adam <41971533+jcadam14@users.noreply.github.com> Date: Fri, 23 Feb 2024 12:17:21 -0500 Subject: [PATCH 3/3] Removed values.yaml and put in EKS repo --- mailpit_chart/values.yaml | 5 ----- 1 file changed, 5 deletions(-) delete mode 100644 mailpit_chart/values.yaml diff --git a/mailpit_chart/values.yaml b/mailpit_chart/values.yaml deleted file mode 100644 index 1067488..0000000 --- a/mailpit_chart/values.yaml +++ /dev/null @@ -1,5 +0,0 @@ -mapping: - enabled: true - host: mailpit-eks.dev-public.aws.cfpb.gov - prefix: / -