1apiVersion: apps/v12kind: Deployment3metadata:4 name: {{ include "maddy.fullname" . }}5 labels:6 {{- include "maddy.labels" . | nindent 4 }}7spec:8 replicas: {{ .Values.replicaCount }}9 selector:10 matchLabels:11 {{- include "maddy.selectorLabels" . | nindent 6 }}12 template:13 metadata:14 annotations:15 checksum/config: {{ tpl (.Files.Get "files/maddy.conf") . | printf "%s" | sha256sum }}16 checksum/aliases: {{ tpl (.Files.Get "files/aliases") . | printf "%s" | sha256sum }}17 {{- with .Values.podAnnotations }}18 {{- toYaml . | nindent 8 }}19 {{- end }}20 labels:21 {{- include "maddy.selectorLabels" . | nindent 8 }}22 spec:23 {{- with .Values.imagePullSecrets }}24 imagePullSecrets:25 {{- toYaml . | nindent 8 }}26 {{- end }}27 serviceAccountName: {{ include "maddy.serviceAccountName" . }}28 securityContext:29 {{- toYaml .Values.podSecurityContext | nindent 8 }}30 initContainers:31 - name: init32 securityContext:33 {{- toYaml .Values.securityContext | nindent 12 }}34 image: busybox35 imagePullPolicy: {{ .Values.image.pullPolicy }}36 command:37 - sh38 - -c39 - cp /tmp/maddy/* /data/.40 resources:41 {{- toYaml .Values.resources | nindent 12 }}42 volumeMounts:43 - name: data44 mountPath: {{ .Values.persistence.path }}45 {{- if .Values.persistence.subPath }}46 subPath: {{ .Values.persistence.subPath }}47 {{- end }}48 - name: config49 mountPath: /tmp/maddy50 containers:51 - name: {{ .Chart.Name }}52 securityContext:53 {{- toYaml .Values.securityContext | nindent 12 }}54 image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"55 imagePullPolicy: {{ .Values.image.pullPolicy }}56 ports:57 - name: smtp58 containerPort: 2559 protocol: TCP60 - name: imaps61 containerPort: 99362 protocol: TCP63 - name: starttls64 containerPort: 58765 protocol: TCP66 # livenessProbe:67 # httpGet:68 # path: /69 # port: http70 # readinessProbe:71 # httpGet:72 # path: /73 # port: http74 resources:75 {{- toYaml .Values.resources | nindent 12 }}76 volumeMounts:77 - name: data78 mountPath: {{ .Values.persistence.path }}79 {{- if .Values.persistence.subPath }}80 subPath: {{ .Values.persistence.subPath }}81 {{- end }}82 - name: tls83 mountPath: /etc/maddy/certs/fullchain.pem84 subPath: tls.crt85 - name: tls86 mountPath: /etc/maddy/certs/privkey.pem87 subPath: tls.key88 volumes:89 - name: data90 {{- if .Values.persistence.enabled }}91 persistentVolumeClaim:92 claimName: {{ default (include "maddy.fullname" .) .Values.persistence.existingClaim }}93 {{- else }}94 emptyDir: {}95 {{- end }}96 - name: config97 configMap:98 name: {{include "maddy.fullname" .}}99 - name: tls100 secret:101 secretName: {{include "maddy.fullname" .}}102 {{- with .Values.nodeSelector }}103 nodeSelector:104 {{- toYaml . | nindent 8 }}105 {{- end }}106 {{- with .Values.affinity }}107 affinity:108 {{- toYaml . | nindent 8 }}109 {{- end }}110 {{- with .Values.tolerations }}111 tolerations:112 {{- toYaml . | nindent 8 }}113 {{- end }}