apiVersion: apps/v1 kind: StatefulSet metadata: name: {{ include "stalwart.fullname" . }} namespace: {{ .Values.namespace }} labels: {{- include "stalwart.labels" . | nindent 4 }} spec: serviceName: {{ include "stalwart.fullname" . }} replicas: {{ .Values.replicaCount }} selector: matchLabels: {{- include "stalwart.selectorLabels" . | nindent 6 }} template: metadata: labels: {{- include "stalwart.selectorLabels" . | nindent 8 }} spec: securityContext: {{- toYaml .Values.securityContext | nindent 8 }} containers: - name: stalwart image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" imagePullPolicy: {{ .Values.image.pullPolicy }} ports: - name: web containerPort: {{ .Values.service.web.targetPort }} protocol: TCP - name: smtp containerPort: {{ .Values.service.smtp.targetPort }} protocol: TCP - name: smtps containerPort: {{ .Values.service.smtps.targetPort }} protocol: TCP - name: submission containerPort: {{ .Values.service.submission.targetPort }} protocol: TCP - name: imap containerPort: {{ .Values.service.imap.targetPort }} protocol: TCP - name: imaps containerPort: {{ .Values.service.imaps.targetPort }} protocol: TCP env: - name: STALWART_ADMIN_USER value: {{ .Values.env.STALWART_ADMIN_USER | quote }} - name: STALWART_ADMIN_PASSWORD valueFrom: secretKeyRef: name: {{ .Values.secret.name }} key: STALWART_ADMIN_PASSWORD volumeMounts: - name: data mountPath: {{ .Values.persistence.mountPath }} resources: {{- toYaml .Values.resources | nindent 10 }} livenessProbe: httpGet: path: / port: web initialDelaySeconds: 30 periodSeconds: 10 readinessProbe: httpGet: path: / port: web initialDelaySeconds: 10 periodSeconds: 5 {{- with .Values.nodeSelector }} nodeSelector: {{- toYaml . | nindent 8 }} {{- end }} {{- with .Values.affinity }} affinity: {{- toYaml . | nindent 8 }} {{- end }} {{- with .Values.tolerations }} tolerations: {{- toYaml . | nindent 8 }} {{- end }} {{- if .Values.persistence.enabled }} volumeClaimTemplates: - metadata: name: data labels: {{- include "stalwart.labels" . | nindent 8 }} spec: accessModes: - {{ .Values.persistence.accessMode }} storageClassName: {{ .Values.persistence.storageClass }} resources: requests: storage: {{ .Values.persistence.size }} {{- end }}