Skip to content

Commit

Permalink
Fix persistence conditional when no persistence values are set
Browse files Browse the repository at this point in the history
Signed-off-by: Voro <[email protected]>
  • Loading branch information
VoroAndjaro committed Mar 1, 2024
1 parent 2fd496d commit f79b524
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
7 changes: 7 additions & 0 deletions helm-charts/inbucket/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -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 -}}
5 changes: 3 additions & 2 deletions helm-charts/inbucket/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{- $persistence := eq (include "inbucket.persistenceEnabled" .) "true" -}}
apiVersion: apps/v1
kind: Deployment
metadata:
Expand Down Expand Up @@ -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" . }}
Expand All @@ -68,7 +69,7 @@ spec:
tolerations:
{{ toYaml .Values.tolerations | indent 6 }}
{{- end }}
{{- if .Values.persistence.enabled }}
{{- if $persistence}}
volumes:
- name: {{ include "inbucket.fullname" . }}
persistentVolumeClaim:
Expand Down
4 changes: 2 additions & 2 deletions helm-charts/inbucket/templates/pvc.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{- if .Values.persistence.enabled }}
{{- if eq (include "inbucket.persistenceEnabled" .) "true" }}
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
Expand All @@ -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 }}
Expand Down

0 comments on commit f79b524

Please sign in to comment.