Fix unit tests and feature gate stuff

This commit is contained in:
Hemant Kumar
2024-10-28 16:04:54 -04:00
parent a9d71bd6e6
commit 2d58d4ef52
4 changed files with 8 additions and 17 deletions

View File

@@ -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 {

View File

@@ -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"),

View File

@@ -255,7 +255,7 @@ func TestOperationGenerator_nodeExpandVolume(t *testing.T) {
actualSize: getSizeFunc("1G"),
expectedResizeStatus: "",
resizeCallCount: 1,
resizeCallCount: 0,
expectedStatusSize: resource.MustParse("2G"),
},
{

View File

@@ -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