mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-14 13:45:06 +00:00
Fix unit tests and feature gate stuff
This commit is contained in:
@@ -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 {
|
||||
|
@@ -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"),
|
||||
|
||||
|
@@ -255,7 +255,7 @@ func TestOperationGenerator_nodeExpandVolume(t *testing.T) {
|
||||
actualSize: getSizeFunc("1G"),
|
||||
|
||||
expectedResizeStatus: "",
|
||||
resizeCallCount: 1,
|
||||
resizeCallCount: 0,
|
||||
expectedStatusSize: resource.MustParse("2G"),
|
||||
},
|
||||
{
|
||||
|
@@ -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
|
||||
|
Reference in New Issue
Block a user