apiVersion: apps/v1 kind: Deployment metadata: name: {{ include "maddy.fullname" . }} labels: {{- include "maddy.labels" . | nindent 4 }} spec: replicas: {{ .Values.replicaCount }} selector: matchLabels: {{- include "maddy.selectorLabels" . | nindent 6 }} template: metadata: annotations: checksum/config: {{ tpl (.Files.Get "files/maddy.conf") . | printf "%s" | sha256sum }} checksum/aliases: {{ tpl (.Files.Get "files/aliases") . | printf "%s" | sha256sum }} {{- with .Values.podAnnotations }} {{- toYaml . | nindent 8 }} {{- end }} labels: {{- include "maddy.selectorLabels" . | nindent 8 }} spec: {{- with .Values.imagePullSecrets }} imagePullSecrets: {{- toYaml . | nindent 8 }} {{- end }} serviceAccountName: {{ include "maddy.serviceAccountName" . }} securityContext: {{- toYaml .Values.podSecurityContext | nindent 8 }} initContainers: - name: init securityContext: {{- toYaml .Values.securityContext | nindent 12 }} image: busybox imagePullPolicy: {{ .Values.image.pullPolicy }} command: - sh - -c - cp /tmp/maddy/* /data/. resources: {{- toYaml .Values.resources | nindent 12 }} volumeMounts: - name: data mountPath: {{ .Values.persistence.path }} {{- if .Values.persistence.subPath }} subPath: {{ .Values.persistence.subPath }} {{- end }} - name: config mountPath: /tmp/maddy containers: - name: {{ .Chart.Name }} securityContext: {{- toYaml .Values.securityContext | nindent 12 }} image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" imagePullPolicy: {{ .Values.image.pullPolicy }} ports: - name: smtp containerPort: 25 protocol: TCP - name: imaps containerPort: 993 protocol: TCP - name: starttls containerPort: 587 protocol: TCP # livenessProbe: # httpGet: # path: / # port: http # readinessProbe: # httpGet: # path: / # port: http resources: {{- toYaml .Values.resources | nindent 12 }} volumeMounts: - name: data mountPath: {{ .Values.persistence.path }} {{- if .Values.persistence.subPath }} subPath: {{ .Values.persistence.subPath }} {{- end }} - name: tls mountPath: /etc/maddy/certs/fullchain.pem subPath: tls.crt - name: tls mountPath: /etc/maddy/certs/privkey.pem subPath: tls.key volumes: - name: data {{- if .Values.persistence.enabled }} persistentVolumeClaim: claimName: {{ default (include "maddy.fullname" .) .Values.persistence.existingClaim }} {{- else }} emptyDir: {} {{- end }} - name: config configMap: name: {{include "maddy.fullname" .}} - name: tls secret: secretName: {{include "maddy.fullname" .}} {{- with .Values.nodeSelector }} nodeSelector: {{- toYaml . | nindent 8 }} {{- end }} {{- with .Values.affinity }} affinity: {{- toYaml . | nindent 8 }} {{- end }} {{- with .Values.tolerations }} tolerations: {{- toYaml . | nindent 8 }} {{- end }}