diff --git a/chart/templates/statefulset.yaml b/chart/templates/statefulset.yaml index 2a49b35b2..8707bbcc6 100644 --- a/chart/templates/statefulset.yaml +++ b/chart/templates/statefulset.yaml @@ -117,7 +117,9 @@ spec: # name: coredns-custom # optional: true {{- end }} - {{- if not (include "vcluster.persistence.volumeClaim.enabled" .) }} + {{- if .Values.controlPlane.statefulSet.persistence.dataVolume }} +{{ toYaml .Values.controlPlane.statefulSet.persistence.dataVolume | indent 8 }} + {{- else if not (include "vcluster.persistence.volumeClaim.enabled" .) }} - name: data emptyDir: {} {{- end }} diff --git a/chart/tests/statefulset_test.yaml b/chart/tests/statefulset_test.yaml index b7e86c8a7..385bcb699 100644 --- a/chart/tests/statefulset_test.yaml +++ b/chart/tests/statefulset_test.yaml @@ -559,3 +559,20 @@ tests: name: binaries persistentVolumeClaim: claimName: my-pvc + + - it: dataVolume - should set the specified data volume type correctly + set: + controlPlane: + statefulSet: + persistence: + dataVolume: + - name: data + persistentVolumeClaim: + claimName: my-custom-pvc + asserts: + - contains: + path: spec.template.spec.volumes + content: + name: data + persistentVolumeClaim: + claimName: my-custom-pvc diff --git a/chart/values.schema.json b/chart/values.schema.json index 6bf52864d..04a201b9a 100755 --- a/chart/values.schema.json +++ b/chart/values.schema.json @@ -217,6 +217,13 @@ "type": "array", "description": "VolumeClaimTemplates defines the volumeClaimTemplates for the statefulSet" }, + "dataVolume": { + "items": { + "type": "object" + }, + "type": "array", + "description": "Allows you to override the dataVolume. Only works correctly if volumeClaim.enabled=false." + }, "binariesVolume": { "items": { "type": "object" diff --git a/chart/values.yaml b/chart/values.yaml index 5837fc623..de3f2e1a6 100644 --- a/chart/values.yaml +++ b/chart/values.yaml @@ -554,6 +554,8 @@ controlPlane: addVolumeMounts: [] # AddVolumes defines extra volumes for the pod addVolumes: [] + # Allows you to override the dataVolume. Only works correctly if volumeClaim.enabled=false. + dataVolume: [] # BinariesVolume defines a binaries volume that is used to retrieve # distro specific executables to be run by the syncer controller. # This volume doesn't need to be persistent. diff --git a/config/config.go b/config/config.go index 09b80edbc..53d3d1fa4 100644 --- a/config/config.go +++ b/config/config.go @@ -1173,6 +1173,9 @@ type ControlPlanePersistence struct { // VolumeClaimTemplates defines the volumeClaimTemplates for the statefulSet VolumeClaimTemplates []map[string]interface{} `json:"volumeClaimTemplates,omitempty"` + // Allows you to override the dataVolume. Only works correctly if volumeClaim.enabled=false. + DataVolume []map[string]interface{} `json:"dataVolume,omitempty"` + // BinariesVolume defines a binaries volume that is used to retrieve // distro specific executables to be run by the syncer controller. // This volume doesn't need to be persistent. diff --git a/config/values.yaml b/config/values.yaml index b82217971..87b45cf1d 100644 --- a/config/values.yaml +++ b/config/values.yaml @@ -327,6 +327,7 @@ controlPlane: volumeClaimTemplates: [] addVolumeMounts: [] addVolumes: [] + dataVolume: [] binariesVolume: - name: binaries emptyDir: {}