Fix race condition between external-resizer and kubelet

This fixes the race condition that could happen because
resize controller just finished volume expansiona and has only
finished marking PV and yet to mark PVC.

The workaround proposed here should not be necessary once
RecoverVolumeExpansionFailure goes GA/beta.
This commit is contained in:
Hemant Kumar
2024-01-31 12:23:56 -05:00
parent a9e4f5b786
commit d190fa3e7d
5 changed files with 43 additions and 3 deletions

View File

@@ -83,7 +83,8 @@ const (
SuccessAndFailOnMountDeviceName = "success-and-failed-mount-device-name"
// FailWithInUseVolumeName will cause NodeExpandVolume to result in FailedPrecondition error
FailWithInUseVolumeName = "fail-expansion-in-use"
FailWithInUseVolumeName = "fail-expansion-in-use"
FailWithUnSupportedVolumeName = "fail-expansion-unsupported"
FailVolumeExpansion = "fail-expansion-test"
@@ -500,8 +501,12 @@ func (plugin *FakeVolumePlugin) NodeExpand(resizeOptions volume.NodeResizeOption
if resizeOptions.VolumeSpec.Name() == FailWithInUseVolumeName {
return false, volumetypes.NewFailedPreconditionError("volume-in-use")
}
if resizeOptions.VolumeSpec.Name() == FailWithUnSupportedVolumeName {
return false, volumetypes.NewOperationNotSupportedError("volume-unsupported")
}
if resizeOptions.VolumeSpec.Name() == AlwaysFailNodeExpansion {
return false, fmt.Errorf("Test failure: NodeExpand")
return false, fmt.Errorf("test failure: NodeExpand")
}
if resizeOptions.VolumeSpec.Name() == FailVolumeExpansion {