From 80741b63a4d12eb5096e1515dbf8f3f752d5201a Mon Sep 17 00:00:00 2001 From: Sheogorath <sheogorath@shivering-isles.com> Date: Thu, 30 Jun 2022 02:24:36 +0200 Subject: [PATCH] fix(mok): Fix wrong variable usage in dovecot Due to a copy-paste mistake, dovecot was using the postfix replicaCount for its own. This is obviously not intended and was fixed by this commit, correcting the snapshot and adding obviously needed tests to prevent such a mistake in the future. --- charts/mok/Chart.yaml | 2 +- charts/mok/README.md | 2 +- charts/mok/templates/dovecot.yaml | 4 ++-- charts/mok/tests/__snapshot__/dovecot_test.yaml.snap | 2 +- charts/mok/tests/dovecot_test.yaml | 12 ++++++++++++ charts/mok/tests/postfix_test.yaml | 12 ++++++++++++ 6 files changed, 29 insertions(+), 5 deletions(-) diff --git a/charts/mok/Chart.yaml b/charts/mok/Chart.yaml index 8875c1ebe..643517e6f 100644 --- a/charts/mok/Chart.yaml +++ b/charts/mok/Chart.yaml @@ -3,7 +3,7 @@ name: mok description: | Mail on Kubernetes (MoK) is a project to deploy a functional mailserver that runs without a database server on Kubernetes, taking advantage of configmaps and secret. type: application -version: 0.4.1 +version: 0.4.2 sources: - https://de.postfix.org/ftpmirror/index.html - https://github.com/dovecot/core diff --git a/charts/mok/README.md b/charts/mok/README.md index 7cc0626f7..07d2a8ac8 100644 --- a/charts/mok/README.md +++ b/charts/mok/README.md @@ -1,6 +1,6 @@ # mok -  +  Mail on Kubernetes (MoK) is a project to deploy a functional mailserver that runs without a database server on Kubernetes, taking advantage of configmaps and secret. diff --git a/charts/mok/templates/dovecot.yaml b/charts/mok/templates/dovecot.yaml index d15829c11..95d55ff2d 100644 --- a/charts/mok/templates/dovecot.yaml +++ b/charts/mok/templates/dovecot.yaml @@ -61,7 +61,7 @@ spec: matchLabels: {{- include "mok.selectorLabels" . | nindent 6 }} app.kubernetes.io/component: dovecot - replicas: {{ .Values.postfix.replicaCount }} + replicas: {{ .Values.dovecot.replicaCount }} strategy: type: Recreate template: @@ -138,4 +138,4 @@ spec: secretName: {{ include "mok.fullname" . }}-dovecot-users - name: tls secret: - secretName: {{ required "TLS secret for dovecot is required" .Values.postfix.tls.secretName }} + secretName: {{ required "TLS secret for dovecot is required" .Values.dovecot.tls.secretName }} diff --git a/charts/mok/tests/__snapshot__/dovecot_test.yaml.snap b/charts/mok/tests/__snapshot__/dovecot_test.yaml.snap index 2147e19a5..09955b9bf 100644 --- a/charts/mok/tests/__snapshot__/dovecot_test.yaml.snap +++ b/charts/mok/tests/__snapshot__/dovecot_test.yaml.snap @@ -149,7 +149,7 @@ should match snapshot: secretName: RELEASE-NAME-mok-dovecot-users - name: tls secret: - secretName: nil + secretName: example-tls 4: | apiVersion: v1 kind: PersistentVolumeClaim diff --git a/charts/mok/tests/dovecot_test.yaml b/charts/mok/tests/dovecot_test.yaml index 67282401a..c170c198f 100644 --- a/charts/mok/tests/dovecot_test.yaml +++ b/charts/mok/tests/dovecot_test.yaml @@ -117,3 +117,15 @@ tests: value: 9215abccdd6c1f21fd329db0133f6f8e892c50aab3dcde3259ea797e8ad2a959 documentIndex: 2 template: dovecot.yaml + - it: scales with replicaCount + set: + dovecot: + replicaCount: 2 + tls: + secretName: example-tls + asserts: + - equal: + path: spec.replicas + value: 2 + documentIndex: 2 + template: dovecot.yaml diff --git a/charts/mok/tests/postfix_test.yaml b/charts/mok/tests/postfix_test.yaml index ffc244931..dbee2ef9f 100644 --- a/charts/mok/tests/postfix_test.yaml +++ b/charts/mok/tests/postfix_test.yaml @@ -130,3 +130,15 @@ tests: apiVersion: policy/v1 name: test-suite-mok-postfix template: postfix.yaml + - it: scales with replicaCount + set: + postfix: + replicaCount: 2 + tls: + secretName: example-tls + asserts: + - equal: + path: spec.replicas + value: 2 + documentIndex: 1 + template: postfix.yaml -- GitLab