From a9f6374ba01197b712ee81d057e610c1a1b48f49 Mon Sep 17 00:00:00 2001 From: carlory Date: Wed, 24 Apr 2024 15:59:17 +0800 Subject: [PATCH] scheduler deprecates non-csi plugins --- .../apis/config/testing/defaults/defaults.go | 9 ------- .../apis/config/v1/default_plugins.go | 3 --- .../apis/config/v1/default_plugins_test.go | 6 ----- pkg/scheduler/apis/config/v1/defaults_test.go | 3 --- .../apis/config/validation/validation.go | 7 ++++- .../apis/config/validation/validation_test.go | 27 +++++++++++++++++++ 6 files changed, 33 insertions(+), 22 deletions(-) diff --git a/pkg/scheduler/apis/config/testing/defaults/defaults.go b/pkg/scheduler/apis/config/testing/defaults/defaults.go index 413199253ee..c83668c9604 100644 --- a/pkg/scheduler/apis/config/testing/defaults/defaults.go +++ b/pkg/scheduler/apis/config/testing/defaults/defaults.go @@ -34,10 +34,7 @@ var PluginsV1 = &config.Plugins{ {Name: names.NodePorts}, {Name: names.NodeResourcesFit, Weight: 1}, {Name: names.VolumeRestrictions}, - {Name: names.EBSLimits}, - {Name: names.GCEPDLimits}, {Name: names.NodeVolumeLimits}, - {Name: names.AzureDiskLimits}, {Name: names.VolumeBinding}, {Name: names.VolumeZone}, {Name: names.PodTopologySpread, Weight: 2}, @@ -68,10 +65,7 @@ var ExpandedPluginsV1 = &config.Plugins{ {Name: names.NodePorts}, {Name: names.NodeResourcesFit}, {Name: names.VolumeRestrictions}, - {Name: names.EBSLimits}, - {Name: names.GCEPDLimits}, {Name: names.NodeVolumeLimits}, - {Name: names.AzureDiskLimits}, {Name: names.VolumeBinding}, {Name: names.VolumeZone}, {Name: names.PodTopologySpread}, @@ -87,10 +81,7 @@ var ExpandedPluginsV1 = &config.Plugins{ {Name: names.NodePorts}, {Name: names.NodeResourcesFit}, {Name: names.VolumeRestrictions}, - {Name: names.EBSLimits}, - {Name: names.GCEPDLimits}, {Name: names.NodeVolumeLimits}, - {Name: names.AzureDiskLimits}, {Name: names.VolumeBinding}, {Name: names.VolumeZone}, {Name: names.PodTopologySpread}, diff --git a/pkg/scheduler/apis/config/v1/default_plugins.go b/pkg/scheduler/apis/config/v1/default_plugins.go index fa3174d8831..baad8cd0f9d 100644 --- a/pkg/scheduler/apis/config/v1/default_plugins.go +++ b/pkg/scheduler/apis/config/v1/default_plugins.go @@ -40,10 +40,7 @@ func getDefaultPlugins() *v1.Plugins { {Name: names.NodePorts}, {Name: names.NodeResourcesFit, Weight: ptr.To[int32](1)}, {Name: names.VolumeRestrictions}, - {Name: names.EBSLimits}, - {Name: names.GCEPDLimits}, {Name: names.NodeVolumeLimits}, - {Name: names.AzureDiskLimits}, {Name: names.VolumeBinding}, {Name: names.VolumeZone}, {Name: names.PodTopologySpread, Weight: ptr.To[int32](2)}, diff --git a/pkg/scheduler/apis/config/v1/default_plugins_test.go b/pkg/scheduler/apis/config/v1/default_plugins_test.go index 706b80a81c8..10da1a122c8 100644 --- a/pkg/scheduler/apis/config/v1/default_plugins_test.go +++ b/pkg/scheduler/apis/config/v1/default_plugins_test.go @@ -53,10 +53,7 @@ func TestApplyFeatureGates(t *testing.T) { {Name: names.NodePorts}, {Name: names.NodeResourcesFit, Weight: ptr.To[int32](1)}, {Name: names.VolumeRestrictions}, - {Name: names.EBSLimits}, - {Name: names.GCEPDLimits}, {Name: names.NodeVolumeLimits}, - {Name: names.AzureDiskLimits}, {Name: names.VolumeBinding}, {Name: names.VolumeZone}, {Name: names.PodTopologySpread, Weight: ptr.To[int32](2)}, @@ -86,10 +83,7 @@ func TestApplyFeatureGates(t *testing.T) { {Name: names.NodePorts}, {Name: names.NodeResourcesFit, Weight: ptr.To[int32](1)}, {Name: names.VolumeRestrictions}, - {Name: names.EBSLimits}, - {Name: names.GCEPDLimits}, {Name: names.NodeVolumeLimits}, - {Name: names.AzureDiskLimits}, {Name: names.VolumeBinding}, {Name: names.VolumeZone}, {Name: names.PodTopologySpread, Weight: ptr.To[int32](2)}, diff --git a/pkg/scheduler/apis/config/v1/defaults_test.go b/pkg/scheduler/apis/config/v1/defaults_test.go index 7a093236c97..9a4e7a78e38 100644 --- a/pkg/scheduler/apis/config/v1/defaults_test.go +++ b/pkg/scheduler/apis/config/v1/defaults_test.go @@ -340,10 +340,7 @@ func TestSchedulerDefaults(t *testing.T) { {Name: names.NodePorts}, {Name: names.NodeResourcesFit, Weight: ptr.To[int32](1)}, {Name: names.VolumeRestrictions}, - {Name: names.EBSLimits}, - {Name: names.GCEPDLimits}, {Name: names.NodeVolumeLimits}, - {Name: names.AzureDiskLimits}, {Name: names.VolumeBinding}, {Name: names.VolumeZone}, {Name: names.PodTopologySpread, Weight: ptr.To[int32](2)}, diff --git a/pkg/scheduler/apis/config/validation/validation.go b/pkg/scheduler/apis/config/validation/validation.go index 525e613d013..2f67fa629c4 100644 --- a/pkg/scheduler/apis/config/validation/validation.go +++ b/pkg/scheduler/apis/config/validation/validation.go @@ -101,7 +101,12 @@ type invalidPlugins struct { var invalidPluginsByVersion = []invalidPlugins{ { schemeGroupVersion: v1.SchemeGroupVersion.String(), - plugins: []string{}, + plugins: []string{ + "AzureDiskLimits", + "CinderLimits", + "EBSLimits", + "GCEPDLimits", + }, }, } diff --git a/pkg/scheduler/apis/config/validation/validation_test.go b/pkg/scheduler/apis/config/validation/validation_test.go index aa3aff8f1fc..41a0ce653d6 100644 --- a/pkg/scheduler/apis/config/validation/validation_test.go +++ b/pkg/scheduler/apis/config/validation/validation_test.go @@ -189,6 +189,12 @@ func TestValidateKubeSchedulerConfigurationV1(t *testing.T) { validPlugins := validConfig.DeepCopy() validPlugins.Profiles[0].Plugins.Score.Enabled = append(validPlugins.Profiles[0].Plugins.Score.Enabled, config.Plugin{Name: "PodTopologySpread", Weight: 2}) + invalidPlugins := validConfig.DeepCopy() + invalidPlugins.Profiles[0].Plugins.Score.Enabled = append(invalidPlugins.Profiles[0].Plugins.Score.Enabled, config.Plugin{Name: "AzureDiskLimits"}) + invalidPlugins.Profiles[0].Plugins.Score.Enabled = append(invalidPlugins.Profiles[0].Plugins.Score.Enabled, config.Plugin{Name: "CinderLimits"}) + invalidPlugins.Profiles[0].Plugins.Score.Enabled = append(invalidPlugins.Profiles[0].Plugins.Score.Enabled, config.Plugin{Name: "EBSLimits"}) + invalidPlugins.Profiles[0].Plugins.Score.Enabled = append(invalidPlugins.Profiles[0].Plugins.Score.Enabled, config.Plugin{Name: "GCEPDLimits"}) + scenarios := map[string]struct { config *config.KubeSchedulerConfiguration wantErrs field.ErrorList @@ -367,6 +373,27 @@ func TestValidateKubeSchedulerConfigurationV1(t *testing.T) { }, }, }, + "invalid-plugins": { + config: invalidPlugins, + wantErrs: field.ErrorList{ + &field.Error{ + Type: field.ErrorTypeInvalid, + Field: "profiles[0].plugins.score.enabled[0]", + }, + &field.Error{ + Type: field.ErrorTypeInvalid, + Field: "profiles[0].plugins.score.enabled[1]", + }, + &field.Error{ + Type: field.ErrorTypeInvalid, + Field: "profiles[0].plugins.score.enabled[2]", + }, + &field.Error{ + Type: field.ErrorTypeInvalid, + Field: "profiles[0].plugins.score.enabled[3]", + }, + }, + }, "valid-plugins": { config: validPlugins, },