Skip to content

Commit 4ae3f90

Browse files
committedJan 16, 2024
[Enhancement] Remove PVC when storageSize is zero
Signed-off-by: yandongxiao <[email protected]>
1 parent 0695544 commit 4ae3f90

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed
 

‎pkg/k8sutils/templates/pod/mount.go

+3
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ func MountStorageVolumes(spec v1.SpecInterface) ([]corev1.Volume, []corev1.Volum
2323
var volumeMounts []corev1.VolumeMount
2424
vexist := make(map[string]bool)
2525
for _, sv := range spec.GetStorageVolumes() {
26+
if sv.StorageSize == "0" {
27+
continue
28+
}
2629
vexist[sv.MountPath] = true
2730
if IsSpecialStorageClass(sv.StorageClassName) {
2831
volumes, volumeMounts = MountEmptyDirVolume(volumes, volumeMounts, sv.Name, sv.MountPath, sv.SubPath)

‎pkg/k8sutils/templates/statefulset/spec.go

+3
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ func PVCList(volumes []v1.StorageVolume) []corev1.PersistentVolumeClaim {
3636
if pod.IsSpecialStorageClass(vm.StorageClassName) {
3737
continue
3838
}
39+
if vm.StorageSize == "0" {
40+
continue
41+
}
3942
pvc := corev1.PersistentVolumeClaim{
4043
ObjectMeta: metav1.ObjectMeta{Name: vm.Name},
4144
Spec: corev1.PersistentVolumeClaimSpec{

0 commit comments

Comments
 (0)