diff --git a/cmd/kube-controller-manager/app/plugins.go b/cmd/kube-controller-manager/app/plugins.go index 3ed1e35120b..f68e5c5404d 100644 --- a/cmd/kube-controller-manager/app/plugins.go +++ b/cmd/kube-controller-manager/app/plugins.go @@ -35,7 +35,6 @@ import ( "k8s.io/kubernetes/pkg/volume/nfs" volumeutil "k8s.io/kubernetes/pkg/volume/util" - utilfeature "k8s.io/apiserver/pkg/util/feature" persistentvolumeconfig "k8s.io/kubernetes/pkg/controller/volume/persistentvolume/config" "k8s.io/utils/exec" ) @@ -124,12 +123,6 @@ func probeControllerVolumePlugins(logger klog.Logger, config persistentvolumecon allPlugins = append(allPlugins, iscsi.ProbeVolumePlugins()...) allPlugins = append(allPlugins, csi.ProbeVolumePlugins()...) - var err error - allPlugins, err = appendLegacyControllerProviders(logger, allPlugins, utilfeature.DefaultFeatureGate) - if err != nil { - return allPlugins, err - } - var filteredPlugins []volume.VolumePlugin if filter == nil { filteredPlugins = allPlugins diff --git a/cmd/kube-controller-manager/app/plugins_providers.go b/cmd/kube-controller-manager/app/plugins_providers.go deleted file mode 100644 index e76167242d3..00000000000 --- a/cmd/kube-controller-manager/app/plugins_providers.go +++ /dev/null @@ -1,65 +0,0 @@ -/* -Copyright 2019 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package app - -import ( - "k8s.io/component-base/featuregate" - "k8s.io/csi-translation-lib/plugins" - "k8s.io/klog/v2" - "k8s.io/kubernetes/pkg/features" - "k8s.io/kubernetes/pkg/volume" - "k8s.io/kubernetes/pkg/volume/csimigration" - "k8s.io/kubernetes/pkg/volume/portworx" -) - -type probeFn func() []volume.VolumePlugin - -func appendPluginBasedOnFeatureFlags(logger klog.Logger, plugins []volume.VolumePlugin, inTreePluginName string, featureGate featuregate.FeatureGate, pluginInfo pluginInfo) ([]volume.VolumePlugin, error) { - _, err := csimigration.CheckMigrationFeatureFlags(featureGate, pluginInfo.pluginMigrationFeature, pluginInfo.pluginUnregisterFeature) - if err != nil { - logger.Error(err, "Unexpected CSI Migration Feature Flags combination detected. CSI Migration may not take effect") - return nil, err - } - - // Skip appending the in-tree plugin to the list of plugins to be probed/initialized - // if the plugin unregister feature flag is set - if featureGate.Enabled(pluginInfo.pluginUnregisterFeature) { - logger.Info("Skip registration of plugin since feature flag is enabled", "plugin", inTreePluginName, "feature", pluginInfo.pluginUnregisterFeature) - return plugins, nil - } - plugins = append(plugins, pluginInfo.pluginProbeFunction()...) - return plugins, nil -} - -type pluginInfo struct { - pluginMigrationFeature featuregate.Feature - pluginUnregisterFeature featuregate.Feature - pluginProbeFunction probeFn -} - -func appendLegacyControllerProviders(logger klog.Logger, allPlugins []volume.VolumePlugin, featureGate featuregate.FeatureGate) ([]volume.VolumePlugin, error) { - pluginMigrationStatus := make(map[string]pluginInfo) - pluginMigrationStatus[plugins.PortworxVolumePluginName] = pluginInfo{pluginMigrationFeature: features.CSIMigrationPortworx, pluginUnregisterFeature: features.InTreePluginPortworxUnregister, pluginProbeFunction: portworx.ProbeVolumePlugins} - var err error - for pluginName, pluginInfo := range pluginMigrationStatus { - allPlugins, err = appendPluginBasedOnFeatureFlags(logger, allPlugins, pluginName, featureGate, pluginInfo) - if err != nil { - return allPlugins, err - } - } - return allPlugins, nil -} diff --git a/cmd/kube-controller-manager/app/plugins_test.go b/cmd/kube-controller-manager/app/plugins_test.go index 219a96d8d14..e42611dc40a 100644 --- a/cmd/kube-controller-manager/app/plugins_test.go +++ b/cmd/kube-controller-manager/app/plugins_test.go @@ -53,7 +53,7 @@ func TestProbeExpandableVolumePlugins(t *testing.T) { if err != nil { t.Fatalf("TestProbeExpandableVolumePlugins failed: %s", err) } - checkPlugins(t, plugins, []string{"kubernetes.io/portworx-volume"}) + checkPlugins(t, plugins, []string{}) } func TestProbeControllerVolumePlugins(t *testing.T) { @@ -62,7 +62,7 @@ func TestProbeControllerVolumePlugins(t *testing.T) { if err != nil { t.Fatalf("ProbeControllerVolumePlugins failed: %s", err) } - checkPlugins(t, plugins, []string{"kubernetes.io/host-path", "kubernetes.io/nfs", "kubernetes.io/portworx-volume"}) + checkPlugins(t, plugins, []string{"kubernetes.io/host-path", "kubernetes.io/nfs"}) } func getConfig() persistentvolumeconfig.VolumeConfiguration { diff --git a/cmd/kubelet/app/plugins.go b/cmd/kubelet/app/plugins.go index ba40088dfe0..573b5f7f2ee 100644 --- a/cmd/kubelet/app/plugins.go +++ b/cmd/kubelet/app/plugins.go @@ -52,11 +52,6 @@ func ProbeVolumePlugins(ctx context.Context, featureGate featuregate.FeatureGate // // Kubelet does not currently need to configure volume plugins. // If/when it does, see kube-controller-manager/app/plugins.go for example of using volume.VolumeConfig - var err error - allPlugins, err = appendLegacyProviderVolumes(ctx, allPlugins, featureGate) - if err != nil { - return allPlugins, err - } allPlugins = append(allPlugins, emptydir.ProbeVolumePlugins()...) allPlugins = append(allPlugins, git_repo.ProbeVolumePlugins()...) allPlugins = append(allPlugins, hostpath.ProbeVolumePlugins(volume.VolumeConfig{})...) diff --git a/cmd/kubelet/app/plugins_providers.go b/cmd/kubelet/app/plugins_providers.go deleted file mode 100644 index 8fdde49a848..00000000000 --- a/cmd/kubelet/app/plugins_providers.go +++ /dev/null @@ -1,70 +0,0 @@ -/* -Copyright 2019 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package app - -import ( - "context" - - "k8s.io/component-base/featuregate" - "k8s.io/csi-translation-lib/plugins" - "k8s.io/klog/v2" - "k8s.io/kubernetes/pkg/features" - "k8s.io/kubernetes/pkg/volume" - "k8s.io/kubernetes/pkg/volume/csimigration" - "k8s.io/kubernetes/pkg/volume/portworx" -) - -type probeFn func() []volume.VolumePlugin - -func appendPluginBasedOnFeatureFlags(ctx context.Context, plugins []volume.VolumePlugin, inTreePluginName string, - featureGate featuregate.FeatureGate, pluginInfo pluginInfo) ([]volume.VolumePlugin, error) { - logger := klog.FromContext(ctx) - _, err := csimigration.CheckMigrationFeatureFlags(featureGate, pluginInfo.pluginMigrationFeature, pluginInfo.pluginUnregisterFeature) - if err != nil { - logger.Info("Unexpected CSI Migration Feature Flags combination detected, CSI Migration may not take effect", "err", err) - // TODO: fail and return here once alpha only tests can set the feature flags for a plugin correctly - } - - // Skip appending the in-tree plugin to the list of plugins to be probed/initialized - // if the plugin unregister feature flag is set - if featureGate.Enabled(pluginInfo.pluginUnregisterFeature) { - logger.Info("Skipped registration of plugin since feature flag is enabled", "pluginName", inTreePluginName, "featureFlag", pluginInfo.pluginUnregisterFeature) - return plugins, nil - } - - plugins = append(plugins, pluginInfo.pluginProbeFunction()...) - return plugins, nil -} - -type pluginInfo struct { - pluginMigrationFeature featuregate.Feature - pluginUnregisterFeature featuregate.Feature - pluginProbeFunction probeFn -} - -func appendLegacyProviderVolumes(ctx context.Context, allPlugins []volume.VolumePlugin, featureGate featuregate.FeatureGate) ([]volume.VolumePlugin, error) { - pluginMigrationStatus := make(map[string]pluginInfo) - pluginMigrationStatus[plugins.PortworxVolumePluginName] = pluginInfo{pluginMigrationFeature: features.CSIMigrationPortworx, pluginUnregisterFeature: features.InTreePluginPortworxUnregister, pluginProbeFunction: portworx.ProbeVolumePlugins} - var err error - for pluginName, pluginInfo := range pluginMigrationStatus { - allPlugins, err = appendPluginBasedOnFeatureFlags(ctx, allPlugins, pluginName, featureGate, pluginInfo) - if err != nil { - return allPlugins, err - } - } - return allPlugins, nil -} diff --git a/pkg/features/kube_features.go b/pkg/features/kube_features.go index 4ee0aa6386b..c5c68609263 100644 --- a/pkg/features/kube_features.go +++ b/pkg/features/kube_features.go @@ -110,12 +110,6 @@ const ( // Allow the usage of options to fine-tune the cpumanager policies. CPUManagerPolicyOptions featuregate.Feature = "CPUManagerPolicyOptions" - // owner: @trierra - // kep: http://kep.k8s.io/2589 - // - // Enables the Portworx in-tree driver to Portworx migration feature. - CSIMigrationPortworx featuregate.Feature = "CSIMigrationPortworx" - // owner: @aramase // kep: http://kep.k8s.io/5538 // @@ -427,11 +421,6 @@ const ( // Applies only in nodes with InPlacePodVerticalScaling and Memory Manager features enabled. InPlacePodVerticalScalingExclusiveMemory featuregate.Feature = "InPlacePodVerticalScalingExclusiveMemory" - // owner: @trierra - // - // Disables the Portworx in-tree driver. - InTreePluginPortworxUnregister featuregate.Feature = "InTreePluginPortworxUnregister" - // owner: @mimowo // kep: https://kep.k8s.io/3850 // @@ -1165,13 +1154,6 @@ var defaultVersionedKubernetesFeatureGates = map[featuregate.Feature]featuregate {Version: version.MustParse("1.33"), Default: true, PreRelease: featuregate.GA, LockToDefault: true}, // remove in 1.36 }, - CSIMigrationPortworx: { - {Version: version.MustParse("1.23"), Default: false, PreRelease: featuregate.Alpha}, - {Version: version.MustParse("1.25"), Default: false, PreRelease: featuregate.Beta}, - {Version: version.MustParse("1.31"), Default: true, PreRelease: featuregate.Beta}, // On by default (requires Portworx CSI driver) - {Version: version.MustParse("1.33"), Default: true, PreRelease: featuregate.GA, LockToDefault: true}, // remove in 1.36 - }, - CSIServiceAccountTokenSecrets: { {Version: version.MustParse("1.35"), Default: true, PreRelease: featuregate.Beta}, }, @@ -1390,10 +1372,6 @@ var defaultVersionedKubernetesFeatureGates = map[featuregate.Feature]featuregate {Version: version.MustParse("1.34"), Default: false, PreRelease: featuregate.Alpha}, }, - InTreePluginPortworxUnregister: { - {Version: version.MustParse("1.23"), Default: false, PreRelease: featuregate.Alpha}, // remove it along with CSIMigrationPortworx in 1.36 - }, - JobBackoffLimitPerIndex: { {Version: version.MustParse("1.28"), Default: false, PreRelease: featuregate.Alpha}, {Version: version.MustParse("1.29"), Default: true, PreRelease: featuregate.Beta}, @@ -2166,8 +2144,6 @@ var defaultKubernetesFeatureGateDependencies = map[featuregate.Feature][]feature CPUManagerPolicyOptions: {}, - CSIMigrationPortworx: {}, - CSIServiceAccountTokenSecrets: {}, CSIVolumeHealth: {}, @@ -2262,8 +2238,6 @@ var defaultKubernetesFeatureGateDependencies = map[featuregate.Feature][]feature InPlacePodVerticalScalingExclusiveMemory: {InPlacePodVerticalScaling, MemoryManager}, - InTreePluginPortworxUnregister: {}, - JobBackoffLimitPerIndex: {}, JobManagedBy: {}, diff --git a/pkg/scheduler/framework/plugins/feature/feature.go b/pkg/scheduler/framework/plugins/feature/feature.go index f15c64edbd6..9725329818e 100644 --- a/pkg/scheduler/framework/plugins/feature/feature.go +++ b/pkg/scheduler/framework/plugins/feature/feature.go @@ -36,7 +36,6 @@ type Features struct { EnableDRASchedulerFilterTimeout bool EnableDynamicResourceAllocation bool EnableVolumeAttributesClass bool - EnableCSIMigrationPortworx bool EnableVolumeLimitScaling bool EnableNodeInclusionPolicyInPodTopologySpread bool EnableMatchLabelKeysInPodTopologySpread bool @@ -65,7 +64,6 @@ func NewSchedulerFeaturesFromGates(featureGate featuregate.FeatureGate) Features EnableDRADeviceBindingConditions: featureGate.Enabled(features.DRADeviceBindingConditions), EnableDynamicResourceAllocation: featureGate.Enabled(features.DynamicResourceAllocation), EnableVolumeAttributesClass: featureGate.Enabled(features.VolumeAttributesClass), - EnableCSIMigrationPortworx: featureGate.Enabled(features.CSIMigrationPortworx), EnableVolumeLimitScaling: featureGate.Enabled(features.VolumeLimitScaling), EnableNodeInclusionPolicyInPodTopologySpread: featureGate.Enabled(features.NodeInclusionPolicyInPodTopologySpread), EnableMatchLabelKeysInPodTopologySpread: featureGate.Enabled(features.MatchLabelKeysInPodTopologySpread), diff --git a/pkg/scheduler/framework/plugins/nodevolumelimits/csi.go b/pkg/scheduler/framework/plugins/nodevolumelimits/csi.go index 07be0e040b7..9bb7843eb8c 100644 --- a/pkg/scheduler/framework/plugins/nodevolumelimits/csi.go +++ b/pkg/scheduler/framework/plugins/nodevolumelimits/csi.go @@ -64,10 +64,9 @@ type CSILimits struct { vaLister storagelisters.VolumeAttachmentLister csiDriverLister storagelisters.CSIDriverLister - enableCSIMigrationPortworx bool - randomVolumeIDPrefix string - enableVolumeLimitScaling bool - translator InTreeToCSITranslator + randomVolumeIDPrefix string + enableVolumeLimitScaling bool + translator InTreeToCSITranslator } var _ fwk.PreFilterPlugin = &CSILimits{} @@ -458,7 +457,7 @@ func (pl *CSILimits) checkAttachableInlineVolume(logger klog.Logger, vol *v1.Vol if err != nil { return fmt.Errorf("looking up provisioner name for volume %s: %w", vol.Name, err) } - if !isCSIMigrationOn(csiNode, inTreeProvisionerName, pl.enableCSIMigrationPortworx) { + if !isCSIMigrationOn(csiNode, inTreeProvisionerName) { csiNodeName := "" if csiNode != nil { csiNodeName = csiNode.Name @@ -519,7 +518,7 @@ func (pl *CSILimits) getCSIDriverInfo(logger klog.Logger, csiNode *storagev1.CSI return "", "" } - if !isCSIMigrationOn(csiNode, pluginName, pl.enableCSIMigrationPortworx) { + if !isCSIMigrationOn(csiNode, pluginName) { logger.V(5).Info("CSI Migration of plugin is not enabled", "plugin", pluginName) return "", "" } @@ -567,7 +566,7 @@ func (pl *CSILimits) getCSIDriverInfoFromSC(logger klog.Logger, csiNode *storage provisioner := storageClass.Provisioner if pl.translator.IsMigratableIntreePluginByName(provisioner) { - if !isCSIMigrationOn(csiNode, provisioner, pl.enableCSIMigrationPortworx) { + if !isCSIMigrationOn(csiNode, provisioner) { logger.V(5).Info("CSI Migration of provisioner is not enabled", "provisioner", provisioner) return "", "" } @@ -594,16 +593,15 @@ func NewCSI(_ context.Context, _ runtime.Object, handle fwk.Handle, fts feature. csiTranslator := csitrans.New() return &CSILimits{ - csiManager: handle.SharedCSIManager(), - pvLister: pvLister, - pvcLister: pvcLister, - scLister: scLister, - vaLister: vaLister, - csiDriverLister: csiDriverLister, - enableCSIMigrationPortworx: fts.EnableCSIMigrationPortworx, - enableVolumeLimitScaling: fts.EnableVolumeLimitScaling, - randomVolumeIDPrefix: rand.String(32), - translator: csiTranslator, + csiManager: handle.SharedCSIManager(), + pvLister: pvLister, + pvcLister: pvcLister, + scLister: scLister, + vaLister: vaLister, + csiDriverLister: csiDriverLister, + enableVolumeLimitScaling: fts.EnableVolumeLimitScaling, + randomVolumeIDPrefix: rand.String(32), + translator: csiTranslator, }, nil } diff --git a/pkg/scheduler/framework/plugins/nodevolumelimits/utils.go b/pkg/scheduler/framework/plugins/nodevolumelimits/utils.go index 7cb761379d3..a672895b2e3 100644 --- a/pkg/scheduler/framework/plugins/nodevolumelimits/utils.go +++ b/pkg/scheduler/framework/plugins/nodevolumelimits/utils.go @@ -17,17 +17,13 @@ limitations under the License. package nodevolumelimits import ( - "strings" - - v1 "k8s.io/api/core/v1" storagev1 "k8s.io/api/storage/v1" - "k8s.io/apimachinery/pkg/util/sets" csilibplugins "k8s.io/csi-translation-lib/plugins" ) // isCSIMigrationOn returns a boolean value indicating whether // the CSI migration has been enabled for a particular storage plugin. -func isCSIMigrationOn(csiNode *storagev1.CSINode, pluginName string, enableCSIMigrationPortworx bool) bool { +func isCSIMigrationOn(csiNode *storagev1.CSINode, pluginName string) bool { if csiNode == nil || len(pluginName) == 0 { return false } @@ -38,9 +34,7 @@ func isCSIMigrationOn(csiNode *storagev1.CSINode, pluginName string, enableCSIMi case csilibplugins.AWSEBSInTreePluginName: return true case csilibplugins.PortworxVolumePluginName: - if !enableCSIMigrationPortworx { - return false - } + return true case csilibplugins.GCEPDInTreePluginName: return true case csilibplugins.AzureDiskInTreePluginName: @@ -50,22 +44,4 @@ func isCSIMigrationOn(csiNode *storagev1.CSINode, pluginName string, enableCSIMi default: return false } - - // The plugin name should be listed in the CSINode object annotation. - // This indicates that the plugin has been migrated to a CSI driver in the node. - csiNodeAnn := csiNode.GetAnnotations() - if csiNodeAnn == nil { - return false - } - - var mpaSet sets.Set[string] - mpa := csiNodeAnn[v1.MigratedPluginsAnnotationKey] - if len(mpa) == 0 { - mpaSet = sets.New[string]() - } else { - tok := strings.Split(mpa, ",") - mpaSet = sets.New(tok...) - } - - return mpaSet.Has(pluginName) } diff --git a/pkg/scheduler/framework/plugins/volumebinding/binder.go b/pkg/scheduler/framework/plugins/volumebinding/binder.go index f4c9a22fc1f..3efccb1f82e 100644 --- a/pkg/scheduler/framework/plugins/volumebinding/binder.go +++ b/pkg/scheduler/framework/plugins/volumebinding/binder.go @@ -209,7 +209,6 @@ type PodVolumeClaims struct { type volumeBinder struct { kubeClient clientset.Interface enableVolumeAttributesClass bool - enableCSIMigrationPortworx bool classLister storagelisters.StorageClassLister podLister corelisters.PodLister @@ -262,7 +261,6 @@ func NewVolumeBinder( b := &volumeBinder{ kubeClient: kubeClient, enableVolumeAttributesClass: fts.EnableVolumeAttributesClass, - enableCSIMigrationPortworx: fts.EnableCSIMigrationPortworx, podLister: podInformer.Lister(), classLister: storageClassInformer.Lister(), nodeLister: nodeInformer.Lister(), @@ -1066,7 +1064,7 @@ func (a byPVCSize) Less(i, j int) bool { } // isCSIMigrationOnForPlugin checks if CSI migration is enabled for a given plugin. -func isCSIMigrationOnForPlugin(pluginName string, enableCSIMigrationPortworx bool) bool { +func isCSIMigrationOnForPlugin(pluginName string) bool { switch pluginName { case csiplugins.AWSEBSInTreePluginName: return true @@ -1077,7 +1075,7 @@ func isCSIMigrationOnForPlugin(pluginName string, enableCSIMigrationPortworx boo case csiplugins.CinderInTreePluginName: return true case csiplugins.PortworxVolumePluginName: - return enableCSIMigrationPortworx + return true } return false } @@ -1116,7 +1114,7 @@ func (b *volumeBinder) tryTranslatePVToCSI(logger klog.Logger, pv *v1.Persistent return nil, fmt.Errorf("could not get plugin name from pv: %v", err) } - if !isCSIMigrationOnForPlugin(pluginName, b.enableCSIMigrationPortworx) { + if !isCSIMigrationOnForPlugin(pluginName) { return pv, nil } diff --git a/pkg/volume/csi/csi_plugin.go b/pkg/volume/csi/csi_plugin.go index d2d830376da..6c27bbcb3eb 100644 --- a/pkg/volume/csi/csi_plugin.go +++ b/pkg/volume/csi/csi_plugin.go @@ -342,7 +342,7 @@ func (p *csiPlugin) Init(host volume.VolumeHost) error { return true }, csitranslationplugins.PortworxVolumePluginName: func() bool { - return utilfeature.DefaultFeatureGate.Enabled(features.CSIMigrationPortworx) + return true }, } diff --git a/pkg/volume/csimigration/plugin_manager.go b/pkg/volume/csimigration/plugin_manager.go index b69352c2a23..675699e636a 100644 --- a/pkg/volume/csimigration/plugin_manager.go +++ b/pkg/volume/csimigration/plugin_manager.go @@ -24,7 +24,6 @@ import ( "k8s.io/component-base/featuregate" csilibplugins "k8s.io/csi-translation-lib/plugins" "k8s.io/klog/v2" - "k8s.io/kubernetes/pkg/features" "k8s.io/kubernetes/pkg/volume" ) @@ -74,7 +73,7 @@ func (pm PluginManager) IsMigrationCompleteForPlugin(pluginName string) bool { case csilibplugins.VSphereInTreePluginName: return true case csilibplugins.PortworxVolumePluginName: - return pm.featureGate.Enabled(features.InTreePluginPortworxUnregister) + return true default: return false } @@ -100,7 +99,7 @@ func (pm PluginManager) IsMigrationEnabledForPlugin(pluginName string) bool { case csilibplugins.VSphereInTreePluginName: return true case csilibplugins.PortworxVolumePluginName: - return pm.featureGate.Enabled(features.CSIMigrationPortworx) + return true default: return false } diff --git a/pkg/volume/csimigration/plugin_manager_test.go b/pkg/volume/csimigration/plugin_manager_test.go deleted file mode 100644 index ee7ca9eaf05..00000000000 --- a/pkg/volume/csimigration/plugin_manager_test.go +++ /dev/null @@ -1,170 +0,0 @@ -/* -Copyright 2019 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package csimigration - -import ( - "fmt" - "testing" - - v1 "k8s.io/api/core/v1" - "k8s.io/apimachinery/pkg/util/version" - utilfeature "k8s.io/apiserver/pkg/util/feature" - "k8s.io/component-base/featuregate" - featuregatetesting "k8s.io/component-base/featuregate/testing" - csitrans "k8s.io/csi-translation-lib" - "k8s.io/kubernetes/pkg/features" - "k8s.io/kubernetes/pkg/volume" -) - -func TestIsMigratable(t *testing.T) { - testCases := []struct { - name string - pluginFeature featuregate.Feature - pluginFeatureEnabled bool - csiMigrationEnabled bool - isMigratable bool - spec *volume.Spec - }{ - { - name: "Portworx PV source with CSIMigrationPortworx enabled", - pluginFeature: features.CSIMigrationPortworx, - pluginFeatureEnabled: true, - isMigratable: true, - csiMigrationEnabled: true, - spec: &volume.Spec{ - PersistentVolume: &v1.PersistentVolume{ - Spec: v1.PersistentVolumeSpec{ - PersistentVolumeSource: v1.PersistentVolumeSource{ - PortworxVolume: &v1.PortworxVolumeSource{ - VolumeID: "test-volume", - }, - }, - }, - }, - }, - }, - { - name: "Portworx PD PV Source with CSIMigrationPortworx disabled", - pluginFeature: features.CSIMigrationPortworx, - pluginFeatureEnabled: false, - isMigratable: false, - csiMigrationEnabled: true, - spec: &volume.Spec{ - PersistentVolume: &v1.PersistentVolume{ - Spec: v1.PersistentVolumeSpec{ - PersistentVolumeSource: v1.PersistentVolumeSource{ - PortworxVolume: &v1.PortworxVolumeSource{ - VolumeID: "test-volume", - }, - }, - }, - }, - }, - }, - } - csiTranslator := csitrans.New() - for _, test := range testCases { - pm := NewPluginManager(csiTranslator, utilfeature.DefaultFeatureGate) - t.Run(fmt.Sprintf("Testing %v", test.name), func(t *testing.T) { - // TODO: this will be removed in 1.36 - featuregatetesting.SetFeatureGateEmulationVersionDuringTest(t, utilfeature.DefaultFeatureGate, version.MustParse("1.32")) - featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, test.pluginFeature, test.pluginFeatureEnabled) - migratable, err := pm.IsMigratable(test.spec) - if migratable != test.isMigratable { - t.Errorf("Expected migratability of spec: %v does not match obtained migratability: %v", test.isMigratable, migratable) - } - if err != nil { - t.Errorf("Unexpected error: %v", err) - } - }) - } -} - -func TestMigrationFeatureFlagStatus(t *testing.T) { - testCases := []struct { - name string - pluginName string - pluginFeature featuregate.Feature - pluginFeatureEnabled bool - inTreePluginUnregister featuregate.Feature - inTreePluginUnregisterEnabled bool - csiMigrationResult bool - csiMigrationCompleteResult bool - }{ - { - name: "portworx-volume migration flag disabled and migration-complete flag disabled with CSI migration flag", - pluginName: "kubernetes.io/portworx-volume", - pluginFeature: features.CSIMigrationPortworx, - pluginFeatureEnabled: false, - inTreePluginUnregister: features.InTreePluginPortworxUnregister, - inTreePluginUnregisterEnabled: false, - csiMigrationResult: false, - csiMigrationCompleteResult: false, - }, - { - name: "portworx-volume migration flag disabled and migration-complete flag enabled with CSI migration flag", - pluginName: "kubernetes.io/portworx-volume", - pluginFeature: features.CSIMigrationPortworx, - pluginFeatureEnabled: false, - inTreePluginUnregister: features.InTreePluginPortworxUnregister, - inTreePluginUnregisterEnabled: true, - csiMigrationResult: false, - csiMigrationCompleteResult: false, - }, - { - name: "portworx-volume migration flag enabled and migration-complete flag disabled with CSI migration flag", - pluginName: "kubernetes.io/portworx-volume", - pluginFeature: features.CSIMigrationPortworx, - pluginFeatureEnabled: true, - inTreePluginUnregister: features.InTreePluginPortworxUnregister, - inTreePluginUnregisterEnabled: false, - csiMigrationResult: true, - csiMigrationCompleteResult: false, - }, - { - name: "portworx-volume migration flag enabled and migration-complete flag enabled with CSI migration flag", - pluginName: "kubernetes.io/portworx-volume", - pluginFeature: features.CSIMigrationPortworx, - pluginFeatureEnabled: true, - inTreePluginUnregister: features.InTreePluginPortworxUnregister, - inTreePluginUnregisterEnabled: true, - csiMigrationResult: true, - csiMigrationCompleteResult: true, - }, - } - csiTranslator := csitrans.New() - for _, test := range testCases { - pm := NewPluginManager(csiTranslator, utilfeature.DefaultFeatureGate) - t.Run(fmt.Sprintf("Testing %v", test.name), func(t *testing.T) { - // TODO: this will be removed in 1.36 - featuregatetesting.SetFeatureGateEmulationVersionDuringTest(t, utilfeature.DefaultFeatureGate, version.MustParse("1.32")) - if len(test.pluginFeature) > 0 { - featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, test.pluginFeature, test.pluginFeatureEnabled) - } - featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, test.inTreePluginUnregister, test.inTreePluginUnregisterEnabled) - - csiMigrationResult := pm.IsMigrationEnabledForPlugin(test.pluginName) - if csiMigrationResult != test.csiMigrationResult { - t.Errorf("Expected migratability of plugin %v: %v does not match obtained migratability: %v", test.pluginName, test.csiMigrationResult, csiMigrationResult) - } - csiMigrationCompleteResult := pm.IsMigrationCompleteForPlugin(test.pluginName) - if csiMigrationCompleteResult != test.csiMigrationCompleteResult { - t.Errorf("Expected migration complete status of plugin: %v: %v does not match obtained migratability: %v", test.pluginName, test.csiMigrationCompleteResult, csiMigrationResult) - } - }) - } -} diff --git a/pkg/volume/portworx/portworx.go b/pkg/volume/portworx/portworx.go index f8d4c348c4f..33c15191efe 100644 --- a/pkg/volume/portworx/portworx.go +++ b/pkg/volume/portworx/portworx.go @@ -32,8 +32,6 @@ import ( "k8s.io/apimachinery/pkg/api/resource" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" - utilfeature "k8s.io/apiserver/pkg/util/feature" - "k8s.io/kubernetes/pkg/features" "k8s.io/kubernetes/pkg/volume" "k8s.io/kubernetes/pkg/volume/util" ) @@ -68,7 +66,7 @@ func getPath(uid types.UID, volName string, host volume.VolumeHost) string { } func (plugin *portworxVolumePlugin) IsMigratedToCSI() bool { - return utilfeature.DefaultFeatureGate.Enabled(features.CSIMigrationPortworx) + return true } func (plugin *portworxVolumePlugin) Init(host volume.VolumeHost) error { diff --git a/test/compatibility_lifecycle/reference/feature_list.md b/test/compatibility_lifecycle/reference/feature_list.md index b6bac32a865..05834183870 100644 --- a/test/compatibility_lifecycle/reference/feature_list.md +++ b/test/compatibility_lifecycle/reference/feature_list.md @@ -28,7 +28,6 @@ | CPUManagerPolicyOptions | :ballot_box_with_check: 1.23+ | :closed_lock_with_key: 1.33+ | 1.22 | 1.23–1.32 | 1.33– | | | [code](https://cs.k8s.io/?q=%5CbCPUManagerPolicyOptions%5Cb&i=nope&files=&excludeFiles=CHANGELOG&repos=kubernetes/kubernetes) [KEPs](https://cs.k8s.io/?q=%5CbCPUManagerPolicyOptions%5Cb&i=nope&files=&excludeFiles=CHANGELOG&repos=kubernetes/enhancements) | | CRDObservedGenerationTracking | | | | 1.35– | | | | [code](https://cs.k8s.io/?q=%5CbCRDObservedGenerationTracking%5Cb&i=nope&files=&excludeFiles=CHANGELOG&repos=kubernetes/kubernetes) [KEPs](https://cs.k8s.io/?q=%5CbCRDObservedGenerationTracking%5Cb&i=nope&files=&excludeFiles=CHANGELOG&repos=kubernetes/enhancements) | | CRDValidationRatcheting | :ballot_box_with_check: 1.30+ | :closed_lock_with_key: 1.33+ | 1.28–1.29 | 1.30–1.32 | 1.33– | | | [code](https://cs.k8s.io/?q=%5CbCRDValidationRatcheting%5Cb&i=nope&files=&excludeFiles=CHANGELOG&repos=kubernetes/kubernetes) [KEPs](https://cs.k8s.io/?q=%5CbCRDValidationRatcheting%5Cb&i=nope&files=&excludeFiles=CHANGELOG&repos=kubernetes/enhancements) | -| CSIMigrationPortworx | :ballot_box_with_check: 1.31+ | :closed_lock_with_key: 1.33+ | 1.23–1.24 | 1.25–1.32 | 1.33– | | | [code](https://cs.k8s.io/?q=%5CbCSIMigrationPortworx%5Cb&i=nope&files=&excludeFiles=CHANGELOG&repos=kubernetes/kubernetes) [KEPs](https://cs.k8s.io/?q=%5CbCSIMigrationPortworx%5Cb&i=nope&files=&excludeFiles=CHANGELOG&repos=kubernetes/enhancements) | | CSIServiceAccountTokenSecrets | :ballot_box_with_check: 1.35+ | | | 1.35– | | | | [code](https://cs.k8s.io/?q=%5CbCSIServiceAccountTokenSecrets%5Cb&i=nope&files=&excludeFiles=CHANGELOG&repos=kubernetes/kubernetes) [KEPs](https://cs.k8s.io/?q=%5CbCSIServiceAccountTokenSecrets%5Cb&i=nope&files=&excludeFiles=CHANGELOG&repos=kubernetes/enhancements) | | CSIVolumeHealth | | | 1.21– | | | | | [code](https://cs.k8s.io/?q=%5CbCSIVolumeHealth%5Cb&i=nope&files=&excludeFiles=CHANGELOG&repos=kubernetes/kubernetes) [KEPs](https://cs.k8s.io/?q=%5CbCSIVolumeHealth%5Cb&i=nope&files=&excludeFiles=CHANGELOG&repos=kubernetes/enhancements) | | ChangeContainerStatusOnKubeletRestart | :ballot_box_with_check: 1.0+ | | | | 1.0–1.34 | 1.35– | | [code](https://cs.k8s.io/?q=%5CbChangeContainerStatusOnKubeletRestart%5Cb&i=nope&files=&excludeFiles=CHANGELOG&repos=kubernetes/kubernetes) [KEPs](https://cs.k8s.io/?q=%5CbChangeContainerStatusOnKubeletRestart%5Cb&i=nope&files=&excludeFiles=CHANGELOG&repos=kubernetes/enhancements) | @@ -92,7 +91,6 @@ | InPlacePodVerticalScalingAllocatedStatus | | | 1.32 | | | 1.33– | InPlacePodVerticalScaling | [code](https://cs.k8s.io/?q=%5CbInPlacePodVerticalScalingAllocatedStatus%5Cb&i=nope&files=&excludeFiles=CHANGELOG&repos=kubernetes/kubernetes) [KEPs](https://cs.k8s.io/?q=%5CbInPlacePodVerticalScalingAllocatedStatus%5Cb&i=nope&files=&excludeFiles=CHANGELOG&repos=kubernetes/enhancements) | | InPlacePodVerticalScalingExclusiveCPUs | | | 1.32– | | | | InPlacePodVerticalScaling | [code](https://cs.k8s.io/?q=%5CbInPlacePodVerticalScalingExclusiveCPUs%5Cb&i=nope&files=&excludeFiles=CHANGELOG&repos=kubernetes/kubernetes) [KEPs](https://cs.k8s.io/?q=%5CbInPlacePodVerticalScalingExclusiveCPUs%5Cb&i=nope&files=&excludeFiles=CHANGELOG&repos=kubernetes/enhancements) | | InPlacePodVerticalScalingExclusiveMemory | | | 1.34– | | | | InPlacePodVerticalScaling
MemoryManager | [code](https://cs.k8s.io/?q=%5CbInPlacePodVerticalScalingExclusiveMemory%5Cb&i=nope&files=&excludeFiles=CHANGELOG&repos=kubernetes/kubernetes) [KEPs](https://cs.k8s.io/?q=%5CbInPlacePodVerticalScalingExclusiveMemory%5Cb&i=nope&files=&excludeFiles=CHANGELOG&repos=kubernetes/enhancements) | -| InTreePluginPortworxUnregister | | | 1.23– | | | | | [code](https://cs.k8s.io/?q=%5CbInTreePluginPortworxUnregister%5Cb&i=nope&files=&excludeFiles=CHANGELOG&repos=kubernetes/kubernetes) [KEPs](https://cs.k8s.io/?q=%5CbInTreePluginPortworxUnregister%5Cb&i=nope&files=&excludeFiles=CHANGELOG&repos=kubernetes/enhancements) | | InformerResourceVersion | :ballot_box_with_check: 1.35+ | | 1.30–1.34 | | 1.35– | | | [code](https://cs.k8s.io/?q=%5CbInformerResourceVersion%5Cb&i=nope&files=&excludeFiles=CHANGELOG&repos=kubernetes/kubernetes) [KEPs](https://cs.k8s.io/?q=%5CbInformerResourceVersion%5Cb&i=nope&files=&excludeFiles=CHANGELOG&repos=kubernetes/enhancements) | | JobBackoffLimitPerIndex | :ballot_box_with_check: 1.29+ | :closed_lock_with_key: 1.33+ | 1.28 | 1.29–1.32 | 1.33– | | | [code](https://cs.k8s.io/?q=%5CbJobBackoffLimitPerIndex%5Cb&i=nope&files=&excludeFiles=CHANGELOG&repos=kubernetes/kubernetes) [KEPs](https://cs.k8s.io/?q=%5CbJobBackoffLimitPerIndex%5Cb&i=nope&files=&excludeFiles=CHANGELOG&repos=kubernetes/enhancements) | | JobManagedBy | :ballot_box_with_check: 1.32+ | :closed_lock_with_key: 1.35+ | 1.30–1.31 | 1.32–1.34 | 1.35– | | | [code](https://cs.k8s.io/?q=%5CbJobManagedBy%5Cb&i=nope&files=&excludeFiles=CHANGELOG&repos=kubernetes/kubernetes) [KEPs](https://cs.k8s.io/?q=%5CbJobManagedBy%5Cb&i=nope&files=&excludeFiles=CHANGELOG&repos=kubernetes/enhancements) | diff --git a/test/compatibility_lifecycle/reference/versioned_feature_list.yaml b/test/compatibility_lifecycle/reference/versioned_feature_list.yaml index f501c9db4ac..432f072a3da 100644 --- a/test/compatibility_lifecycle/reference/versioned_feature_list.yaml +++ b/test/compatibility_lifecycle/reference/versioned_feature_list.yaml @@ -373,24 +373,6 @@ lockToDefault: false preRelease: Alpha version: "1.26" -- name: CSIMigrationPortworx - versionedSpecs: - - default: false - lockToDefault: false - preRelease: Alpha - version: "1.23" - - default: false - lockToDefault: false - preRelease: Beta - version: "1.25" - - default: true - lockToDefault: false - preRelease: Beta - version: "1.31" - - default: true - lockToDefault: true - preRelease: GA - version: "1.33" - name: CSIServiceAccountTokenSecrets versionedSpecs: - default: true @@ -767,12 +749,6 @@ lockToDefault: false preRelease: Alpha version: "1.34" -- name: InTreePluginPortworxUnregister - versionedSpecs: - - default: false - lockToDefault: false - preRelease: Alpha - version: "1.23" - name: JobBackoffLimitPerIndex versionedSpecs: - default: false