From f7d6c4dee642114f3d46837006ed4bdc54ab68b9 Mon Sep 17 00:00:00 2001 From: Voro Date: Thu, 22 Feb 2024 16:01:27 +0100 Subject: [PATCH 1/3] Add tolerations and local storage to the deployment Signed-off-by: Voro --- helm-charts/inbucket/Chart.yaml | 2 +- helm-charts/inbucket/templates/deployment.yaml | 16 ++++++++++++++++ helm-charts/inbucket/templates/pvc.yaml | 18 ++++++++++++++++++ helm-charts/inbucket/values.yaml | 7 +++++++ 4 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 helm-charts/inbucket/templates/pvc.yaml diff --git a/helm-charts/inbucket/Chart.yaml b/helm-charts/inbucket/Chart.yaml index b5d6916..f318023 100644 --- a/helm-charts/inbucket/Chart.yaml +++ b/helm-charts/inbucket/Chart.yaml @@ -3,7 +3,7 @@ description: Disposable webmail server (similar to Mailinator) with built in SMT name: inbucket type: application appVersion: 3.0.0 -version: 2.2.2 +version: 2.2.3 keywords: - inbucket - mail diff --git a/helm-charts/inbucket/templates/deployment.yaml b/helm-charts/inbucket/templates/deployment.yaml index ab2ab2b..d6c4de5 100644 --- a/helm-charts/inbucket/templates/deployment.yaml +++ b/helm-charts/inbucket/templates/deployment.yaml @@ -54,7 +54,23 @@ spec: timeoutSeconds: 5 resources: {{ toYaml .Values.resources | indent 12 }} + {{- if .Values.persistence.enabled }} + volumeMounts: + - mountPath: {{ .Values.persistence.path }} + name: {{ include "inbucket.fullname" . }} + readOnly: false + {{- end }} {{- if .Values.nodeSelector }} nodeSelector: {{ toYaml .Values.nodeSelector | indent 8 }} {{- end }} + {{- if .Values.tolerations }} + tolerations: +{{ toYaml .Values.tolerations | indent 6 }} + {{- end }} + {{- if .Values.persistence.enabled }} + volumes: + - name: {{ include "inbucket.fullname" . }} + persistentVolumeClaim: + claimName: {{ include "inbucket.fullname" . }} + {{- end }} diff --git a/helm-charts/inbucket/templates/pvc.yaml b/helm-charts/inbucket/templates/pvc.yaml new file mode 100644 index 0000000..a4b5222 --- /dev/null +++ b/helm-charts/inbucket/templates/pvc.yaml @@ -0,0 +1,18 @@ +{{- if .Values.persistence.enabled }} +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: {{ include "inbucket.fullname" . }} + labels: + app.kubernetes.io/name: {{ include "inbucket.name" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/managed-by: {{ .Release.Service }} + helm.sh/chart: {{ include "inbucket.chart" . }} +spec: + accessModes: + - {{ .Values.persistence.accessMode }} + resources: + requests: + storage: {{ .Values.persistence.size }} + storageClassName: {{ .Values.persistence.className }} +{{- end }} diff --git a/helm-charts/inbucket/values.yaml b/helm-charts/inbucket/values.yaml index 6469864..abe6380 100644 --- a/helm-charts/inbucket/values.yaml +++ b/helm-charts/inbucket/values.yaml @@ -74,3 +74,10 @@ ingress: podAnnotations: {} resources: {} + +persistence: + enabled: false + path: /storage + size: 1Gi + className: + accessMode: ReadWriteOnce From 2fd496dbbd5ee390d9e3717e00ab2ec1b72ab195 Mon Sep 17 00:00:00 2001 From: Voro <107838162+VoroAndjaro@users.noreply.github.com> Date: Thu, 29 Feb 2024 17:19:12 +0100 Subject: [PATCH 2/3] Update helm-charts/inbucket/Chart.yaml Co-authored-by: Carlos Tadeu Panato Junior Signed-off-by: Voro --- helm-charts/inbucket/Chart.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helm-charts/inbucket/Chart.yaml b/helm-charts/inbucket/Chart.yaml index f318023..b51ca5f 100644 --- a/helm-charts/inbucket/Chart.yaml +++ b/helm-charts/inbucket/Chart.yaml @@ -3,7 +3,7 @@ description: Disposable webmail server (similar to Mailinator) with built in SMT name: inbucket type: application appVersion: 3.0.0 -version: 2.2.3 +version: 2.3.0 keywords: - inbucket - mail From f79b524d7f59c9c7e6c75b3ce40d08b5b7b115da Mon Sep 17 00:00:00 2001 From: Voro Date: Fri, 1 Mar 2024 12:31:17 +0100 Subject: [PATCH 3/3] Fix persistence conditional when no persistence values are set Signed-off-by: Voro --- helm-charts/inbucket/templates/_helpers.tpl | 7 +++++++ helm-charts/inbucket/templates/deployment.yaml | 5 +++-- helm-charts/inbucket/templates/pvc.yaml | 4 ++-- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/helm-charts/inbucket/templates/_helpers.tpl b/helm-charts/inbucket/templates/_helpers.tpl index 2a92b3d..3333843 100644 --- a/helm-charts/inbucket/templates/_helpers.tpl +++ b/helm-charts/inbucket/templates/_helpers.tpl @@ -69,3 +69,10 @@ Return if ingress supports pathType. {{- define "inbucket.ingress.supportsPathType" -}} {{- or (eq (include "inbucket.ingress.isStable" .) "true") (and (eq (include "inbucket.ingress.apiVersion" .) "networking.k8s.io/v1beta1") (semverCompare ">= 1.18-0" .Capabilities.KubeVersion.Version)) -}} {{- end -}} + +{{/* +Return if persistence is enabled. +*/}} +{{- define "inbucket.persistenceEnabled" -}} + {{- and ( and ( hasKey .Values "persistence" ) ( hasKey .Values.persistence "enabled" ) ) ( eq .Values.persistence.enabled true ) -}} +{{- end -}} diff --git a/helm-charts/inbucket/templates/deployment.yaml b/helm-charts/inbucket/templates/deployment.yaml index d6c4de5..be454a5 100644 --- a/helm-charts/inbucket/templates/deployment.yaml +++ b/helm-charts/inbucket/templates/deployment.yaml @@ -1,3 +1,4 @@ +{{- $persistence := eq (include "inbucket.persistenceEnabled" .) "true" -}} apiVersion: apps/v1 kind: Deployment metadata: @@ -54,7 +55,7 @@ spec: timeoutSeconds: 5 resources: {{ toYaml .Values.resources | indent 12 }} - {{- if .Values.persistence.enabled }} + {{- if $persistence }} volumeMounts: - mountPath: {{ .Values.persistence.path }} name: {{ include "inbucket.fullname" . }} @@ -68,7 +69,7 @@ spec: tolerations: {{ toYaml .Values.tolerations | indent 6 }} {{- end }} - {{- if .Values.persistence.enabled }} + {{- if $persistence}} volumes: - name: {{ include "inbucket.fullname" . }} persistentVolumeClaim: diff --git a/helm-charts/inbucket/templates/pvc.yaml b/helm-charts/inbucket/templates/pvc.yaml index a4b5222..c96d5af 100644 --- a/helm-charts/inbucket/templates/pvc.yaml +++ b/helm-charts/inbucket/templates/pvc.yaml @@ -1,4 +1,4 @@ -{{- if .Values.persistence.enabled }} +{{- if eq (include "inbucket.persistenceEnabled" .) "true" }} apiVersion: v1 kind: PersistentVolumeClaim metadata: @@ -10,7 +10,7 @@ metadata: helm.sh/chart: {{ include "inbucket.chart" . }} spec: accessModes: - - {{ .Values.persistence.accessMode }} + - {{ default .Values.persistence.accessMode "ReadWriteOnce" }} resources: requests: storage: {{ .Values.persistence.size }}