diff --git a/pkg/scheduler/apis/config/testing/defaults/defaults.go b/pkg/scheduler/apis/config/testing/defaults/defaults.go index 9a16a41a72c9..b6d4825a630c 100644 --- a/pkg/scheduler/apis/config/testing/defaults/defaults.go +++ b/pkg/scheduler/apis/config/testing/defaults/defaults.go @@ -345,7 +345,6 @@ var PluginsV1 = &config.Plugins{ {Name: names.NodeResourcesBalancedAllocation, Weight: 1}, {Name: names.ImageLocality, Weight: 1}, {Name: names.DefaultBinder}, - {Name: names.DynamicResources}, }, }, } @@ -366,7 +365,6 @@ var ExpandedPluginsV1 = &config.Plugins{ {Name: names.VolumeBinding}, {Name: names.PodTopologySpread}, {Name: names.InterPodAffinity}, - {Name: names.DynamicResources}, }, }, Filter: config.PluginSet{ @@ -386,13 +384,11 @@ var ExpandedPluginsV1 = &config.Plugins{ {Name: names.VolumeZone}, {Name: names.PodTopologySpread}, {Name: names.InterPodAffinity}, - {Name: names.DynamicResources}, }, }, PostFilter: config.PluginSet{ Enabled: []config.Plugin{ {Name: names.DefaultPreemption}, - {Name: names.DynamicResources}, }, }, PreScore: config.PluginSet{ @@ -401,7 +397,6 @@ var ExpandedPluginsV1 = &config.Plugins{ {Name: names.NodeAffinity}, {Name: names.PodTopologySpread}, {Name: names.InterPodAffinity}, - {Name: names.DynamicResources}, }, }, Score: config.PluginSet{ @@ -434,7 +429,6 @@ var ExpandedPluginsV1 = &config.Plugins{ Reserve: config.PluginSet{ Enabled: []config.Plugin{ {Name: names.VolumeBinding}, - {Name: names.DynamicResources}, }, }, PreBind: config.PluginSet{ @@ -447,11 +441,6 @@ var ExpandedPluginsV1 = &config.Plugins{ {Name: names.DefaultBinder}, }, }, - PostBind: config.PluginSet{ - Enabled: []config.Plugin{ - {Name: names.DynamicResources}, - }, - }, } // PluginConfigsV1 default plugin configurations. diff --git a/pkg/scheduler/apis/config/v1/default_plugins.go b/pkg/scheduler/apis/config/v1/default_plugins.go index 2b7140249eab..31965d21ab0e 100644 --- a/pkg/scheduler/apis/config/v1/default_plugins.go +++ b/pkg/scheduler/apis/config/v1/default_plugins.go @@ -51,7 +51,6 @@ func getDefaultPlugins() *v1.Plugins { {Name: names.NodeResourcesBalancedAllocation, Weight: pointer.Int32(1)}, {Name: names.ImageLocality, Weight: pointer.Int32(1)}, {Name: names.DefaultBinder}, - {Name: names.DynamicResources}, }, }, } @@ -64,6 +63,9 @@ func applyFeatureGates(config *v1.Plugins) { if utilfeature.DefaultFeatureGate.Enabled(features.PodSchedulingReadiness) { config.MultiPoint.Enabled = append(config.MultiPoint.Enabled, v1.Plugin{Name: names.SchedulingGates}) } + if utilfeature.DefaultFeatureGate.Enabled(features.DynamicResourceAllocation) { + config.MultiPoint.Enabled = append(config.MultiPoint.Enabled, v1.Plugin{Name: names.DynamicResources}) + } } // mergePlugins merges the custom set into the given default one, handling disabled sets. diff --git a/pkg/scheduler/apis/config/v1/default_plugins_test.go b/pkg/scheduler/apis/config/v1/default_plugins_test.go index c15e63cb621e..51317a149c8c 100644 --- a/pkg/scheduler/apis/config/v1/default_plugins_test.go +++ b/pkg/scheduler/apis/config/v1/default_plugins_test.go @@ -60,7 +60,6 @@ func TestApplyFeatureGates(t *testing.T) { {Name: names.NodeResourcesBalancedAllocation, Weight: pointer.Int32(1)}, {Name: names.ImageLocality, Weight: pointer.Int32(1)}, {Name: names.DefaultBinder}, - {Name: names.DynamicResources}, }, }, }, @@ -93,12 +92,44 @@ func TestApplyFeatureGates(t *testing.T) { {Name: names.NodeResourcesBalancedAllocation, Weight: pointer.Int32(1)}, {Name: names.ImageLocality, Weight: pointer.Int32(1)}, {Name: names.DefaultBinder}, - {Name: names.DynamicResources}, {Name: names.SchedulingGates}, }, }, }, }, + { + name: "Feature gate DynamicResourceAllocation enabled", + features: map[featuregate.Feature]bool{ + features.DynamicResourceAllocation: true, + }, + wantConfig: &v1.Plugins{ + MultiPoint: v1.PluginSet{ + Enabled: []v1.Plugin{ + {Name: names.PrioritySort}, + {Name: names.NodeUnschedulable}, + {Name: names.NodeName}, + {Name: names.TaintToleration, Weight: pointer.Int32(3)}, + {Name: names.NodeAffinity, Weight: pointer.Int32(2)}, + {Name: names.NodePorts}, + {Name: names.NodeResourcesFit, Weight: pointer.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: pointer.Int32(2)}, + {Name: names.InterPodAffinity, Weight: pointer.Int32(2)}, + {Name: names.DefaultPreemption}, + {Name: names.NodeResourcesBalancedAllocation, Weight: pointer.Int32(1)}, + {Name: names.ImageLocality, Weight: pointer.Int32(1)}, + {Name: names.DefaultBinder}, + {Name: names.DynamicResources}, + }, + }, + }, + }, } for _, test := range tests { diff --git a/pkg/scheduler/apis/config/v1/defaults_test.go b/pkg/scheduler/apis/config/v1/defaults_test.go index 74a9e4c2e90e..8702e0779b68 100644 --- a/pkg/scheduler/apis/config/v1/defaults_test.go +++ b/pkg/scheduler/apis/config/v1/defaults_test.go @@ -348,7 +348,6 @@ func TestSchedulerDefaults(t *testing.T) { {Name: names.NodeResourcesBalancedAllocation, Weight: pointer.Int32(1)}, {Name: names.ImageLocality, Weight: pointer.Int32(1)}, {Name: names.DefaultBinder}, - {Name: names.DynamicResources}, }, }, Bind: configv1.PluginSet{