mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 11:50:44 +00:00
Remove legacyCallNodeExpandOnPlugin when RecoverVolumeExpansionFailure
This commit is contained in:
parent
7a43406138
commit
4d52dbb9f8
@ -1161,57 +1161,9 @@ func Test_Run_Positive_VolumeFSResizeControllerAttachEnabled(t *testing.T) {
|
|||||||
|
|
||||||
for _, tc := range tests {
|
for _, tc := range tests {
|
||||||
t.Run(tc.name, func(t *testing.T) {
|
t.Run(tc.name, func(t *testing.T) {
|
||||||
pv := &v1.PersistentVolume{
|
pv := getTestPV(tc.pvName, tc.volumeMode, tc.oldPVSize)
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
pvc := getTestPVC("pv", tc.volumeMode, tc.pvcSize, tc.pvcStatusSize)
|
||||||
Name: tc.pvName,
|
pod := getTestPod(pvc.Name)
|
||||||
UID: "pvuid",
|
|
||||||
},
|
|
||||||
Spec: v1.PersistentVolumeSpec{
|
|
||||||
ClaimRef: &v1.ObjectReference{Name: "pvc"},
|
|
||||||
VolumeMode: tc.volumeMode,
|
|
||||||
Capacity: v1.ResourceList{
|
|
||||||
v1.ResourceStorage: tc.oldPVSize,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
pvc := &v1.PersistentVolumeClaim{
|
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
|
||||||
Name: "pvc",
|
|
||||||
UID: "pvcuid",
|
|
||||||
},
|
|
||||||
Spec: v1.PersistentVolumeClaimSpec{
|
|
||||||
Resources: v1.ResourceRequirements{
|
|
||||||
Requests: v1.ResourceList{
|
|
||||||
v1.ResourceStorage: tc.pvcSize,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
VolumeName: "pv",
|
|
||||||
VolumeMode: tc.volumeMode,
|
|
||||||
},
|
|
||||||
Status: v1.PersistentVolumeClaimStatus{
|
|
||||||
Capacity: v1.ResourceList{
|
|
||||||
v1.ResourceStorage: tc.pvcStatusSize,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
pod := &v1.Pod{
|
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
|
||||||
Name: "pod1",
|
|
||||||
UID: "pod1uid",
|
|
||||||
},
|
|
||||||
Spec: v1.PodSpec{
|
|
||||||
Volumes: []v1.Volume{
|
|
||||||
{
|
|
||||||
Name: "volume-name",
|
|
||||||
VolumeSource: v1.VolumeSource{
|
|
||||||
PersistentVolumeClaim: &v1.PersistentVolumeClaimVolumeSource{
|
|
||||||
ClaimName: pvc.Name,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
// deep copy before reconciler runs to avoid data race.
|
// deep copy before reconciler runs to avoid data race.
|
||||||
pvWithSize := pv.DeepCopy()
|
pvWithSize := pv.DeepCopy()
|
||||||
@ -1284,6 +1236,7 @@ func Test_Run_Positive_VolumeFSResizeControllerAttachEnabled(t *testing.T) {
|
|||||||
pvWithSize.Spec.Capacity[v1.ResourceStorage] = tc.newPVSize
|
pvWithSize.Spec.Capacity[v1.ResourceStorage] = tc.newPVSize
|
||||||
volumeSpec = &volume.Spec{PersistentVolume: pvWithSize}
|
volumeSpec = &volume.Spec{PersistentVolume: pvWithSize}
|
||||||
dsw.AddPodToVolume(podName, pod, volumeSpec, volumeSpec.Name(), "" /* volumeGidValue */)
|
dsw.AddPodToVolume(podName, pod, volumeSpec, volumeSpec.Name(), "" /* volumeGidValue */)
|
||||||
|
|
||||||
t.Logf("Changing size of the volume to %s", tc.newPVSize.String())
|
t.Logf("Changing size of the volume to %s", tc.newPVSize.String())
|
||||||
newSize := tc.newPVSize.DeepCopy()
|
newSize := tc.newPVSize.DeepCopy()
|
||||||
dsw.UpdatePersistentVolumeSize(volumeName, &newSize)
|
dsw.UpdatePersistentVolumeSize(volumeName, &newSize)
|
||||||
@ -1312,6 +1265,69 @@ func Test_Run_Positive_VolumeFSResizeControllerAttachEnabled(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func getTestPVC(pvName string, volumeMode *v1.PersistentVolumeMode, specSize, statusSize resource.Quantity) *v1.PersistentVolumeClaim {
|
||||||
|
pvc := &v1.PersistentVolumeClaim{
|
||||||
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
|
Name: "pvc",
|
||||||
|
UID: "pvcuid",
|
||||||
|
},
|
||||||
|
Spec: v1.PersistentVolumeClaimSpec{
|
||||||
|
Resources: v1.ResourceRequirements{
|
||||||
|
Requests: v1.ResourceList{
|
||||||
|
v1.ResourceStorage: specSize,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
VolumeName: pvName,
|
||||||
|
VolumeMode: volumeMode,
|
||||||
|
},
|
||||||
|
Status: v1.PersistentVolumeClaimStatus{
|
||||||
|
Capacity: v1.ResourceList{
|
||||||
|
v1.ResourceStorage: statusSize,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
return pvc
|
||||||
|
}
|
||||||
|
|
||||||
|
func getTestPV(pvName string, volumeMode *v1.PersistentVolumeMode, pvSize resource.Quantity) *v1.PersistentVolume {
|
||||||
|
pv := &v1.PersistentVolume{
|
||||||
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
|
Name: pvName,
|
||||||
|
UID: "pvuid",
|
||||||
|
},
|
||||||
|
Spec: v1.PersistentVolumeSpec{
|
||||||
|
ClaimRef: &v1.ObjectReference{Name: "pvc"},
|
||||||
|
VolumeMode: volumeMode,
|
||||||
|
Capacity: v1.ResourceList{
|
||||||
|
v1.ResourceStorage: pvSize,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
return pv
|
||||||
|
}
|
||||||
|
|
||||||
|
func getTestPod(claimName string) *v1.Pod {
|
||||||
|
pod := &v1.Pod{
|
||||||
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
|
Name: "pod1",
|
||||||
|
UID: "pod1uid",
|
||||||
|
},
|
||||||
|
Spec: v1.PodSpec{
|
||||||
|
Volumes: []v1.Volume{
|
||||||
|
{
|
||||||
|
Name: "volume-name",
|
||||||
|
VolumeSource: v1.VolumeSource{
|
||||||
|
PersistentVolumeClaim: &v1.PersistentVolumeClaimVolumeSource{
|
||||||
|
ClaimName: claimName,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
return pod
|
||||||
|
}
|
||||||
|
|
||||||
func Test_UncertainDeviceGlobalMounts(t *testing.T) {
|
func Test_UncertainDeviceGlobalMounts(t *testing.T) {
|
||||||
var tests = []struct {
|
var tests = []struct {
|
||||||
name string
|
name string
|
||||||
|
@ -2142,6 +2142,7 @@ func (og *operationGenerator) nodeExpandVolume(
|
|||||||
|
|
||||||
// legacyCallNodeExpandOnPlugin is old version of calling node expansion on plugin, which does not support
|
// legacyCallNodeExpandOnPlugin is old version of calling node expansion on plugin, which does not support
|
||||||
// recovery from volume expansion failure
|
// recovery from volume expansion failure
|
||||||
|
// TODO: Removing this code when RecoverVolumeExpansionFailure feature goes GA.
|
||||||
func (og *operationGenerator) legacyCallNodeExpandOnPlugin(resizeOp nodeResizeOperationOpts) (bool, error) {
|
func (og *operationGenerator) legacyCallNodeExpandOnPlugin(resizeOp nodeResizeOperationOpts) (bool, error) {
|
||||||
pvc := resizeOp.pvc
|
pvc := resizeOp.pvc
|
||||||
volumeToMount := resizeOp.vmt
|
volumeToMount := resizeOp.vmt
|
||||||
|
Loading…
Reference in New Issue
Block a user