@@ -144,6 +144,26 @@ func (ne *NodeExpander) expandOnPlugin() (bool, resource.Quantity, error) {
144
144
}
145
145
_ , resizeErr := ne .volumePlugin .NodeExpand (ne .pluginResizeOpts )
146
146
if resizeErr != nil {
147
+ // In order to support node volume expansion for RWX volumes on different nodes,
148
+ // we bypass the check for VolumeExpansionPendingOnNode state during the pre-check
149
+ // and then directly call the NodeExpandVolume method on the plugin.
150
+ //
151
+ // However, it does not make sense where the csi driver does not support node expansion.
152
+ // We should not treat this as a failure. It is a workaround for this issue:
153
+ // https://github.com/kubernetes/kubernetes/issues/131381.
154
+ //
155
+ // For other access modes, we should not hit this state, because we will wait for
156
+ // VolumeExpansionPendingOnNode before trying to expand volume in kubelet.
157
+ // See runPreCheck() above.
158
+ //
159
+ // If volume is already expanded, then we should not retry expansion on the node if
160
+ // driver returns OperationNotSupportedError.
161
+ if volumetypes .IsOperationNotSupportedError (resizeErr ) && ne .pvcAlreadyUpdated {
162
+ klog .V (4 ).InfoS (ne .vmt .GenerateMsgDetailed ("MountVolume.NodeExpandVolume failed" , "NodeExpandVolume not supported" ), "pod" , klog .KObj (ne .vmt .Pod ))
163
+ ne .testStatus = testResponseData {assumeResizeFinished : true , resizeCalledOnPlugin : false }
164
+ return true , ne .pluginResizeOpts .NewSize , nil
165
+ }
166
+
147
167
if volumetypes .IsOperationFinishedError (resizeErr ) {
148
168
var markFailedError error
149
169
ne .actualStateOfWorld .MarkVolumeExpansionFailedWithFinalError (ne .vmt .VolumeName )
0 commit comments