Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add StatefulSet deployment for postfix #304

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion mailu/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -437,11 +437,13 @@ Check that the deployed pods are all running.
### Postfix parameters

| Name | Description | Value |
| ----------------------------------------------- | ------------------------------------------------------------------------------------- | ------------------- |
|-------------------------------------------------|---------------------------------------------------------------------------------------|---------------------|
| `postfix.logLevel` | Override default log level | `""` |
| `postfix.image.repository` | Pod image repository | `mailu/postfix` |
| `postfix.image.tag` | Pod image tag (defaults to mailuVersion if set, otherwise Chart.AppVersion) | `""` |
| `postfix.image.pullPolicy` | Pod image pull policy | `IfNotPresent` |
| `postfix.kind` | Kind of resource to create for postfix (`Deployment` or `StatefulSet`) | `Deployment` |
| `postfix.replicaCount` | Number of front replicas to deploy (only for `StatefulSet` kind) | `StatefulSet` |
| `postfix.persistence.size` | Pod pvc size | `20Gi` |
| `postfix.persistence.storageClass` | Pod pvc storage class | `""` |
| `postfix.persistence.accessModes` | Pod pvc access modes | `["ReadWriteOnce"]` |
Expand Down
46 changes: 45 additions & 1 deletion mailu/templates/postfix/deployment.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
apiVersion: {{ include "common.capabilities.deployment.apiVersion" . }}
kind: Deployment
kind: {{ .Values.postfix.kind }}
metadata:
name: {{ printf "%s-postfix" (include "mailu.fullname" .) }}
namespace: {{ include "common.names.namespace" . | quote }}
Expand All @@ -13,7 +13,12 @@ metadata:
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
spec:
{{- if eq .Values.postfix.kind "StatefulSet" }}
replicas: {{ .Values.postfix.replicaCount }}
podManagementPolicy: "Parallel"
{{- else }}
replicas: 1
{{- end }}
{{- if .Values.postfix.updateStrategy }}
strategy: {{- toYaml .Values.postfix.updateStrategy | nindent 4 }}
{{- end }}
Expand Down Expand Up @@ -140,9 +145,11 @@ spec:
- '! /usr/libexec/postfix/master -t'
{{- end }}
volumes:
{{- if not (eq .Values.postfix.kind "StatefulSet") }}
- name: data
persistentVolumeClaim:
claimName: {{ include "mailu.postfix.claimName" . }}
{{- end }}
{{- if .Values.postfix.overrides }}
- name: overrides
configMap:
Expand All @@ -151,3 +158,40 @@ spec:
{{- if .Values.postfix.extraVolumes }}
{{- include "common.tplvalues.render" (dict "value" .Values.postfix.extraVolumes "context" $) | nindent 8 }}
{{- end }}
{{- if eq .Values.postfix.kind "StatefulSet" }}
volumeClaimTemplates:
- metadata:
name: data
labels: {{- include "common.labels.standard" . | nindent 10 }}
app.kubernetes.io/component: postfix
{{- if .Values.postfix.persistence.labels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.postfix.persistence.labels "context" $ ) | nindent 10 }}
{{- end }}
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 10 }}
{{- end }}
{{- if or .Values.postfix.persistence.annotations .Values.commonAnnotations }}
annotations:
{{- if .Values.postfix.persistence.annotations }}
{{- include "common.tplvalues.render" ( dict "value" .Values.postfix.persistence.annotations "context" $ ) | nindent 10 }}
{{- end }}
{{- if .Values.commonAnnotations }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 10 }}
{{- end }}
{{- end }}
spec:
accessModes:
{{- range .Values.postfix.persistence.accessModes }}
- {{ . | quote }}
{{- end }}
resources:
requests:
storage: {{ .Values.postfix.persistence.size | quote }}
{{- if .Values.postfix.persistence.selector }}
selector: {{- include "common.tplvalues.render" (dict "value" .Values.postfix.persistence.selector "context" $) | nindent 10 }}
{{- end }}
{{- if .Values.postfix.persistence.dataSource }}
dataSource: {{- include "common.tplvalues.render" (dict "value" .Values.postfix.persistence.dataSource "context" $) | nindent 10 }}
{{- end }}
{{- include "common.storage.class" (dict "persistence" .Values.postfix.persistence "global" .Values.global) | nindent 8 }}
{{- end }}
2 changes: 1 addition & 1 deletion mailu/templates/postfix/pvc.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
{{- if not .Values.persistence.single_pvc }}
{{- if and (not .Values.persistence.single_pvc) (eq .Values.postfix.kind "Deployment") }}
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
Expand Down
6 changes: 6 additions & 0 deletions mailu/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1100,6 +1100,12 @@ postfix:
tag: ""
pullPolicy: IfNotPresent

## @param postfix.kind Kind of resource to create for postfix (`Deployment` or `StatefulSet`)
kind: Deployment

## @param postfix.replicaCount Number of front replicas to deploy (only for `StatefulSet` kind)
replicaCount: 1

## Pod persistence (if not using single_pvc)
## @param postfix.persistence.size Pod pvc size
## @param postfix.persistence.storageClass Pod pvc storage class
Expand Down