Skip to content

Commit f71d57e

Browse files
authored
Merge pull request docker-mailserver#152 from cfis/dev
Split PVCs from Volume Mounts
2 parents 13dc666 + 604d180 commit f71d57e

File tree

7 files changed

+326
-31
lines changed

7 files changed

+326
-31
lines changed

charts/docker-mailserver/README.md

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ If you do not enable the PROXY protocol and your mail server is not exposed usin
179179

180180
## Persistence
181181

182-
By default, the Chart creates four PersistentVolumeClaims. These are defined under the `persistence` key:
182+
By default, the Chart assumes there are for Persistent volumes. Thus it requests four PersistentVolumeClaims which are defined using the `persistent_volume_claims` key. Each PVC can be set to an existing claim by settin the `persistent_volume_claims.<volume_name>.existing_claim` key or a new cliams. To disable creation of a PVC, set `persistent_volume_claims.<volume_name>.enabled` to false. The default PVCs have the following characteristics:
183183

184184
| PVC Name | Default Size | Mount | Description |
185185
| ---------- | ------- | ----------------------- | -------------------------------------|
@@ -188,6 +188,25 @@ By default, the Chart creates four PersistentVolumeClaims. These are defined und
188188
| mail-state | 1Gi | /var/mail-state | Stores [state](https://docker-mailserver.github.io/docker-mailserver/latest/faq/#what-about-the-docker-datadmsmail-state-directory) for mail services |
189189
| mail-log | 1Gi | /var/log/mail | Stores log files |
190190

191+
The PVCs are then mounted to `volumeMounts` via the `persistence` key. Each `volumeMount` must specify a volume name and mount path. It is also possbile to set a subpath via the `subPath` key.
192+
193+
Extra volumes and volume mounts may be added using the `extraVolumes` and `extraVolumeMounts` keys.
194+
195+
## Upgrading to Version 5
196+
Version 5.0 upgrades docker-mailserver to version 15. This version of the chart *does* include backwards incompatible changes
197+
198+
### PersistentVolumeClaims
199+
200+
Previously by default the Chart created four persistent volume claims and then mounted them to the container. This made it difficult for users that want to use just one Volume. Therefore the `persistence` key was spit into two keys:
201+
202+
* `persistent_volume_claims`
203+
* `persistence`
204+
205+
This separate the creation of PVCs from mounting their associated volumes. If you previously overrode the creation of PVCs or their mount paths you will need to update your custom `values.yaml` file.
206+
207+
## Upgrading to Version 4
208+
Version 4.0 upgrades docker-mailserver to version 14. There are no backwards incompatible changes in the chart.
209+
191210
## Upgrading to Version 3
192211

193212
Version 3.0 is not backwards compatible with previous versions. The biggest changes include:

charts/docker-mailserver/templates/deployment.yaml

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,12 @@ spec:
7171
{{- end }}
7272

7373
# PVCs
74-
{{- range $name, $persistence := .Values.persistence }}
75-
{{- if $persistence.enabled }}
74+
{{- range $name, $pvc := .Values.persistent_volume_claims }}
75+
{{- if $pvc.enabled }}
7676
- name: {{ $name }}
7777
persistentVolumeClaim:
78-
{{- if $persistence.existingClaim}}
79-
claimName: {{ $persistence.existingClaim }}
78+
{{- if $pvc.existingClaim}}
79+
claimName: {{ $pvc.existingClaim }}
8080
{{ else }}
8181
claimName: {{ template "dockermailserver.fullname" $ }}-{{ $name }}
8282
{{ end }}
@@ -168,13 +168,11 @@ spec:
168168

169169
# Mount Volumes
170170
{{- range $name, $persistence := .Values.persistence }}
171-
{{- if $persistence.enabled }}
172-
- name: {{ $name }}
171+
- name: {{ $persistence.volumeName }}
173172
mountPath: {{ $persistence.mountPath }}
174173
{{- if $persistence.subPath }}
175174
subPath: {{ $persistence.subPath }}
176175
{{- end }}
177-
{{- end }}
178176
{{- end }}
179177

180178
# Mount Extra Volumes

charts/docker-mailserver/templates/pvc.yaml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
1-
{{- range $name, $persistence := .Values.persistence -}}
2-
{{- if and (not $persistence.existingClaim) ($persistence.enabled) }}
1+
{{- range $name, $pvc := .Values.persistent_volume_claims -}}
2+
{{- if and (not $pvc.existingClaim) ($pvc.enabled) }}
33
kind: PersistentVolumeClaim
44
apiVersion: v1
55
metadata:
66
name: {{ template "dockermailserver.fullname" $ }}-{{ $name }}
7-
{{- if $persistence.annotations }}
7+
{{- if $pvc.annotations }}
88
annotations:
9-
{{ toYaml $persistence.annotations | indent 2 }}
9+
{{ toYaml $pvc.annotations }}
1010
{{ end }}
1111
spec:
1212
accessModes:
13-
{{ toYaml $persistence.accessModes | indent 2 }}
13+
{{ toYaml $pvc.accessModes | indent 2 }}
1414

15-
{{- if $persistence.storageClass }}
16-
storageClassName: {{ $persistence.storageClass | quote }}
15+
{{- if $pvc.storageClass }}
16+
storageClassName: {{ $pvc.storageClass | quote }}
1717
{{- end }}
1818
resources:
1919
requests:
20-
storage: {{ $persistence.size | quote }}
21-
{{- if $persistence.selector }}
20+
storage: {{ $pvc.size | quote }}
21+
{{- if $pvc.selector }}
2222
selector:
23-
{{ toYaml $persistence.selector | indent 4 }}
23+
{{ toYaml $pvc.selector | indent 4 }}
2424
{{ end }}
2525
---
2626
{{- end }}

charts/docker-mailserver/tests/__snapshot__/pvc_test.yaml.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ manifest should match snapshot:
4343
resources:
4444
requests:
4545
storage: 1Gi
46-
should apply annotations from persistence.annotations:
46+
should apply annotations from persistent_volume_claims.annotations:
4747
1: |
4848
apiVersion: v1
4949
kind: PersistentVolumeClaim

charts/docker-mailserver/tests/pvc_test.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ chart:
77
version: 0.1.0
88
appVersion: 0.1.0
99
tests:
10-
- it: should apply annotations from persistence.annotations
10+
- it: should apply annotations from persistent_volume_claims.annotations
1111
set:
12-
persistence:
12+
persistent_volume_claims:
1313
mail-config:
1414
annotations:
1515
backup.banana.io/deltas: pancakes
@@ -18,7 +18,7 @@ tests:
1818

1919
- it: should create pvc of specified size
2020
set:
21-
persistence:
21+
persistent_volume_claims:
2222
mail-data:
2323
size: 1Pb
2424
documentIndex: 1

charts/docker-mailserver/values.yaml

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -329,14 +329,12 @@ service:
329329
labels: {}
330330

331331
# Note this is a dictionary and not a list so individual keys can be overridden by --set or --value helm parameters
332-
persistence:
332+
persistent_volume_claims:
333333
# Stores generated configuration files
334334
# https://docker-mailserver.github.io/docker-mailserver/edge/faq/#what-about-the-docker-datadmsconfig-directory
335335
mail-config:
336336
enabled: true
337337
existingClaim: ""
338-
mountPath: /tmp/docker-mailserver
339-
subPath: ""
340338
size: "1Mi"
341339
annotations: {}
342340
accessModes:
@@ -348,9 +346,7 @@ persistence:
348346
mail-data:
349347
enabled: true
350348
existingClaim: ""
351-
subPath: ""
352349
size: 10Gi
353-
mountPath: /var/mail
354350
annotations: {}
355351
accessModes:
356352
- ReadWriteOnce
@@ -362,8 +358,6 @@ persistence:
362358
mail-state:
363359
enabled: true
364360
existingClaim: ""
365-
mountPath: /var/mail-state
366-
subPath: ""
367361
size: "1Gi"
368362
annotations: {}
369363
accessModes:
@@ -375,15 +369,40 @@ persistence:
375369
mail-log:
376370
enabled: true
377371
existingClaim: ""
378-
mountPath: /var/log/mail
379-
subPath: ""
380372
size: "1Gi"
381373
annotations: {}
382374
accessModes:
383375
- ReadWriteOnce
384376
storageClass:
385377
selector: {}
386378

379+
persistence:
380+
# Stores generated configuration files
381+
# https://docker-mailserver.github.io/docker-mailserver/edge/faq/#what-about-the-docker-datadmsconfig-directory
382+
mail-config:
383+
volumeName: mail-config
384+
mountPath: /tmp/docker-mailserver
385+
subPath:
386+
387+
# Stores emails
388+
mail-data:
389+
volumeName: mail-data
390+
mountPath: /var/mail
391+
subPath:
392+
393+
# Stores state for Postfix, Dovecot, Fail2Ban, Amavis, PostGrey, ClamAV, SpamAssassin, Rspamd & Redis
394+
# https://docker-mailserver.github.io/docker-mailserver/edge/faq/#what-about-the-docker-datadmsmail-state-directory
395+
mail-state:
396+
volumeName: mail-state
397+
mountPath: /var/mail-state
398+
subPath:
399+
400+
# Store mail logs
401+
mail-log:
402+
volumeName: mail-log
403+
mountPath: /var/log/mail
404+
subPath:
405+
387406
## Monitoring adds the prometheus.io annotations to pods and services, so that the Prometheus Kubernetes SD mechanism
388407
## as configured in the examples will automatically discover both the pods and the services to query.
389408
##

0 commit comments

Comments
 (0)