Skip to content

Commit

Permalink
refactor: make data volume configurable
Browse files Browse the repository at this point in the history
(cherry picked from commit 2d0de1c)
  • Loading branch information
FabianKramm committed Aug 5, 2024
1 parent 201026d commit 4514cad
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 1 deletion.
4 changes: 3 additions & 1 deletion chart/templates/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
17 changes: 17 additions & 0 deletions chart/tests/statefulset_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
7 changes: 7 additions & 0 deletions chart/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 2 additions & 0 deletions chart/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
3 changes: 3 additions & 0 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
1 change: 1 addition & 0 deletions config/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,7 @@ controlPlane:
volumeClaimTemplates: []
addVolumeMounts: []
addVolumes: []
dataVolume: []
binariesVolume:
- name: binaries
emptyDir: {}
Expand Down

0 comments on commit 4514cad

Please sign in to comment.