From 1e7978d49a5b477ba4a00bd7ecda08143df27c35 Mon Sep 17 00:00:00 2001 From: DrPsychick Date: Fri, 30 May 2025 01:11:47 +0200 Subject: [PATCH 1/4] fix!: support dynamic NodePorts by making ports optional/removing default --- charts/mailu/README.md | 17 ++++----- charts/mailu/ci/helm-lint-values.yaml | 6 ++-- .../templates/front/service-external.yaml | 16 ++++----- charts/mailu/values.yaml | 35 ++++++++++--------- 4 files changed, 38 insertions(+), 36 deletions(-) diff --git a/charts/mailu/README.md b/charts/mailu/README.md index c73b68ce..cf248fce 100644 --- a/charts/mailu/README.md +++ b/charts/mailu/README.md @@ -331,14 +331,15 @@ Check that the deployed pods are all running. | `front.externalService.ports.smtps` | Expose SMTP port (TLS) - 465/tcp | `true` | | `front.externalService.ports.submission` | Expose Submission port - 587/tcp | `false` | | `front.externalService.ports.manageSieve` | Expose ManageSieve port - 4190/tcp | `true` | -| `front.externalService.nodePorts.pop3` | NodePort to use for POP3 (defaults to 110/tcp) | `110` | -| `front.externalService.nodePorts.pop3s` | NodePort to use for POP3 (TLS) (defaults to 995/tcp) | `995` | -| `front.externalService.nodePorts.imap` | NodePort to use for IMAP (defaults to 143/tcp) | `143` | -| `front.externalService.nodePorts.imaps` | NodePort to use for IMAP (TLS) (defaults to 993/tcp) | `993` | -| `front.externalService.nodePorts.smtp` | NodePort to use for SMTP (defaults to 25/tcp) | `25` | -| `front.externalService.nodePorts.smtps` | NodePort to use for SMTP (TLS) (defaults to 465/tcp) | `465` | -| `front.externalService.nodePorts.submission` | NodePort to use for Submission (defaults to 587/tcp) | `587` | -| `front.externalService.nodePorts.manageSieve` | NodePort to use for ManageSieve (defaults to 4190/tcp) | `4190` | +| `front.externalService.nodePorts` | Optionally define NodePorts. | `{}` | +| `front.externalService.nodePorts.pop3` | NodePort to use for POP3 | `undefined` | +| `front.externalService.nodePorts.pop3s` | NodePort to use for POP3 (TLS) | `undefined` | +| `front.externalService.nodePorts.imap` | NodePort to use for IMAP | `undefined` | +| `front.externalService.nodePorts.imaps` | NodePort to use for IMAP (TLS) | `undefined` | +| `front.externalService.nodePorts.smtp` | NodePort to use for SMTP | `undefined` | +| `front.externalService.nodePorts.smtps` | NodePort to use for SMTP (TLS) | `undefined` | +| `front.externalService.nodePorts.submission` | NodePort to use for Submission | `undefined` | +| `front.externalService.nodePorts.manageSieve` | NodePort to use for ManageSieve | `undefined` | | `front.kind` | Kind of resource to create for the front (`Deployment` or `DaemonSet`) | `Deployment` | | `front.replicaCount` | Number of front replicas to deploy (only for `Deployment` kind) | `1` | | `front.resources.limits` | The resources limits for the container | `{}` | diff --git a/charts/mailu/ci/helm-lint-values.yaml b/charts/mailu/ci/helm-lint-values.yaml index b886efcf..46db2a28 100644 --- a/charts/mailu/ci/helm-lint-values.yaml +++ b/charts/mailu/ci/helm-lint-values.yaml @@ -1,12 +1,12 @@ hostnames: - - example.com + - mailu.cluster.local -domain: example.com +domain: mailu.cluster.local initialAccount: enabled: true username: mailadmin - domain: example.com + domain: mailu.cluster.local password: chang3m3! secretKey: chang3m3! diff --git a/charts/mailu/templates/front/service-external.yaml b/charts/mailu/templates/front/service-external.yaml index 50a1afae..cbe7eede 100644 --- a/charts/mailu/templates/front/service-external.yaml +++ b/charts/mailu/templates/front/service-external.yaml @@ -27,7 +27,7 @@ spec: - name: pop3 port: 110 protocol: TCP - {{ if eq $.Values.front.externalService.type "NodePort" -}} + {{- if and (eq $.Values.front.externalService.type "NodePort") .nodePorts.pop3 }} nodePort: {{ .nodePorts.pop3 }} {{- end }} {{- end }} @@ -35,7 +35,7 @@ spec: - name: pop3s port: 995 protocol: TCP - {{ if eq $.Values.front.externalService.type "NodePort" -}} + {{- if and (eq $.Values.front.externalService.type "NodePort") .nodePorts.pop3s }} nodePort: {{ .nodePorts.pop3s }} {{- end }} {{- end }} @@ -43,7 +43,7 @@ spec: - name: imap port: 143 protocol: TCP - {{ if eq $.Values.front.externalService.type "NodePort" -}} + {{- if and (eq $.Values.front.externalService.type "NodePort") .nodePorts.imap }} nodePort: {{ .nodePorts.imap }} {{- end }} {{- end }} @@ -51,7 +51,7 @@ spec: - name: imaps port: 993 protocol: TCP - {{ if eq $.Values.front.externalService.type "NodePort" -}} + {{- if and (eq $.Values.front.externalService.type "NodePort") .nodePorts.imaps }} nodePort: {{ .nodePorts.imaps }} {{- end }} {{- end }} @@ -59,7 +59,7 @@ spec: - name: smtp port: 25 protocol: TCP - {{ if eq $.Values.front.externalService.type "NodePort" -}} + {{- if and (eq $.Values.front.externalService.type "NodePort") .nodePorts.smtp }} nodePort: {{ .nodePorts.smtp }} {{- end }} {{- end }} @@ -67,7 +67,7 @@ spec: - name: smtps port: 465 protocol: TCP - {{ if eq $.Values.front.externalService.type "NodePort" -}} + {{- if and (eq $.Values.front.externalService.type "NodePort") .nodePorts.smtps }} nodePort: {{ .nodePorts.smtps }} {{- end }} {{- end }} @@ -75,7 +75,7 @@ spec: - name: smtpd port: 587 protocol: TCP - {{ if eq $.Values.front.externalService.type "NodePort" -}} + {{- if and (eq $.Values.front.externalService.type "NodePort") .nodePorts.submission }} nodePort: {{ .nodePorts.submission }} {{- end }} {{- end }} @@ -83,7 +83,7 @@ spec: - name: sieve port: 4190 protocol: TCP - {{ if eq $.Values.front.externalService.type "NodePort" -}} + {{- if and (eq $.Values.front.externalService.type "NodePort") .nodePorts.manageSieve }} nodePort: {{ .nodePorts.manageSieve }} {{- end }} {{- end }} diff --git a/charts/mailu/values.yaml b/charts/mailu/values.yaml index 4197b9cc..476ca93e 100644 --- a/charts/mailu/values.yaml +++ b/charts/mailu/values.yaml @@ -715,14 +715,15 @@ front: ## @param front.externalService.ports.smtps Expose SMTP port (TLS) - 465/tcp ## @param front.externalService.ports.submission Expose Submission port - 587/tcp ## @param front.externalService.ports.manageSieve Expose ManageSieve port - 4190/tcp - ## @param front.externalService.nodePorts.pop3 NodePort to use for POP3 (defaults to 110/tcp) - ## @param front.externalService.nodePorts.pop3s NodePort to use for POP3 (TLS) (defaults to 995/tcp) - ## @param front.externalService.nodePorts.imap NodePort to use for IMAP (defaults to 143/tcp) - ## @param front.externalService.nodePorts.imaps NodePort to use for IMAP (TLS) (defaults to 993/tcp) - ## @param front.externalService.nodePorts.smtp NodePort to use for SMTP (defaults to 25/tcp) - ## @param front.externalService.nodePorts.smtps NodePort to use for SMTP (TLS) (defaults to 465/tcp) - ## @param front.externalService.nodePorts.submission NodePort to use for Submission (defaults to 587/tcp) - ## @param front.externalService.nodePorts.manageSieve NodePort to use for ManageSieve (defaults to 4190/tcp) + ## @param front.externalService.nodePorts [nullable] Optionally define NodePorts. + ## @param front.externalService.nodePorts.pop3 [nullable] NodePort to use for POP3 + ## @param front.externalService.nodePorts.pop3s [nullable] NodePort to use for POP3 (TLS) + ## @param front.externalService.nodePorts.imap [nullable] NodePort to use for IMAP + ## @param front.externalService.nodePorts.imaps [nullable] NodePort to use for IMAP (TLS) + ## @param front.externalService.nodePorts.smtp [nullable] NodePort to use for SMTP + ## @param front.externalService.nodePorts.smtps [nullable] NodePort to use for SMTP (TLS) + ## @param front.externalService.nodePorts.submission [nullable] NodePort to use for Submission + ## @param front.externalService.nodePorts.manageSieve [nullable] NodePort to use for ManageSieve externalService: enabled: false type: ClusterIP @@ -740,15 +741,15 @@ front: smtps: true submission: false manageSieve: true - nodePorts: - pop3: 110 - pop3s: 995 - imap: 143 - imaps: 993 - smtp: 25 - smtps: 465 - submission: 587 - manageSieve: 4190 + nodePorts: {} + # pop3: 110 + # pop3s: 995 + # imap: 143 + # imaps: 993 + # smtp: 25 + # smtps: 465 + # submission: 587 + # manageSieve: 4190 ## @param front.kind Kind of resource to create for the front (`Deployment` or `DaemonSet`) kind: Deployment From a87a2f2d85a7bfd897c2c21199f47d9ab2d22655 Mon Sep 17 00:00:00 2001 From: DrPsychick Date: Sun, 31 Aug 2025 19:04:22 +0200 Subject: [PATCH 2/4] fix: front.externalService.nodePorts is nullable object --- charts/mailu/README.md | 1 - charts/mailu/values.yaml | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/charts/mailu/README.md b/charts/mailu/README.md index cf248fce..73e28e3d 100644 --- a/charts/mailu/README.md +++ b/charts/mailu/README.md @@ -1018,7 +1018,6 @@ Check that the deployed pods are all running. | `tika.extraVolumes` | Optionally specify extra list of additional volumes for the pod(s) | `[]` | | `tika.extraContainers` | Add additional containers to the pod | `[]` | - ## Example values.yaml to get started ```yaml diff --git a/charts/mailu/values.yaml b/charts/mailu/values.yaml index 476ca93e..5e1a2d0c 100644 --- a/charts/mailu/values.yaml +++ b/charts/mailu/values.yaml @@ -715,7 +715,7 @@ front: ## @param front.externalService.ports.smtps Expose SMTP port (TLS) - 465/tcp ## @param front.externalService.ports.submission Expose Submission port - 587/tcp ## @param front.externalService.ports.manageSieve Expose ManageSieve port - 4190/tcp - ## @param front.externalService.nodePorts [nullable] Optionally define NodePorts. + ## @param front.externalService.nodePorts [object,nullable] Optionally define NodePorts. ## @param front.externalService.nodePorts.pop3 [nullable] NodePort to use for POP3 ## @param front.externalService.nodePorts.pop3s [nullable] NodePort to use for POP3 (TLS) ## @param front.externalService.nodePorts.imap [nullable] NodePort to use for IMAP From 58b1a95d25d53690a14d3de9c02a43fa76dd18e6 Mon Sep 17 00:00:00 2001 From: DrPsychick Date: Sun, 31 Aug 2025 21:05:16 +0200 Subject: [PATCH 3/4] fix: use pre-commit (readme-generator) in workflow to use same version --- .github/workflows/lint-and-test.yaml | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/.github/workflows/lint-and-test.yaml b/.github/workflows/lint-and-test.yaml index 02c04af0..d0d779af 100644 --- a/.github/workflows/lint-and-test.yaml +++ b/.github/workflows/lint-and-test.yaml @@ -81,18 +81,16 @@ jobs: runs-on: ubuntu-latest needs: lint-and-test steps: - - name: Install readme-generator-for-helm - run: npm install -g @bitnami/readme-generator-for-helm - - name: Checkout mailu/helm-charts uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5 with: fetch-depth: 0 - - name: Execute readme-generator-for-helm + - name: Execute pre-commit hook readme-generator-for-helm run: | + pip install pre-commit echo "Updating README.md for mailu chart" - readme-generator --values "charts/mailu/values.yaml" --readme "charts/mailu/README.md" --schema "/tmp/schema.json" + pre-commit run git diff --exit-code --name-status charts/mailu/README.md || { echo "README update is missing. This should have been prevented by pre-commit hook." exit 1 From a87082cda3929953c2dc53697058c258ed4b4689 Mon Sep 17 00:00:00 2001 From: DrPsychick Date: Sun, 31 Aug 2025 21:33:55 +0200 Subject: [PATCH 4/4] fix: pre-commit show-diff-on-failure --- .github/workflows/lint-and-test.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/lint-and-test.yaml b/.github/workflows/lint-and-test.yaml index d0d779af..97853c33 100644 --- a/.github/workflows/lint-and-test.yaml +++ b/.github/workflows/lint-and-test.yaml @@ -90,7 +90,7 @@ jobs: run: | pip install pre-commit echo "Updating README.md for mailu chart" - pre-commit run + pre-commit run --show-diff-on-failure git diff --exit-code --name-status charts/mailu/README.md || { echo "README update is missing. This should have been prevented by pre-commit hook." exit 1