From a2826da910738299cc9b8fb1927252669a56d7b2 Mon Sep 17 00:00:00 2001 From: Eric Meehan Date: Wed, 1 Apr 2026 09:53:03 -0400 Subject: [PATCH] Added Bitnami PostgreSQL sub chart --- mailman3/Chart.yaml | 13 +++++- mailman3/templates/core.yaml | 19 ++++++++- mailman3/templates/web.yaml | 17 +++++++- mailman3/values.yaml | 78 ++++++++++++++++++++++++++++++++++++ 4 files changed, 124 insertions(+), 3 deletions(-) diff --git a/mailman3/Chart.yaml b/mailman3/Chart.yaml index 0d520ed..64e5fd7 100644 --- a/mailman3/Chart.yaml +++ b/mailman3/Chart.yaml @@ -15,9 +15,20 @@ type: application # This is the chart version. This version number should be incremented each time you make changes # to the chart and its templates, including the app version. # Versions are expected to follow Semantic Versioning (https://semver.org/) -version: 0.0.2 +version: 1.0.4 # This is the version number of the application being deployed. This version number should be # incremented each time you make changes to the application. Versions are not expected to # follow Semantic Versioning. They should reflect the version the application is using. appVersion: 0.3.10 + +maintainers: + - name: Eric O'Neill Meehan + email: eric@eom.dev + +dependencies: + # https://github.com/bitnami/charts/blob/main/bitnami/postgresql + - name: postgresql + repository: oci://registry-1.docker.io/bitnamicharts + version: 16.7.27 + condition: postgresql.enabled diff --git a/mailman3/templates/core.yaml b/mailman3/templates/core.yaml index 2e90695..6456c21 100644 --- a/mailman3/templates/core.yaml +++ b/mailman3/templates/core.yaml @@ -47,12 +47,26 @@ spec: value: http://{{ include "mailman3.fullname" . }}-web.{{ .Release.Namespace }}.svc.{{ $clusterDomain }}/hyperkitty - name: MTA value: postfix + {{- if .Values.smtp }} + - name: SMTP_HOST + value: {{ .Values.smtp.host }} + - name: SMTP_PORT + value: {{ .Values.smtp.port }} + {{- else }} - name: SMTP_HOST value: {{ include "mailman3.fullname" . }}-core.{{ .Release.Namespace }}.svc.{{ $clusterDomain }} + {{- end }} + {{- if .Values.postgresql.enabled }} + - name: DATABASE_CLASS + value: mailman.database.postgresql.PostgreSQLDatabase + - name: DATABASE_URL + value: "postgresql://{{ .Values.postgresql.global.postgresql.auth.username }}:{{ .Values.postgresql.global.postgresql.auth.password }}@postgresql/mailman" + {{- else }} - name: DATABASE_CLASS value: mailman.database.sqlite.SQLiteDatabase - name: DATABASE_URL value: "sqlite:////opt/mailman/var/data/mailman.db" + {{- end }} ports: - name: api containerPort: 8001 @@ -76,6 +90,8 @@ spec: mountPath: /opt/mailman resources: {{- toYaml .Values.core.resources | nindent 12 }} + {{- if .Values.smtp }} + {{- else }} - name: postfix image: boky/postfix:latest env: @@ -118,6 +134,7 @@ spec: - name: core-data subPath: var/data mountPath: /mailman + {{- end }} {{- with .Values.core.nodeSelector }} nodeSelector: {{- toYaml . | nindent 8 }} @@ -158,4 +175,4 @@ spec: protocol: TCP selector: {{- include "mailman3.selectorLabels" . | nindent 4 }} - app.kubernetes.io/component: core \ No newline at end of file + app.kubernetes.io/component: core diff --git a/mailman3/templates/web.yaml b/mailman3/templates/web.yaml index d1ea1cd..f1c4252 100644 --- a/mailman3/templates/web.yaml +++ b/mailman3/templates/web.yaml @@ -51,17 +51,32 @@ spec: - name: SERVE_FROM_DOMAIN value: {{ .Values.hostname | quote }} {{- end }} + {{- if .Values.postgresql.enabled }} + - name: DATABASE_URL + value: "postgresql://{{ .Values.postgresql.global.postgresql.auth.username }}:{{ .Values.postgresql.global.postgresql.auth.password }}@postgresql/mailman" + - name: DATABASE_TYPE + value: postgresql + {{- else }} - name: DATABASE_URL value: sqlite://///opt/mailman-web-data/mailmanweb.db - name: DATABASE_TYPE value: sqlite + {{- end }} - name: MAILMAN_ADMIN_USER value: {{ .Values.admin.username }} - name: MAILMAN_ADMIN_EMAIL value: {{ .Values.admin.email }} {{- if .Values.smtp }} - name: SMTP_HOST - value: {{ .Values.smtp }} + value: {{ .Values.smtp.host }} + - name: SMTP_PORT + value: {{ .Values.smtp.port }} + - name: SMTP_HOST_USER + value: {{ .Values.smtp.host_user }} + - name: SMTP_HOST_PASSWORD + value: {{ .Values.smtp.host_password }} + - name: SMTP_USE_TLS + value: {{ .Values.smtp.use_tls }} {{- else }} - name: SMTP_HOST value: {{ include "mailman3.fullname" . }}-core.{{ .Release.Namespace }}.svc.{{ $clusterDomain }} diff --git a/mailman3/values.yaml b/mailman3/values.yaml index 00bc8a9..6b752c2 100644 --- a/mailman3/values.yaml +++ b/mailman3/values.yaml @@ -65,6 +65,13 @@ web: size: 100Gi accessMode: ReadWriteOnce +smtp: null +# host: mail.example.com +# port: 25 +# host_user: admin@example.com +# host_password: changeme +# use_tls: "true" + service: type: ClusterIP port: 80 @@ -82,3 +89,74 @@ ingress: # - secretName: chart-example-tls # hosts: # - git.example.com + +## @section PostgreSQL +# Taken from Gitea Helm chart +postgresql: + ## @param postgresql.enabled Enable PostgreSQL + enabled: false + + ## @param postgresql.global.postgresql.auth.password Password for the `mailman` user (overrides `auth.password`) + ## @param postgresql.global.postgresql.auth.database Name for a custom database to create (overrides `auth.database`) + ## @param postgresql.global.postgresql.auth.username Name for a custom user to create (overrides `auth.username`) + ## @param postgresql.global.postgresql.service.ports.postgresql PostgreSQL service port (overrides `service.ports.postgresql`) + global: + postgresql: + auth: + password: mailman + database: mailman + username: mailman + service: + ports: + postgresql: 5432 + + ## @param postgresql.image.repository Image repository, eg. `bitnamilegacy/postgresql`. + image: + repository: bitnamilegacy/postgresql + + primary: + ## @param postgresql.primary.persistence.enabled Enable persistence. + ## @param postgresql.primary.persistence.storageClass Persistent Volume storage class. + ## @param postgresql.primary.persistence.size PVC Storage Request for PostgreSQL volume. + persistence: + enabled: true + storageClass: "" + size: 10Gi + + readReplicas: + ## @param postgresql.readReplicas.persistence.enabled Enable PostgreSQL read only data persistence using PVC. + ## @param postgresql.readReplicas.persistence.storageClass Persistent Volume storage class. + ## @param postgresql.readReplicas.persistence.size PVC Storage Request for PostgreSQL volume. + persistence: + enabled: true + storageClass: "" + size: "" + + ## @param postgresql.metrics.image.repository Image repository, eg. `bitnamilegacy/postgres-exporter`. + metrics: + image: + repository: bitnamilegacy/postgres-exporter + + ## @param postgresql.volumePermissions.image.repository Image repository, eg. `bitnamilegacy/os-shell`. + volumePermissions: + image: + repository: bitnamilegacy/os-shell + +# By default, removed or moved settings that still remain in a user defined values.yaml will cause Helm to fail running the install/update. +# Set it to false to skip this basic validation check. +## @section Advanced +## @param checkDeprecation Set it to false to skip this basic validation check. +## @param test.enabled Set it to false to disable test-connection Pod. +## @param test.image.name Image name for the wget container used in the test-connection Pod. +## @param test.image.tag Image tag for the wget container used in the test-connection Pod. +checkDeprecation: true +test: + enabled: true + image: + name: busybox + tag: latest + +## @param extraDeploy Array of extra objects to deploy with the release +## +extraDeploy: [] +