diff --git a/traefik/templates/pvc.yaml b/traefik/templates/pvc.yaml index 81c85ac02..7ab96f960 100644 --- a/traefik/templates/pvc.yaml +++ b/traefik/templates/pvc.yaml @@ -20,4 +20,7 @@ spec: {{- if .Values.persistence.storageClass }} storageClassName: {{ .Values.persistence.storageClass | quote }} {{- end }} + {{- if .Values.persistence.volumeName }} + volumeName: {{ .Values.persistence.volumeName | quote }} + {{- end }} {{- end -}} diff --git a/traefik/tests/pvc-config_test.yaml b/traefik/tests/pvc-config_test.yaml new file mode 100644 index 000000000..ccc93c055 --- /dev/null +++ b/traefik/tests/pvc-config_test.yaml @@ -0,0 +1,20 @@ +suite: Persistent volume claim configuration +templates: + - pvc.yaml +tests: + - it: should have no volumeName by default + set: + persistence: + enabled: true + asserts: + - isNull: + path: spec.volumeName + - it: should have a volumeName when specified via values + set: + persistence: + enabled: true + volumeName: traefik + asserts: + - equal: + path: spec.volumeName + value: traefik diff --git a/traefik/values.yaml b/traefik/values.yaml index 7481e3e26..cadc7a6ae 100644 --- a/traefik/values.yaml +++ b/traefik/values.yaml @@ -752,6 +752,7 @@ persistence: accessMode: ReadWriteOnce size: 128Mi # storageClass: "" + # volumeName: "" path: /data annotations: {} # subPath: "" # only mount a subpath of the Volume into the pod