From 7fd97433f0c95940e5f828116d3467b857478687 Mon Sep 17 00:00:00 2001 From: Davanum Srinivas Date: Thu, 9 Dec 2021 13:34:47 -0500 Subject: [PATCH] Next step in CSI migration for openstack delete/modify tests that use intree cinder as well. Signed-off-by: Davanum Srinivas --- pkg/features/kube_features.go | 2 +- .../plugins/nodevolumelimits/non_csi_test.go | 70 +------------------ .../plugins/nodevolumelimits/utils.go | 4 +- .../framework/plugins/volumebinding/binder.go | 2 +- pkg/volume/csi/csi_plugin.go | 2 +- pkg/volume/csimigration/plugin_manager.go | 2 +- 6 files changed, 7 insertions(+), 75 deletions(-) diff --git a/pkg/features/kube_features.go b/pkg/features/kube_features.go index 433cf48939c..7158f5307ea 100644 --- a/pkg/features/kube_features.go +++ b/pkg/features/kube_features.go @@ -869,7 +869,7 @@ var defaultKubernetesFeatureGates = map[featuregate.Feature]featuregate.FeatureS InTreePluginAzureFileUnregister: {Default: false, PreRelease: featuregate.Alpha}, CSIMigrationvSphere: {Default: false, PreRelease: featuregate.Beta}, // Off by default (requires vSphere CSI driver) InTreePluginvSphereUnregister: {Default: false, PreRelease: featuregate.Alpha}, - CSIMigrationOpenStack: {Default: true, PreRelease: featuregate.Beta}, + CSIMigrationOpenStack: {Default: true, PreRelease: featuregate.GA, LockToDefault: true}, // remove in 1.26 InTreePluginOpenStackUnregister: {Default: false, PreRelease: featuregate.Alpha}, CSIMigrationRBD: {Default: false, PreRelease: featuregate.Alpha}, // Off by default (requires RBD CSI driver) InTreePluginRBDUnregister: {Default: false, PreRelease: featuregate.Alpha}, diff --git a/pkg/scheduler/framework/plugins/nodevolumelimits/non_csi_test.go b/pkg/scheduler/framework/plugins/nodevolumelimits/non_csi_test.go index 52f0942afa9..ebf2a504ab2 100644 --- a/pkg/scheduler/framework/plugins/nodevolumelimits/non_csi_test.go +++ b/pkg/scheduler/framework/plugins/nodevolumelimits/non_csi_test.go @@ -35,8 +35,8 @@ import ( func TestEphemeralLimits(t *testing.T) { // We have to specify a valid filter and arbitrarily pick Cinder here. // It doesn't matter for the test cases. - filterName := cinderVolumeFilterType - driverName := csilibplugins.CinderInTreePluginName + filterName := gcePDVolumeFilterType + driverName := csilibplugins.GCEPDInTreePluginName ephemeralVolumePod := &v1.Pod{ ObjectMeta: metav1.ObjectMeta{ @@ -467,72 +467,6 @@ func TestAzureDiskLimits(t *testing.T) { } } -func TestCinderLimits(t *testing.T) { - twoVolCinderPod := &v1.Pod{ - Spec: v1.PodSpec{ - Volumes: []v1.Volume{ - { - VolumeSource: v1.VolumeSource{ - Cinder: &v1.CinderVolumeSource{VolumeID: "tvp1"}, - }, - }, - { - VolumeSource: v1.VolumeSource{ - Cinder: &v1.CinderVolumeSource{VolumeID: "tvp2"}, - }, - }, - }, - }, - } - oneVolCinderPod := &v1.Pod{ - Spec: v1.PodSpec{ - Volumes: []v1.Volume{ - { - VolumeSource: v1.VolumeSource{ - Cinder: &v1.CinderVolumeSource{VolumeID: "ovp"}, - }, - }, - }, - }, - } - - tests := []struct { - newPod *v1.Pod - existingPods []*v1.Pod - filterName string - driverName string - maxVols int - test string - wantStatus *framework.Status - }{ - { - newPod: oneVolCinderPod, - existingPods: []*v1.Pod{twoVolCinderPod}, - filterName: cinderVolumeFilterType, - maxVols: 4, - test: "fits when node capacity >= new pod's Cinder volumes", - }, - { - newPod: oneVolCinderPod, - existingPods: []*v1.Pod{twoVolCinderPod}, - filterName: cinderVolumeFilterType, - maxVols: 2, - test: "not fit when node capacity < new pod's Cinder volumes", - wantStatus: framework.NewStatus(framework.Unschedulable, ErrReasonMaxVolumeCountExceeded), - }, - } - - for _, test := range tests { - t.Run(test.test, func(t *testing.T) { - node, csiNode := getNodeWithPodAndVolumeLimits("node", test.existingPods, int64(test.maxVols), test.filterName) - p := newNonCSILimits(test.filterName, getFakeCSINodeLister(csiNode), getFakeCSIStorageClassLister(test.filterName, test.driverName), getFakePVLister(test.filterName), getFakePVCLister(test.filterName), feature.Features{}).(framework.FilterPlugin) - gotStatus := p.Filter(context.Background(), nil, test.newPod, node) - if !reflect.DeepEqual(gotStatus, test.wantStatus) { - t.Errorf("status does not match: %v, want: %v", gotStatus, test.wantStatus) - } - }) - } -} func TestEBSLimits(t *testing.T) { oneVolPod := &v1.Pod{ Spec: v1.PodSpec{ diff --git a/pkg/scheduler/framework/plugins/nodevolumelimits/utils.go b/pkg/scheduler/framework/plugins/nodevolumelimits/utils.go index 6796c2129a9..665f2cb2f7a 100644 --- a/pkg/scheduler/framework/plugins/nodevolumelimits/utils.go +++ b/pkg/scheduler/framework/plugins/nodevolumelimits/utils.go @@ -60,9 +60,7 @@ func isCSIMigrationOn(csiNode *storagev1.CSINode, pluginName string) bool { return false } case csilibplugins.CinderInTreePluginName: - if !utilfeature.DefaultFeatureGate.Enabled(features.CSIMigrationOpenStack) { - return false - } + return true case csilibplugins.RBDVolumePluginName: if !utilfeature.DefaultFeatureGate.Enabled(features.CSIMigrationRBD) { return false diff --git a/pkg/scheduler/framework/plugins/volumebinding/binder.go b/pkg/scheduler/framework/plugins/volumebinding/binder.go index ee4989be0b7..df1000e8e37 100644 --- a/pkg/scheduler/framework/plugins/volumebinding/binder.go +++ b/pkg/scheduler/framework/plugins/volumebinding/binder.go @@ -1024,7 +1024,7 @@ func isCSIMigrationOnForPlugin(pluginName string) bool { case csiplugins.AzureDiskInTreePluginName: return utilfeature.DefaultFeatureGate.Enabled(features.CSIMigrationAzureDisk) case csiplugins.CinderInTreePluginName: - return utilfeature.DefaultFeatureGate.Enabled(features.CSIMigrationOpenStack) + return true case csiplugins.PortworxVolumePluginName: return utilfeature.DefaultFeatureGate.Enabled(features.CSIMigrationPortworx) case csiplugins.RBDVolumePluginName: diff --git a/pkg/volume/csi/csi_plugin.go b/pkg/volume/csi/csi_plugin.go index 0ae6d084f0e..3b0a5773e58 100644 --- a/pkg/volume/csi/csi_plugin.go +++ b/pkg/volume/csi/csi_plugin.go @@ -223,7 +223,7 @@ func (p *csiPlugin) Init(host volume.VolumeHost) error { return utilfeature.DefaultFeatureGate.Enabled(features.CSIMigration) && utilfeature.DefaultFeatureGate.Enabled(features.CSIMigrationAWS) }, csitranslationplugins.CinderInTreePluginName: func() bool { - return utilfeature.DefaultFeatureGate.Enabled(features.CSIMigration) && utilfeature.DefaultFeatureGate.Enabled(features.CSIMigrationOpenStack) + return utilfeature.DefaultFeatureGate.Enabled(features.CSIMigration) }, csitranslationplugins.AzureDiskInTreePluginName: func() bool { return utilfeature.DefaultFeatureGate.Enabled(features.CSIMigration) && utilfeature.DefaultFeatureGate.Enabled(features.CSIMigrationAzureDisk) diff --git a/pkg/volume/csimigration/plugin_manager.go b/pkg/volume/csimigration/plugin_manager.go index ef83fbbb97c..45acd1997e3 100644 --- a/pkg/volume/csimigration/plugin_manager.go +++ b/pkg/volume/csimigration/plugin_manager.go @@ -99,7 +99,7 @@ func (pm PluginManager) IsMigrationEnabledForPlugin(pluginName string) bool { case csilibplugins.AzureDiskInTreePluginName: return pm.featureGate.Enabled(features.CSIMigrationAzureDisk) case csilibplugins.CinderInTreePluginName: - return pm.featureGate.Enabled(features.CSIMigrationOpenStack) + return true case csilibplugins.VSphereInTreePluginName: return pm.featureGate.Enabled(features.CSIMigrationvSphere) case csilibplugins.PortworxVolumePluginName: