Skip to content
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
20 changes: 20 additions & 0 deletions pkg/volume/util/operationexecutor/node_expander.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,26 @@ func (ne *NodeExpander) expandOnPlugin() (bool, resource.Quantity, error) {
}
_, resizeErr := ne.volumePlugin.NodeExpand(ne.pluginResizeOpts)
if resizeErr != nil {
// In order to support node volume expansion for RWX volumes on different nodes,
// we bypass the check for VolumeExpansionPendingOnNode state during the pre-check
// and then directly call the NodeExpandVolume method on the plugin.
//
// However, it does not make sense where the csi driver does not support node expansion.
// We should not treat this as a failure. It is a workaround for this issue:
// https://github.com/kubernetes/kubernetes/issues/131381.
//
// For other access modes, we should not hit this state, because we will wait for
// VolumeExpansionPendingOnNode before trying to expand volume in kubelet.
// See runPreCheck() above.
//
// If volume is already expanded, then we should not retry expansion on the node if
// driver returns OperationNotSupportedError.
if volumetypes.IsOperationNotSupportedError(resizeErr) && ne.pvcAlreadyUpdated {
klog.V(4).InfoS(ne.vmt.GenerateMsgDetailed("MountVolume.NodeExpandVolume failed", "NodeExpandVolume not supported"), "pod", klog.KObj(ne.vmt.Pod))
ne.testStatus = testResponseData{assumeResizeFinished: true, resizeCalledOnPlugin: false}
return true, ne.pluginResizeOpts.NewSize, nil
}

if volumetypes.IsOperationFinishedError(resizeErr) {
var markFailedError error
ne.actualStateOfWorld.MarkVolumeExpansionFailedWithFinalError(ne.vmt.VolumeName)
Expand Down
12 changes: 12 additions & 0 deletions pkg/volume/util/operationexecutor/node_expander_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,18 @@ func TestNodeExpander(t *testing.T) {
expectFinalErrors: false,
expectedStatusSize: resource.MustParse("2G"),
},
{
name: "RWX pv.spec.cap = pvc.status.cap, resizeStatus='', desiredSize > actualSize, reize_op=unsupported",
pvc: addAccessMode(getTestPVC(volumetesting.FailWithUnSupportedVolumeName, "2G", "2G", "2G", nil), v1.ReadWriteMany),
pv: getTestPV(volumetesting.FailWithUnSupportedVolumeName, "2G"),
recoverVolumeExpansionFailure: true,
expectError: false,
expectedResizeStatus: "",
expectResizeCall: false,
assumeResizeOpAsFinished: true,
expectFinalErrors: false,
expectedStatusSize: resource.MustParse("2G"),
},
{
name: "pv.spec.cap > pvc.status.cap, resizeStatus=node_expansion_pending, featuregate=disabled",
pvc: getTestPVC("test-vol0", "2G", "1G", "2G", &nodeResizePending),
Expand Down