mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-21 09:57:52 +00:00
Implement controller and kubelet changes for recovery from resize
failures
This commit is contained in:
@@ -85,6 +85,8 @@ const (
|
||||
|
||||
FailVolumeExpansion = "fail-expansion-test"
|
||||
|
||||
AlwaysFailNodeExpansion = "always-fail-node-expansion"
|
||||
|
||||
deviceNotMounted = "deviceNotMounted"
|
||||
deviceMountUncertain = "deviceMountUncertain"
|
||||
deviceMounted = "deviceMounted"
|
||||
@@ -178,6 +180,7 @@ type FakeVolumePlugin struct {
|
||||
LimitKey string
|
||||
ProvisionDelaySeconds int
|
||||
SupportsRemount bool
|
||||
DisableNodeExpansion bool
|
||||
|
||||
// default to false which means it is attachable by default
|
||||
NonAttachable bool
|
||||
@@ -464,13 +467,17 @@ func (plugin *FakeVolumePlugin) ExpandVolumeDevice(spec *Spec, newSize resource.
|
||||
}
|
||||
|
||||
func (plugin *FakeVolumePlugin) RequiresFSResize() bool {
|
||||
return true
|
||||
return !plugin.DisableNodeExpansion
|
||||
}
|
||||
|
||||
func (plugin *FakeVolumePlugin) NodeExpand(resizeOptions NodeResizeOptions) (bool, error) {
|
||||
if resizeOptions.VolumeSpec.Name() == FailWithInUseVolumeName {
|
||||
return false, volumetypes.NewFailedPreconditionError("volume-in-use")
|
||||
}
|
||||
if resizeOptions.VolumeSpec.Name() == AlwaysFailNodeExpansion {
|
||||
return false, fmt.Errorf("Test failure: NodeExpand")
|
||||
}
|
||||
|
||||
// Set up fakeVolumePlugin not support STAGE_UNSTAGE for testing the behavior
|
||||
// so as volume can be node published before we can resize
|
||||
if resizeOptions.CSIVolumePhase == volume.CSIVolumeStaged {
|
||||
|
Reference in New Issue
Block a user