From 499fe11965e23ce710a028c920f2ef3fea59c7f3 Mon Sep 17 00:00:00 2001 From: jcadam14 <41971533+jcadam14@users.noreply.github.com> Date: Fri, 23 Feb 2024 11:40:43 -0700 Subject: [PATCH 1/3] Changed allow_headers to * (#21) --- regtech_mail_api/api.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/regtech_mail_api/api.py b/regtech_mail_api/api.py index 9a21b7f..c71e5ac 100644 --- a/regtech_mail_api/api.py +++ b/regtech_mail_api/api.py @@ -29,7 +29,7 @@ "*" ], # thinking this should be derived from an env var from docker-compose or helm values allow_methods=["GET", "POST"], - allow_headers=["authorization"], + allow_headers=["*"], ) From 513f7b773bd07510e7ae5b112060129bfe4d2f13 Mon Sep 17 00:00:00 2001 From: jcadam14 <41971533+jcadam14@users.noreply.github.com> Date: Mon, 26 Feb 2024 07:58:28 -0700 Subject: [PATCH 2/3] 5 create helm charts for regtech mail api and mailpit (#13) * Adding mailpit charts * Added charts for mailpit, update for using SecretStr with login * Removed values.yaml and put in EKS repo --- mailpit_chart/Chart.yaml | 7 ++++ mailpit_chart/templates/deployment.yaml | 54 +++++++++++++++++++++++++ mailpit_chart/templates/mapping.yml | 13 ++++++ mailpit_chart/templates/service.yaml | 20 +++++++++ 4 files changed, 94 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 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..a590227 --- /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: SMTP_USERNAME + valueFrom: + secretKeyRef: + name: mailing-api-secrets + key: SMTP_USERNAME + - name: SMTP_PASSWORD + valueFrom: + secretKeyRef: + name: mailing-api-secrets + key: SMTP_PASSWORD + - name: MP_SMTP_AUTH + value: "$(SMTP_USERNAME):$(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 From bb610d6fc045ec6da8b11ed381df6c6d1506a2ac Mon Sep 17 00:00:00 2001 From: jcadam14 <41971533+jcadam14@users.noreply.github.com> Date: Mon, 26 Feb 2024 07:59:03 -0700 Subject: [PATCH 3/3] Fixed SmtpMailer to check for username and password (#23) --- regtech_mail_api/api.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/regtech_mail_api/api.py b/regtech_mail_api/api.py index c71e5ac..a2aedaf 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.get_secret_value(), # type: ignore - settings.smtp_password.get_secret_value(), # type: ignore + settings.smtp_username.get_secret_value() if settings.smtp_username else None, # type: ignore + settings.smtp_password.get_secret_value() if settings.smtp_password else None, # type: ignore settings.smtp_use_tls, ) case EmailMailerType.MOCK: