maddy

Fork https://github.com/foxcpp/maddy

git clone git://git.lin.moe/go/maddy.git

  1apiVersion: apps/v1
  2kind: Deployment
  3metadata:
  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: init
 32          securityContext:
 33            {{- toYaml .Values.securityContext | nindent 12 }}
 34          image: busybox
 35          imagePullPolicy: {{ .Values.image.pullPolicy }}
 36          command:
 37            - sh
 38            - -c
 39            - cp /tmp/maddy/* /data/.
 40          resources:
 41            {{- toYaml .Values.resources | nindent 12 }}
 42          volumeMounts:
 43            - name: data
 44              mountPath: {{ .Values.persistence.path }}
 45              {{- if .Values.persistence.subPath }}
 46              subPath: {{ .Values.persistence.subPath }}
 47              {{- end }}
 48            - name: config
 49              mountPath: /tmp/maddy
 50      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: smtp
 58              containerPort: 25
 59              protocol: TCP
 60            - name: imaps
 61              containerPort: 993
 62              protocol: TCP
 63            - name: starttls
 64              containerPort: 587
 65              protocol: TCP
 66          # livenessProbe:
 67          #   httpGet:
 68          #     path: /
 69          #     port: http
 70          # readinessProbe:
 71          #   httpGet:
 72          #     path: /
 73          #     port: http
 74          resources:
 75            {{- toYaml .Values.resources | nindent 12 }}
 76          volumeMounts:
 77            - name: data
 78              mountPath: {{ .Values.persistence.path }}
 79              {{- if .Values.persistence.subPath }}
 80              subPath: {{ .Values.persistence.subPath }}
 81              {{- end }}
 82            - name: tls
 83              mountPath: /etc/maddy/certs/fullchain.pem
 84              subPath: tls.crt
 85            - name: tls
 86              mountPath: /etc/maddy/certs/privkey.pem
 87              subPath: tls.key
 88      volumes:
 89        - name: data
 90          {{- if .Values.persistence.enabled }}
 91          persistentVolumeClaim:
 92            claimName: {{ default (include "maddy.fullname" .) .Values.persistence.existingClaim }}
 93          {{- else }}
 94          emptyDir: {}
 95          {{- end }}
 96        - name: config
 97          configMap:
 98            name: {{include "maddy.fullname" .}}
 99        - name: tls
100          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 }}