Skip to content

Commit

Permalink
Add tolerations and local storage to the deployment (#26)
Browse files Browse the repository at this point in the history
* Add tolerations and local storage to the deployment

Signed-off-by: Voro <[email protected]>

* Update helm-charts/inbucket/Chart.yaml

Co-authored-by: Carlos Tadeu Panato Junior <[email protected]>
Signed-off-by: Voro <[email protected]>

* Fix persistence conditional when no persistence values are set

Signed-off-by: Voro <[email protected]>

---------

Signed-off-by: Voro <[email protected]>
Co-authored-by: Carlos Tadeu Panato Junior <[email protected]>
  • Loading branch information
VoroAndjaro and cpanato authored May 2, 2024
1 parent 22485a5 commit b6d541f
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 1 deletion.
2 changes: 1 addition & 1 deletion helm-charts/inbucket/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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.3.0
keywords:
- inbucket
- mail
Expand Down
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 -}}
17 changes: 17 additions & 0 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,23 @@ spec:
timeoutSeconds: 5
resources:
{{ toYaml .Values.resources | indent 12 }}
{{- if $persistence }}
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 $persistence}}
volumes:
- name: {{ include "inbucket.fullname" . }}
persistentVolumeClaim:
claimName: {{ include "inbucket.fullname" . }}
{{- end }}
18 changes: 18 additions & 0 deletions helm-charts/inbucket/templates/pvc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{{- if eq (include "inbucket.persistenceEnabled" .) "true" }}
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:
- {{ default .Values.persistence.accessMode "ReadWriteOnce" }}
resources:
requests:
storage: {{ .Values.persistence.size }}
storageClassName: {{ .Values.persistence.className }}
{{- end }}
7 changes: 7 additions & 0 deletions helm-charts/inbucket/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -74,3 +74,10 @@ ingress:

podAnnotations: {}
resources: {}

persistence:
enabled: false
path: /storage
size: 1Gi
className:
accessMode: ReadWriteOnce

0 comments on commit b6d541f

Please sign in to comment.