diff --git a/pkg/volume/util/operationexecutor/node_expander.go b/pkg/volume/util/operationexecutor/node_expander.go index b55d63bb243..fff1760d0f5 100644 --- a/pkg/volume/util/operationexecutor/node_expander.go +++ b/pkg/volume/util/operationexecutor/node_expander.go @@ -24,6 +24,7 @@ import ( clientset "k8s.io/client-go/kubernetes" "k8s.io/client-go/tools/record" "k8s.io/klog/v2" + "k8s.io/kubectl/pkg/util/storage" kevents "k8s.io/kubernetes/pkg/kubelet/events" "k8s.io/kubernetes/pkg/volume/util" volumetypes "k8s.io/kubernetes/pkg/volume/util/types" @@ -99,7 +100,7 @@ func (ne *NodeExpander) runPreCheck() bool { // last recorded size in ASOW is older. This can happen for RWX volume types. if ne.pvcStatusCap.Cmp(ne.pluginResizeOpts.NewSize) >= 0 && ne.resizeStatus == "" && - ne.hasReadWriteMany() { + storage.ContainsAccessMode(ne.pvc.Spec.AccessModes, v1.ReadWriteMany) { ne.pvcAlreadyUpdated = true return true } @@ -120,20 +121,6 @@ func (ne *NodeExpander) runPreCheck() bool { return false } -func (ne *NodeExpander) hasReadWriteMany() bool { - accessModes := ne.pvc.Spec.AccessModes - if accessModes == nil { - return false - } - - for _, mode := range accessModes { - if mode == v1.ReadWriteMany { - return true - } - } - return false -} - func (ne *NodeExpander) expandOnPlugin() (bool, resource.Quantity, error) { allowExpansion := ne.runPreCheck() if !allowExpansion { diff --git a/pkg/volume/util/operationexecutor/node_expander_test.go b/pkg/volume/util/operationexecutor/node_expander_test.go index d3ed12b673f..e95a42d5ce3 100644 --- a/pkg/volume/util/operationexecutor/node_expander_test.go +++ b/pkg/volume/util/operationexecutor/node_expander_test.go @@ -121,7 +121,7 @@ func TestNodeExpander(t *testing.T) { expectedStatusSize: resource.MustParse("2G"), }, { - name: "RWOP volumes, pv.spec.cap = pvc.status.cap, resizeStatus='', desiredSize > actualSize", + name: "RWX volumes, pv.spec.cap = pvc.status.cap, resizeStatus='', desiredSize > actualSize", pvc: addAccessMode(getTestPVC("test-vol0", "2G", "2G", "2G", nil), v1.ReadWriteMany), pv: getTestPV("test-vol0", "2G"), diff --git a/pkg/volume/util/operationexecutor/operation_generator_test.go b/pkg/volume/util/operationexecutor/operation_generator_test.go index 9d628b779ca..7bf0dabd38b 100644 --- a/pkg/volume/util/operationexecutor/operation_generator_test.go +++ b/pkg/volume/util/operationexecutor/operation_generator_test.go @@ -255,7 +255,7 @@ func TestOperationGenerator_nodeExpandVolume(t *testing.T) { actualSize: getSizeFunc("1G"), expectedResizeStatus: "", - resizeCallCount: 1, + resizeCallCount: 0, expectedStatusSize: resource.MustParse("2G"), }, { diff --git a/test/featuregates_linter/test_data/versioned_feature_list.yaml b/test/featuregates_linter/test_data/versioned_feature_list.yaml index 04636a22bb0..389acca3995 100644 --- a/test/featuregates_linter/test_data/versioned_feature_list.yaml +++ b/test/featuregates_linter/test_data/versioned_feature_list.yaml @@ -922,6 +922,10 @@ lockToDefault: false preRelease: Alpha version: "1.23" + - default: true + lockToDefault: false + preRelease: Beta + version: "1.32" - name: RecursiveReadOnlyMounts versionedSpecs: - default: false