set default percentageOfNodesToScore in kube-scheduler back to 0 (maning adaptive)

This commit is contained in:
Abdullah Gharaibeh 2019-11-09 05:09:41 -05:00
parent 36362cc149
commit 9fb380ceff
4 changed files with 14 additions and 12 deletions

View File

@ -209,6 +209,7 @@ pluginConfig:
defaultBindTimeoutSeconds := int64(600)
defaultPodInitialBackoffSeconds := int64(1)
defaultPodMaxBackoffSeconds := int64(10)
defaultPercentageOfNodesToScore := int32(0)
testcases := []struct {
name string
@ -281,7 +282,7 @@ pluginConfig:
Burst: 100,
ContentType: "application/vnd.kubernetes.protobuf",
},
PercentageOfNodesToScore: 50,
PercentageOfNodesToScore: defaultPercentageOfNodesToScore,
BindTimeoutSeconds: defaultBindTimeoutSeconds,
PodInitialBackoffSeconds: defaultPodInitialBackoffSeconds,
PodMaxBackoffSeconds: defaultPodMaxBackoffSeconds,
@ -368,7 +369,7 @@ pluginConfig:
Burst: 100,
ContentType: "application/vnd.kubernetes.protobuf",
},
PercentageOfNodesToScore: 50,
PercentageOfNodesToScore: defaultPercentageOfNodesToScore,
BindTimeoutSeconds: defaultBindTimeoutSeconds,
PodInitialBackoffSeconds: defaultPodInitialBackoffSeconds,
PodMaxBackoffSeconds: defaultPodMaxBackoffSeconds,
@ -433,7 +434,7 @@ pluginConfig:
Burst: 100,
ContentType: "application/vnd.kubernetes.protobuf",
},
PercentageOfNodesToScore: 50,
PercentageOfNodesToScore: defaultPercentageOfNodesToScore,
BindTimeoutSeconds: defaultBindTimeoutSeconds,
PodInitialBackoffSeconds: defaultPodInitialBackoffSeconds,
PodMaxBackoffSeconds: defaultPodMaxBackoffSeconds,
@ -473,7 +474,7 @@ pluginConfig:
Burst: 100,
ContentType: "application/vnd.kubernetes.protobuf",
},
PercentageOfNodesToScore: 50,
PercentageOfNodesToScore: defaultPercentageOfNodesToScore,
BindTimeoutSeconds: defaultBindTimeoutSeconds,
PodInitialBackoffSeconds: defaultPodInitialBackoffSeconds,
PodMaxBackoffSeconds: defaultPodMaxBackoffSeconds,
@ -555,7 +556,7 @@ pluginConfig:
Burst: 100,
ContentType: "application/vnd.kubernetes.protobuf",
},
PercentageOfNodesToScore: 50,
PercentageOfNodesToScore: defaultPercentageOfNodesToScore,
BindTimeoutSeconds: defaultBindTimeoutSeconds,
PodInitialBackoffSeconds: defaultPodInitialBackoffSeconds,
PodMaxBackoffSeconds: defaultPodMaxBackoffSeconds,
@ -598,7 +599,7 @@ pluginConfig:
Burst: 100,
ContentType: "application/vnd.kubernetes.protobuf",
},
PercentageOfNodesToScore: 50,
PercentageOfNodesToScore: defaultPercentageOfNodesToScore,
BindTimeoutSeconds: defaultBindTimeoutSeconds,
PodInitialBackoffSeconds: defaultPodInitialBackoffSeconds,
PodMaxBackoffSeconds: defaultPodMaxBackoffSeconds,

View File

@ -228,7 +228,8 @@ type PluginConfig struct {
const (
// DefaultPercentageOfNodesToScore defines the percentage of nodes of all nodes
// that once found feasible, the scheduler stops looking for more nodes.
DefaultPercentageOfNodesToScore = 50
// A value of 0 means adaptive, meaning the scheduler figures out a proper default.
DefaultPercentageOfNodesToScore = 0
// MaxCustomPriorityScore is the max score UtilizationShapePoint expects.
MaxCustomPriorityScore int64 = 10

View File

@ -66,7 +66,7 @@ func TestSchedulerDefaults(t *testing.T) {
ContentType: "application/vnd.kubernetes.protobuf",
},
DisablePreemption: pointer.BoolPtr(false),
PercentageOfNodesToScore: pointer.Int32Ptr(50),
PercentageOfNodesToScore: pointer.Int32Ptr(0),
BindTimeoutSeconds: pointer.Int64Ptr(600),
PodInitialBackoffSeconds: pointer.Int64Ptr(1),
PodMaxBackoffSeconds: pointer.Int64Ptr(10),
@ -108,7 +108,7 @@ func TestSchedulerDefaults(t *testing.T) {
ContentType: "application/vnd.kubernetes.protobuf",
},
DisablePreemption: pointer.BoolPtr(false),
PercentageOfNodesToScore: pointer.Int32Ptr(50),
PercentageOfNodesToScore: pointer.Int32Ptr(0),
BindTimeoutSeconds: pointer.Int64Ptr(600),
PodInitialBackoffSeconds: pointer.Int64Ptr(1),
PodMaxBackoffSeconds: pointer.Int64Ptr(10),
@ -150,7 +150,7 @@ func TestSchedulerDefaults(t *testing.T) {
ContentType: "application/vnd.kubernetes.protobuf",
},
DisablePreemption: pointer.BoolPtr(false),
PercentageOfNodesToScore: pointer.Int32Ptr(50),
PercentageOfNodesToScore: pointer.Int32Ptr(0),
BindTimeoutSeconds: pointer.Int64Ptr(600),
PodInitialBackoffSeconds: pointer.Int64Ptr(1),
PodMaxBackoffSeconds: pointer.Int64Ptr(10),

View File

@ -41,7 +41,6 @@ import (
"k8s.io/kubernetes/pkg/scheduler/algorithm"
"k8s.io/kubernetes/pkg/scheduler/algorithm/predicates"
"k8s.io/kubernetes/pkg/scheduler/algorithm/priorities"
schedulerapi "k8s.io/kubernetes/pkg/scheduler/apis/config"
extenderv1 "k8s.io/kubernetes/pkg/scheduler/apis/extender/v1"
"k8s.io/kubernetes/pkg/scheduler/framework/plugins/migration"
framework "k8s.io/kubernetes/pkg/scheduler/framework/v1alpha1"
@ -454,7 +453,8 @@ func (g *genericScheduler) numFeasibleNodesToFind(numAllNodes int32) (numNodes i
adaptivePercentage := g.percentageOfNodesToScore
if adaptivePercentage <= 0 {
adaptivePercentage = schedulerapi.DefaultPercentageOfNodesToScore - numAllNodes/125
basePercentageOfNodesToScore := int32(50)
adaptivePercentage = basePercentageOfNodesToScore - numAllNodes/125
if adaptivePercentage < minFeasibleNodesPercentageToFind {
adaptivePercentage = minFeasibleNodesPercentageToFind
}