blob: 66050944caf5400bcd1316393fdc3237cd808328 [file] [log] [blame]
giolekva7fe15192021-11-19 13:58:16 +04001apiVersion: v1
2kind: Service
3metadata:
4 name: maddy
5 namespace: {{ .Release.Namespace }}
6spec:
7 type: ClusterIP
8 selector:
9 app: maddy
10 ports:
11 - name: imap
12 port: 143
13 protocol: TCP
14 - name: imaps
15 port: 993
16 protocol: TCP
17 - name: smtp
18 port: 25
19 protocol: TCP
20 - name: smtps
21 port: 465
22 protocol: TCP
23 - name: submission
24 port: 587
25 protocol: TCP
26---
27apiVersion: v1
28kind: Service
29metadata:
30 name: manage
31 namespace: {{ .Release.Namespace }}
32spec:
33 type: ClusterIP
34 selector:
35 app: maddy
36 ports:
37 - name: http
38 port: 80
39 targetPort: http
40 protocol: TCP
41---
42apiVersion: networking.k8s.io/v1
43kind: Ingress
44metadata:
45 name: manage
46 namespace: {{ .Release.Namespace }}
47spec:
48 ingressClassName: {{ .Values.ingress.private.className }}
49 tls:
50 - hosts:
51 - mail.{{ .Values.ingress.private.domain }}
giolekvaee3a57b2021-12-01 16:18:23 +040052 secretName: cert-wildcard.{{ .Values.ingress.private.domain }}
giolekva7fe15192021-11-19 13:58:16 +040053 rules:
54 - host: mail.{{ .Values.ingress.private.domain }}
55 http:
56 paths:
57 - path: /
58 pathType: Prefix
59 backend:
60 service:
61 name: manage
62 port:
63 name: http
64---
65apiVersion: cert-manager.io/v1
66kind: Certificate
67metadata:
68 name: mail.{{ .Values.ingress.public.domain }}
69 namespace: {{ .Release.Namespace }}
70 annotations:
71 "helm.sh/resource-policy": keep
72spec:
73 dnsNames:
74 - 'mail.{{ .Values.ingress.public.domain }}'
75 issuerRef:
76 name: {{ .Values.ingress.public.certificateIssuer }}
77 kind: ClusterIssuer
78 secretName: cert-mail.{{ .Values.ingress.public.domain }}
79---
80apiVersion: v1
81kind: PersistentVolumeClaim
82metadata:
83 name: data
84 namespace: {{ .Release.Namespace }}
85spec:
86 accessModes:
87 - ReadWriteOnce
88 resources:
89 requests:
90 storage: {{ .Values.storage.size }}
91---
92apiVersion: apps/v1
93kind: Deployment
94metadata:
95 name: maddy
96 namespace: {{ .Release.Namespace }}
97spec:
98 selector:
99 matchLabels:
100 app: maddy
101 replicas: 1
102 template:
103 metadata:
104 labels:
105 app: maddy
giolekva75ee2712021-11-26 13:57:12 +0400106 annotations:
107 checksum/config: {{ include (print $.Template.BasePath "/config.yaml") . | sha256sum }}
giolekva7fe15192021-11-19 13:58:16 +0400108 spec:
109 volumes:
110 - name: config
111 configMap:
112 name: config
113 - name: certs
114 secret:
115 secretName: cert-mail.{{ .Values.ingress.public.domain}}
giolekva75ee2712021-11-26 13:57:12 +0400116 - name: certs-private
117 secret:
118 secretName: cert-wildcard.{{ .Values.ingress.private.domain}}
giolekva7fe15192021-11-19 13:58:16 +0400119 - name: data
120 persistentVolumeClaim:
121 claimName: data
122 containers:
123 - name: maddy
124 image: giolekva/maddy:v0.4.4
125 imagePullPolicy: Always
126 ports:
127 - name: imap
128 containerPort: 143
129 protocol: TCP
130 - name: imaps
131 containerPort: 993
132 protocol: TCP
133 - name: smtp
134 containerPort: 25
135 protocol: TCP
136 - name: smtps
137 containerPort: 465
138 protocol: TCP
139 - name: submission
140 containerPort: 587
141 protocol: TCP
142 command:
143 - maddy
144 - -config
145 - /etc/maddy/config/maddy.conf
146 volumeMounts:
147 - name: config
148 mountPath: /etc/maddy/config
giolekva75ee2712021-11-26 13:57:12 +0400149 readOnly: true
150 - name: certs-private
151 mountPath: /etc/maddy/certs-private
152 readOnly: true
giolekva7fe15192021-11-19 13:58:16 +0400153 - name: data
154 mountPath: /var/lib/maddy
giolekva75ee2712021-11-26 13:57:12 +0400155 readOnly: false
giolekva7fe15192021-11-19 13:58:16 +0400156 - name: web
157 image: giolekva/maddy-web:latest
158 imagePullPolicy: Always
159 ports:
160 - name: http
161 containerPort: 80
162 protocol: TCP
163 command:
164 - maddy-web
165 - --port=80
166 - --maddy-config=/etc/maddy/config/maddy.conf
167 - --export-dkim=/var/lib/maddy/dkim_keys/{{ .Values.ingress.public.domain }}_default.dns
168 volumeMounts:
169 - name: config
170 mountPath: /etc/maddy/config
giolekva75ee2712021-11-26 13:57:12 +0400171 readOnly: true
giolekva7fe15192021-11-19 13:58:16 +0400172 - name: certs
173 mountPath: /etc/maddy/certs
giolekva75ee2712021-11-26 13:57:12 +0400174 readOnly: true
giolekva7fe15192021-11-19 13:58:16 +0400175 - name: data
176 mountPath: /var/lib/maddy
giolekva75ee2712021-11-26 13:57:12 +0400177 readOnly: false
giolekva7fe15192021-11-19 13:58:16 +0400178---
179apiVersion: v1
180kind: ConfigMap
181metadata:
182 name: mta-sts
183 namespace: {{ .Release.Namespace }}
184data:
185 mta-sts.txt: |
186 version: STSv1
187 mode: enforce
188 max_age: 604800
giolekva75ee2712021-11-26 13:57:12 +0400189 mx: {{ .Values.mailGateway.mxHostname }}
giolekva7fe15192021-11-19 13:58:16 +0400190---
191apiVersion: apps/v1
192kind: Deployment
193metadata:
194 name: mta-sts
195 namespace: {{ .Release.Namespace }}
196spec:
197 selector:
198 matchLabels:
199 app: mta-sts
200 replicas: 1
201 template:
202 metadata:
203 labels:
204 app: mta-sts
205 spec:
206 volumes:
207 - name: mta-sts
208 configMap:
209 name: mta-sts
210 containers:
211 - name: maddy
212 image: giolekva/static-file-server:latest
213 imagePullPolicy: Always
214 ports:
215 - name: http
216 containerPort: 80
217 protocol: TCP
218 command:
219 - static-file-server
220 - --port=80
221 - --dir=/etc/static-file-server/data
222 volumeMounts:
223 - name: mta-sts
224 mountPath: /etc/static-file-server/data/.well-known
225 readOnly: true
226---
227apiVersion: v1
228kind: Service
229metadata:
230 name: mta-sts
231 namespace: {{ .Release.Namespace }}
232spec:
233 type: ClusterIP
234 selector:
235 app: mta-sts
236 ports:
237 - name: http
238 port: 80
239 targetPort: http
240 protocol: TCP
241---
242apiVersion: cert-manager.io/v1
243kind: Certificate
244metadata:
245 name: mta-sts.{{ .Values.ingress.public.domain }}
246 namespace: {{ .Release.Namespace }}
247 annotations:
giolekvaee3a57b2021-12-01 16:18:23 +0400248 helm.sh/resource-policy: keep
giolekva7fe15192021-11-19 13:58:16 +0400249spec:
250 dnsNames:
251 - 'mta-sts.{{ .Values.ingress.public.domain }}'
252 issuerRef:
253 name: {{ .Values.ingress.public.certificateIssuer }}
254 kind: ClusterIssuer
255 secretName: cert-mta-sts.{{ .Values.ingress.public.domain }}
256---
257apiVersion: networking.k8s.io/v1
258kind: Ingress
259metadata:
260 name: mta-sts
261 namespace: {{ .Release.Namespace }}
262spec:
263 ingressClassName: {{ .Values.ingress.public.className }}
264 tls:
265 - hosts:
266 - mta-sts.{{ .Values.ingress.public.domain }}
267 secretName: cert-mta-sts.{{ .Values.ingress.public.domain }}
268 rules:
269 - host: mta-sts.{{ .Values.ingress.public.domain }}
270 http:
271 paths:
272 - pathType: Prefix
273 path: "/"
274 backend:
275 service:
276 name: mta-sts
277 port:
278 name: http