mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-21 10:51:29 +00:00
Fix a bug that DefaultPreemption plugin is disabled when using scheduler policy
This commit is contained in:
parent
f102cc887e
commit
47a7c374c6
@ -348,6 +348,7 @@ profiles:
|
|||||||
{Name: "TaintToleration"},
|
{Name: "TaintToleration"},
|
||||||
{Name: "InterPodAffinity"},
|
{Name: "InterPodAffinity"},
|
||||||
},
|
},
|
||||||
|
"PostFilterPlugin": {{Name: "DefaultPreemption"}},
|
||||||
"PreScorePlugin": {
|
"PreScorePlugin": {
|
||||||
{Name: "InterPodAffinity"},
|
{Name: "InterPodAffinity"},
|
||||||
},
|
},
|
||||||
|
@ -20,6 +20,7 @@ go_library(
|
|||||||
"//pkg/scheduler/framework:go_default_library",
|
"//pkg/scheduler/framework:go_default_library",
|
||||||
"//pkg/scheduler/framework/plugins:go_default_library",
|
"//pkg/scheduler/framework/plugins:go_default_library",
|
||||||
"//pkg/scheduler/framework/plugins/defaultbinder:go_default_library",
|
"//pkg/scheduler/framework/plugins/defaultbinder:go_default_library",
|
||||||
|
"//pkg/scheduler/framework/plugins/defaultpreemption:go_default_library",
|
||||||
"//pkg/scheduler/framework/plugins/noderesources:go_default_library",
|
"//pkg/scheduler/framework/plugins/noderesources:go_default_library",
|
||||||
"//pkg/scheduler/framework/plugins/queuesort:go_default_library",
|
"//pkg/scheduler/framework/plugins/queuesort:go_default_library",
|
||||||
"//pkg/scheduler/framework/runtime:go_default_library",
|
"//pkg/scheduler/framework/runtime:go_default_library",
|
||||||
|
@ -75,7 +75,8 @@ func TestCompatibility_v1_Scheduler(t *testing.T) {
|
|||||||
{Name: "NodeAffinity"},
|
{Name: "NodeAffinity"},
|
||||||
{Name: "TaintToleration"},
|
{Name: "TaintToleration"},
|
||||||
},
|
},
|
||||||
"BindPlugin": {{Name: "DefaultBinder"}},
|
"PostFilterPlugin": {{Name: "DefaultPreemption"}},
|
||||||
|
"BindPlugin": {{Name: "DefaultBinder"}},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
// This is a special test for the case where a policy is specified without specifying any filters.
|
// This is a special test for the case where a policy is specified without specifying any filters.
|
||||||
@ -95,7 +96,8 @@ func TestCompatibility_v1_Scheduler(t *testing.T) {
|
|||||||
{Name: "NodeUnschedulable"},
|
{Name: "NodeUnschedulable"},
|
||||||
{Name: "TaintToleration"},
|
{Name: "TaintToleration"},
|
||||||
},
|
},
|
||||||
"BindPlugin": {{Name: "DefaultBinder"}},
|
"PostFilterPlugin": {{Name: "DefaultPreemption"}},
|
||||||
|
"BindPlugin": {{Name: "DefaultBinder"}},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
// Do not change this JSON after the corresponding release has been tagged.
|
// Do not change this JSON after the corresponding release has been tagged.
|
||||||
@ -136,7 +138,8 @@ func TestCompatibility_v1_Scheduler(t *testing.T) {
|
|||||||
{Name: "NodeLabel"},
|
{Name: "NodeLabel"},
|
||||||
{Name: "ServiceAffinity"},
|
{Name: "ServiceAffinity"},
|
||||||
},
|
},
|
||||||
"PreScorePlugin": {{Name: "PodTopologySpread"}},
|
"PostFilterPlugin": {{Name: "DefaultPreemption"}},
|
||||||
|
"PreScorePlugin": {{Name: "PodTopologySpread"}},
|
||||||
"ScorePlugin": {
|
"ScorePlugin": {
|
||||||
{Name: "NodeResourcesLeastAllocated", Weight: 1},
|
{Name: "NodeResourcesLeastAllocated", Weight: 1},
|
||||||
{Name: "NodeLabel", Weight: 4},
|
{Name: "NodeLabel", Weight: 4},
|
||||||
@ -191,7 +194,8 @@ func TestCompatibility_v1_Scheduler(t *testing.T) {
|
|||||||
{Name: "NodeLabel"},
|
{Name: "NodeLabel"},
|
||||||
{Name: "ServiceAffinity"},
|
{Name: "ServiceAffinity"},
|
||||||
},
|
},
|
||||||
"PreScorePlugin": {{Name: "PodTopologySpread"}},
|
"PostFilterPlugin": {{Name: "DefaultPreemption"}},
|
||||||
|
"PreScorePlugin": {{Name: "PodTopologySpread"}},
|
||||||
"ScorePlugin": {
|
"ScorePlugin": {
|
||||||
{Name: "NodeResourcesBalancedAllocation", Weight: 2},
|
{Name: "NodeResourcesBalancedAllocation", Weight: 2},
|
||||||
{Name: "NodeResourcesLeastAllocated", Weight: 2},
|
{Name: "NodeResourcesLeastAllocated", Weight: 2},
|
||||||
@ -254,7 +258,8 @@ func TestCompatibility_v1_Scheduler(t *testing.T) {
|
|||||||
{Name: "AzureDiskLimits"},
|
{Name: "AzureDiskLimits"},
|
||||||
{Name: "VolumeZone"},
|
{Name: "VolumeZone"},
|
||||||
},
|
},
|
||||||
"PreScorePlugin": {{Name: "PodTopologySpread"}},
|
"PostFilterPlugin": {{Name: "DefaultPreemption"}},
|
||||||
|
"PreScorePlugin": {{Name: "PodTopologySpread"}},
|
||||||
"ScorePlugin": {
|
"ScorePlugin": {
|
||||||
{Name: "NodeResourcesBalancedAllocation", Weight: 2},
|
{Name: "NodeResourcesBalancedAllocation", Weight: 2},
|
||||||
{Name: "ImageLocality", Weight: 2},
|
{Name: "ImageLocality", Weight: 2},
|
||||||
@ -324,6 +329,7 @@ func TestCompatibility_v1_Scheduler(t *testing.T) {
|
|||||||
{Name: "VolumeZone"},
|
{Name: "VolumeZone"},
|
||||||
{Name: "InterPodAffinity"},
|
{Name: "InterPodAffinity"},
|
||||||
},
|
},
|
||||||
|
"PostFilterPlugin": {{Name: "DefaultPreemption"}},
|
||||||
"PreScorePlugin": {
|
"PreScorePlugin": {
|
||||||
{Name: "InterPodAffinity"},
|
{Name: "InterPodAffinity"},
|
||||||
{Name: "PodTopologySpread"},
|
{Name: "PodTopologySpread"},
|
||||||
@ -400,6 +406,7 @@ func TestCompatibility_v1_Scheduler(t *testing.T) {
|
|||||||
{Name: "VolumeZone"},
|
{Name: "VolumeZone"},
|
||||||
{Name: "InterPodAffinity"},
|
{Name: "InterPodAffinity"},
|
||||||
},
|
},
|
||||||
|
"PostFilterPlugin": {{Name: "DefaultPreemption"}},
|
||||||
"PreScorePlugin": {
|
"PreScorePlugin": {
|
||||||
{Name: "InterPodAffinity"},
|
{Name: "InterPodAffinity"},
|
||||||
{Name: "PodTopologySpread"},
|
{Name: "PodTopologySpread"},
|
||||||
@ -487,6 +494,7 @@ func TestCompatibility_v1_Scheduler(t *testing.T) {
|
|||||||
{Name: "VolumeZone"},
|
{Name: "VolumeZone"},
|
||||||
{Name: "InterPodAffinity"},
|
{Name: "InterPodAffinity"},
|
||||||
},
|
},
|
||||||
|
"PostFilterPlugin": {{Name: "DefaultPreemption"}},
|
||||||
"PreScorePlugin": {
|
"PreScorePlugin": {
|
||||||
{Name: "InterPodAffinity"},
|
{Name: "InterPodAffinity"},
|
||||||
{Name: "PodTopologySpread"},
|
{Name: "PodTopologySpread"},
|
||||||
@ -585,6 +593,7 @@ func TestCompatibility_v1_Scheduler(t *testing.T) {
|
|||||||
{Name: "VolumeZone"},
|
{Name: "VolumeZone"},
|
||||||
{Name: "InterPodAffinity"},
|
{Name: "InterPodAffinity"},
|
||||||
},
|
},
|
||||||
|
"PostFilterPlugin": {{Name: "DefaultPreemption"}},
|
||||||
"PreScorePlugin": {
|
"PreScorePlugin": {
|
||||||
{Name: "InterPodAffinity"},
|
{Name: "InterPodAffinity"},
|
||||||
{Name: "PodTopologySpread"},
|
{Name: "PodTopologySpread"},
|
||||||
@ -686,6 +695,7 @@ func TestCompatibility_v1_Scheduler(t *testing.T) {
|
|||||||
{Name: "VolumeZone"},
|
{Name: "VolumeZone"},
|
||||||
{Name: "InterPodAffinity"},
|
{Name: "InterPodAffinity"},
|
||||||
},
|
},
|
||||||
|
"PostFilterPlugin": {{Name: "DefaultPreemption"}},
|
||||||
"PreScorePlugin": {
|
"PreScorePlugin": {
|
||||||
{Name: "InterPodAffinity"},
|
{Name: "InterPodAffinity"},
|
||||||
{Name: "PodTopologySpread"},
|
{Name: "PodTopologySpread"},
|
||||||
@ -792,6 +802,7 @@ func TestCompatibility_v1_Scheduler(t *testing.T) {
|
|||||||
{Name: "VolumeZone"},
|
{Name: "VolumeZone"},
|
||||||
{Name: "InterPodAffinity"},
|
{Name: "InterPodAffinity"},
|
||||||
},
|
},
|
||||||
|
"PostFilterPlugin": {{Name: "DefaultPreemption"}},
|
||||||
"PreScorePlugin": {
|
"PreScorePlugin": {
|
||||||
{Name: "InterPodAffinity"},
|
{Name: "InterPodAffinity"},
|
||||||
{Name: "PodTopologySpread"},
|
{Name: "PodTopologySpread"},
|
||||||
@ -910,6 +921,7 @@ func TestCompatibility_v1_Scheduler(t *testing.T) {
|
|||||||
{Name: "VolumeZone"},
|
{Name: "VolumeZone"},
|
||||||
{Name: "InterPodAffinity"},
|
{Name: "InterPodAffinity"},
|
||||||
},
|
},
|
||||||
|
"PostFilterPlugin": {{Name: "DefaultPreemption"}},
|
||||||
"PreScorePlugin": {
|
"PreScorePlugin": {
|
||||||
{Name: "InterPodAffinity"},
|
{Name: "InterPodAffinity"},
|
||||||
{Name: "PodTopologySpread"},
|
{Name: "PodTopologySpread"},
|
||||||
@ -1031,6 +1043,7 @@ func TestCompatibility_v1_Scheduler(t *testing.T) {
|
|||||||
{Name: "VolumeZone"},
|
{Name: "VolumeZone"},
|
||||||
{Name: "InterPodAffinity"},
|
{Name: "InterPodAffinity"},
|
||||||
},
|
},
|
||||||
|
"PostFilterPlugin": {{Name: "DefaultPreemption"}},
|
||||||
"PreScorePlugin": {
|
"PreScorePlugin": {
|
||||||
{Name: "InterPodAffinity"},
|
{Name: "InterPodAffinity"},
|
||||||
{Name: "PodTopologySpread"},
|
{Name: "PodTopologySpread"},
|
||||||
@ -1152,6 +1165,7 @@ func TestCompatibility_v1_Scheduler(t *testing.T) {
|
|||||||
{Name: "VolumeZone"},
|
{Name: "VolumeZone"},
|
||||||
{Name: "InterPodAffinity"},
|
{Name: "InterPodAffinity"},
|
||||||
},
|
},
|
||||||
|
"PostFilterPlugin": {{Name: "DefaultPreemption"}},
|
||||||
"PreScorePlugin": {
|
"PreScorePlugin": {
|
||||||
{Name: "InterPodAffinity"},
|
{Name: "InterPodAffinity"},
|
||||||
{Name: "PodTopologySpread"},
|
{Name: "PodTopologySpread"},
|
||||||
@ -1277,6 +1291,7 @@ func TestCompatibility_v1_Scheduler(t *testing.T) {
|
|||||||
{Name: "VolumeZone"},
|
{Name: "VolumeZone"},
|
||||||
{Name: "InterPodAffinity"},
|
{Name: "InterPodAffinity"},
|
||||||
},
|
},
|
||||||
|
"PostFilterPlugin": {{Name: "DefaultPreemption"}},
|
||||||
"PreScorePlugin": {
|
"PreScorePlugin": {
|
||||||
{Name: "InterPodAffinity"},
|
{Name: "InterPodAffinity"},
|
||||||
{Name: "PodTopologySpread"},
|
{Name: "PodTopologySpread"},
|
||||||
|
@ -39,6 +39,7 @@ import (
|
|||||||
"k8s.io/kubernetes/pkg/scheduler/framework"
|
"k8s.io/kubernetes/pkg/scheduler/framework"
|
||||||
frameworkplugins "k8s.io/kubernetes/pkg/scheduler/framework/plugins"
|
frameworkplugins "k8s.io/kubernetes/pkg/scheduler/framework/plugins"
|
||||||
"k8s.io/kubernetes/pkg/scheduler/framework/plugins/defaultbinder"
|
"k8s.io/kubernetes/pkg/scheduler/framework/plugins/defaultbinder"
|
||||||
|
"k8s.io/kubernetes/pkg/scheduler/framework/plugins/defaultpreemption"
|
||||||
"k8s.io/kubernetes/pkg/scheduler/framework/plugins/noderesources"
|
"k8s.io/kubernetes/pkg/scheduler/framework/plugins/noderesources"
|
||||||
"k8s.io/kubernetes/pkg/scheduler/framework/plugins/queuesort"
|
"k8s.io/kubernetes/pkg/scheduler/framework/plugins/queuesort"
|
||||||
frameworkruntime "k8s.io/kubernetes/pkg/scheduler/framework/runtime"
|
frameworkruntime "k8s.io/kubernetes/pkg/scheduler/framework/runtime"
|
||||||
@ -262,12 +263,15 @@ func (c *Configurator) createFromConfig(policy schedulerapi.Policy) (*Scheduler,
|
|||||||
// Combine all framework configurations. If this results in any duplication, framework
|
// Combine all framework configurations. If this results in any duplication, framework
|
||||||
// instantiation should fail.
|
// instantiation should fail.
|
||||||
|
|
||||||
// "PrioritySort" and "DefaultBinder" were neither predicates nor priorities
|
// "PrioritySort", "DefaultPreemption" and "DefaultBinder" were neither predicates nor priorities
|
||||||
// before. We add them by default.
|
// before. We add them by default.
|
||||||
plugins := schedulerapi.Plugins{
|
plugins := schedulerapi.Plugins{
|
||||||
QueueSort: &schedulerapi.PluginSet{
|
QueueSort: &schedulerapi.PluginSet{
|
||||||
Enabled: []schedulerapi.Plugin{{Name: queuesort.Name}},
|
Enabled: []schedulerapi.Plugin{{Name: queuesort.Name}},
|
||||||
},
|
},
|
||||||
|
PostFilter: &schedulerapi.PluginSet{
|
||||||
|
Enabled: []schedulerapi.Plugin{{Name: defaultpreemption.Name}},
|
||||||
|
},
|
||||||
Bind: &schedulerapi.PluginSet{
|
Bind: &schedulerapi.PluginSet{
|
||||||
Enabled: []schedulerapi.Plugin{{Name: defaultbinder.Name}},
|
Enabled: []schedulerapi.Plugin{{Name: defaultbinder.Name}},
|
||||||
},
|
},
|
||||||
|
@ -140,7 +140,7 @@ func TestCreateFromConfig(t *testing.T) {
|
|||||||
{Name: "InterPodAffinity"},
|
{Name: "InterPodAffinity"},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
PostFilter: &schedulerapi.PluginSet{},
|
PostFilter: &schedulerapi.PluginSet{Enabled: []schedulerapi.Plugin{{Name: "DefaultPreemption"}}},
|
||||||
PreScore: &schedulerapi.PluginSet{
|
PreScore: &schedulerapi.PluginSet{
|
||||||
Enabled: []schedulerapi.Plugin{
|
Enabled: []schedulerapi.Plugin{
|
||||||
{Name: "PodTopologySpread"},
|
{Name: "PodTopologySpread"},
|
||||||
@ -238,7 +238,7 @@ func TestCreateFromConfig(t *testing.T) {
|
|||||||
{Name: "ServiceAffinity"},
|
{Name: "ServiceAffinity"},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
PostFilter: &schedulerapi.PluginSet{},
|
PostFilter: &schedulerapi.PluginSet{Enabled: []schedulerapi.Plugin{{Name: "DefaultPreemption"}}},
|
||||||
PreScore: &schedulerapi.PluginSet{Enabled: []schedulerapi.Plugin{{Name: "InterPodAffinity"}}},
|
PreScore: &schedulerapi.PluginSet{Enabled: []schedulerapi.Plugin{{Name: "InterPodAffinity"}}},
|
||||||
Score: &schedulerapi.PluginSet{
|
Score: &schedulerapi.PluginSet{
|
||||||
Enabled: []schedulerapi.Plugin{
|
Enabled: []schedulerapi.Plugin{
|
||||||
@ -313,7 +313,7 @@ func TestCreateFromConfig(t *testing.T) {
|
|||||||
{Name: "ServiceAffinity"},
|
{Name: "ServiceAffinity"},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
PostFilter: &schedulerapi.PluginSet{},
|
PostFilter: &schedulerapi.PluginSet{Enabled: []schedulerapi.Plugin{{Name: "DefaultPreemption"}}},
|
||||||
PreScore: &schedulerapi.PluginSet{Enabled: []schedulerapi.Plugin{{Name: "InterPodAffinity"}}},
|
PreScore: &schedulerapi.PluginSet{Enabled: []schedulerapi.Plugin{{Name: "InterPodAffinity"}}},
|
||||||
Score: &schedulerapi.PluginSet{
|
Score: &schedulerapi.PluginSet{
|
||||||
Enabled: []schedulerapi.Plugin{
|
Enabled: []schedulerapi.Plugin{
|
||||||
|
@ -90,6 +90,7 @@ func TestSchedulerCreationFromConfigMap(t *testing.T) {
|
|||||||
{Name: "NodeResourcesFit"},
|
{Name: "NodeResourcesFit"},
|
||||||
{Name: "TaintToleration"},
|
{Name: "TaintToleration"},
|
||||||
},
|
},
|
||||||
|
"PostFilterPlugin": {{Name: "DefaultPreemption"}},
|
||||||
"ScorePlugin": {
|
"ScorePlugin": {
|
||||||
{Name: "ImageLocality", Weight: 1},
|
{Name: "ImageLocality", Weight: 1},
|
||||||
},
|
},
|
||||||
@ -127,6 +128,7 @@ func TestSchedulerCreationFromConfigMap(t *testing.T) {
|
|||||||
{Name: "PodTopologySpread"},
|
{Name: "PodTopologySpread"},
|
||||||
{Name: "InterPodAffinity"},
|
{Name: "InterPodAffinity"},
|
||||||
},
|
},
|
||||||
|
"PostFilterPlugin": {{Name: "DefaultPreemption"}},
|
||||||
"PreScorePlugin": {
|
"PreScorePlugin": {
|
||||||
{Name: "PodTopologySpread"},
|
{Name: "PodTopologySpread"},
|
||||||
{Name: "InterPodAffinity"},
|
{Name: "InterPodAffinity"},
|
||||||
@ -160,7 +162,8 @@ func TestSchedulerCreationFromConfigMap(t *testing.T) {
|
|||||||
{Name: "NodeUnschedulable"},
|
{Name: "NodeUnschedulable"},
|
||||||
{Name: "TaintToleration"},
|
{Name: "TaintToleration"},
|
||||||
},
|
},
|
||||||
"BindPlugin": {{Name: "DefaultBinder"}},
|
"PostFilterPlugin": {{Name: "DefaultPreemption"}},
|
||||||
|
"BindPlugin": {{Name: "DefaultBinder"}},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -182,6 +185,7 @@ priorities:
|
|||||||
{Name: "NodeResourcesFit"},
|
{Name: "NodeResourcesFit"},
|
||||||
{Name: "TaintToleration"},
|
{Name: "TaintToleration"},
|
||||||
},
|
},
|
||||||
|
"PostFilterPlugin": {{Name: "DefaultPreemption"}},
|
||||||
"ScorePlugin": {
|
"ScorePlugin": {
|
||||||
{Name: "ImageLocality", Weight: 1},
|
{Name: "ImageLocality", Weight: 1},
|
||||||
},
|
},
|
||||||
@ -218,6 +222,7 @@ kind: Policy
|
|||||||
{Name: "PodTopologySpread"},
|
{Name: "PodTopologySpread"},
|
||||||
{Name: "InterPodAffinity"},
|
{Name: "InterPodAffinity"},
|
||||||
},
|
},
|
||||||
|
"PostFilterPlugin": {{Name: "DefaultPreemption"}},
|
||||||
"PreScorePlugin": {
|
"PreScorePlugin": {
|
||||||
{Name: "PodTopologySpread"},
|
{Name: "PodTopologySpread"},
|
||||||
{Name: "InterPodAffinity"},
|
{Name: "InterPodAffinity"},
|
||||||
@ -250,7 +255,8 @@ priorities: []
|
|||||||
{Name: "NodeUnschedulable"},
|
{Name: "NodeUnschedulable"},
|
||||||
{Name: "TaintToleration"},
|
{Name: "TaintToleration"},
|
||||||
},
|
},
|
||||||
"BindPlugin": {{Name: "DefaultBinder"}},
|
"PostFilterPlugin": {{Name: "DefaultPreemption"}},
|
||||||
|
"BindPlugin": {{Name: "DefaultBinder"}},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
} {
|
} {
|
||||||
|
Loading…
Reference in New Issue
Block a user