mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 19:56:01 +00:00
Merge pull request #131524 from carlory/automated-cherry-pick-of-#131495-release-1.32
Automated cherry pick of #131495: Handle unsupported node expansion for RWX volumes
This commit is contained in:
commit
3f75cae603
@ -144,6 +144,26 @@ func (ne *NodeExpander) expandOnPlugin() (bool, resource.Quantity, error) {
|
|||||||
}
|
}
|
||||||
_, resizeErr := ne.volumePlugin.NodeExpand(ne.pluginResizeOpts)
|
_, resizeErr := ne.volumePlugin.NodeExpand(ne.pluginResizeOpts)
|
||||||
if resizeErr != nil {
|
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) {
|
if volumetypes.IsOperationFinishedError(resizeErr) {
|
||||||
var markFailedError error
|
var markFailedError error
|
||||||
ne.actualStateOfWorld.MarkVolumeExpansionFailedWithFinalError(ne.vmt.VolumeName)
|
ne.actualStateOfWorld.MarkVolumeExpansionFailedWithFinalError(ne.vmt.VolumeName)
|
||||||
|
@ -151,6 +151,17 @@ func TestNodeExpander(t *testing.T) {
|
|||||||
expectFinalErrors: false,
|
expectFinalErrors: false,
|
||||||
expectedStatusSize: resource.MustParse("2G"),
|
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"),
|
||||||
|
expectError: false,
|
||||||
|
expectedResizeStatus: "",
|
||||||
|
expectResizeCall: false,
|
||||||
|
assumeResizeOpAsFinished: true,
|
||||||
|
expectFinalErrors: false,
|
||||||
|
expectedStatusSize: resource.MustParse("2G"),
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
for i := range tests {
|
for i := range tests {
|
||||||
|
Loading…
Reference in New Issue
Block a user