Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: make data volume configurable #2022

Merged
merged 1 commit into from
Aug 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -247,6 +247,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 @@ -543,6 +543,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 @@ -1225,6 +1225,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 @@ -321,6 +321,7 @@ controlPlane:
volumeClaimTemplates: []
addVolumeMounts: []
addVolumes: []
dataVolume: []
binariesVolume:
- name: binaries
emptyDir: {}
Expand Down
Loading