mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 19:56:01 +00:00
Merge pull request #85030 from ahg-g/ahg-nodestoscore
Set default percentageOfNodesToScore in kube-scheduler back to "adaptive"
This commit is contained in:
commit
1ca74c7991
@ -209,6 +209,7 @@ pluginConfig:
|
|||||||
defaultBindTimeoutSeconds := int64(600)
|
defaultBindTimeoutSeconds := int64(600)
|
||||||
defaultPodInitialBackoffSeconds := int64(1)
|
defaultPodInitialBackoffSeconds := int64(1)
|
||||||
defaultPodMaxBackoffSeconds := int64(10)
|
defaultPodMaxBackoffSeconds := int64(10)
|
||||||
|
defaultPercentageOfNodesToScore := int32(0)
|
||||||
|
|
||||||
testcases := []struct {
|
testcases := []struct {
|
||||||
name string
|
name string
|
||||||
@ -281,7 +282,7 @@ pluginConfig:
|
|||||||
Burst: 100,
|
Burst: 100,
|
||||||
ContentType: "application/vnd.kubernetes.protobuf",
|
ContentType: "application/vnd.kubernetes.protobuf",
|
||||||
},
|
},
|
||||||
PercentageOfNodesToScore: 50,
|
PercentageOfNodesToScore: defaultPercentageOfNodesToScore,
|
||||||
BindTimeoutSeconds: defaultBindTimeoutSeconds,
|
BindTimeoutSeconds: defaultBindTimeoutSeconds,
|
||||||
PodInitialBackoffSeconds: defaultPodInitialBackoffSeconds,
|
PodInitialBackoffSeconds: defaultPodInitialBackoffSeconds,
|
||||||
PodMaxBackoffSeconds: defaultPodMaxBackoffSeconds,
|
PodMaxBackoffSeconds: defaultPodMaxBackoffSeconds,
|
||||||
@ -368,7 +369,7 @@ pluginConfig:
|
|||||||
Burst: 100,
|
Burst: 100,
|
||||||
ContentType: "application/vnd.kubernetes.protobuf",
|
ContentType: "application/vnd.kubernetes.protobuf",
|
||||||
},
|
},
|
||||||
PercentageOfNodesToScore: 50,
|
PercentageOfNodesToScore: defaultPercentageOfNodesToScore,
|
||||||
BindTimeoutSeconds: defaultBindTimeoutSeconds,
|
BindTimeoutSeconds: defaultBindTimeoutSeconds,
|
||||||
PodInitialBackoffSeconds: defaultPodInitialBackoffSeconds,
|
PodInitialBackoffSeconds: defaultPodInitialBackoffSeconds,
|
||||||
PodMaxBackoffSeconds: defaultPodMaxBackoffSeconds,
|
PodMaxBackoffSeconds: defaultPodMaxBackoffSeconds,
|
||||||
@ -433,7 +434,7 @@ pluginConfig:
|
|||||||
Burst: 100,
|
Burst: 100,
|
||||||
ContentType: "application/vnd.kubernetes.protobuf",
|
ContentType: "application/vnd.kubernetes.protobuf",
|
||||||
},
|
},
|
||||||
PercentageOfNodesToScore: 50,
|
PercentageOfNodesToScore: defaultPercentageOfNodesToScore,
|
||||||
BindTimeoutSeconds: defaultBindTimeoutSeconds,
|
BindTimeoutSeconds: defaultBindTimeoutSeconds,
|
||||||
PodInitialBackoffSeconds: defaultPodInitialBackoffSeconds,
|
PodInitialBackoffSeconds: defaultPodInitialBackoffSeconds,
|
||||||
PodMaxBackoffSeconds: defaultPodMaxBackoffSeconds,
|
PodMaxBackoffSeconds: defaultPodMaxBackoffSeconds,
|
||||||
@ -473,7 +474,7 @@ pluginConfig:
|
|||||||
Burst: 100,
|
Burst: 100,
|
||||||
ContentType: "application/vnd.kubernetes.protobuf",
|
ContentType: "application/vnd.kubernetes.protobuf",
|
||||||
},
|
},
|
||||||
PercentageOfNodesToScore: 50,
|
PercentageOfNodesToScore: defaultPercentageOfNodesToScore,
|
||||||
BindTimeoutSeconds: defaultBindTimeoutSeconds,
|
BindTimeoutSeconds: defaultBindTimeoutSeconds,
|
||||||
PodInitialBackoffSeconds: defaultPodInitialBackoffSeconds,
|
PodInitialBackoffSeconds: defaultPodInitialBackoffSeconds,
|
||||||
PodMaxBackoffSeconds: defaultPodMaxBackoffSeconds,
|
PodMaxBackoffSeconds: defaultPodMaxBackoffSeconds,
|
||||||
@ -555,7 +556,7 @@ pluginConfig:
|
|||||||
Burst: 100,
|
Burst: 100,
|
||||||
ContentType: "application/vnd.kubernetes.protobuf",
|
ContentType: "application/vnd.kubernetes.protobuf",
|
||||||
},
|
},
|
||||||
PercentageOfNodesToScore: 50,
|
PercentageOfNodesToScore: defaultPercentageOfNodesToScore,
|
||||||
BindTimeoutSeconds: defaultBindTimeoutSeconds,
|
BindTimeoutSeconds: defaultBindTimeoutSeconds,
|
||||||
PodInitialBackoffSeconds: defaultPodInitialBackoffSeconds,
|
PodInitialBackoffSeconds: defaultPodInitialBackoffSeconds,
|
||||||
PodMaxBackoffSeconds: defaultPodMaxBackoffSeconds,
|
PodMaxBackoffSeconds: defaultPodMaxBackoffSeconds,
|
||||||
@ -598,7 +599,7 @@ pluginConfig:
|
|||||||
Burst: 100,
|
Burst: 100,
|
||||||
ContentType: "application/vnd.kubernetes.protobuf",
|
ContentType: "application/vnd.kubernetes.protobuf",
|
||||||
},
|
},
|
||||||
PercentageOfNodesToScore: 50,
|
PercentageOfNodesToScore: defaultPercentageOfNodesToScore,
|
||||||
BindTimeoutSeconds: defaultBindTimeoutSeconds,
|
BindTimeoutSeconds: defaultBindTimeoutSeconds,
|
||||||
PodInitialBackoffSeconds: defaultPodInitialBackoffSeconds,
|
PodInitialBackoffSeconds: defaultPodInitialBackoffSeconds,
|
||||||
PodMaxBackoffSeconds: defaultPodMaxBackoffSeconds,
|
PodMaxBackoffSeconds: defaultPodMaxBackoffSeconds,
|
||||||
|
@ -228,7 +228,8 @@ type PluginConfig struct {
|
|||||||
const (
|
const (
|
||||||
// DefaultPercentageOfNodesToScore defines the percentage of nodes of all nodes
|
// DefaultPercentageOfNodesToScore defines the percentage of nodes of all nodes
|
||||||
// that once found feasible, the scheduler stops looking for more 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 is the max score UtilizationShapePoint expects.
|
||||||
MaxCustomPriorityScore int64 = 10
|
MaxCustomPriorityScore int64 = 10
|
||||||
|
@ -66,7 +66,7 @@ func TestSchedulerDefaults(t *testing.T) {
|
|||||||
ContentType: "application/vnd.kubernetes.protobuf",
|
ContentType: "application/vnd.kubernetes.protobuf",
|
||||||
},
|
},
|
||||||
DisablePreemption: pointer.BoolPtr(false),
|
DisablePreemption: pointer.BoolPtr(false),
|
||||||
PercentageOfNodesToScore: pointer.Int32Ptr(50),
|
PercentageOfNodesToScore: pointer.Int32Ptr(0),
|
||||||
BindTimeoutSeconds: pointer.Int64Ptr(600),
|
BindTimeoutSeconds: pointer.Int64Ptr(600),
|
||||||
PodInitialBackoffSeconds: pointer.Int64Ptr(1),
|
PodInitialBackoffSeconds: pointer.Int64Ptr(1),
|
||||||
PodMaxBackoffSeconds: pointer.Int64Ptr(10),
|
PodMaxBackoffSeconds: pointer.Int64Ptr(10),
|
||||||
@ -108,7 +108,7 @@ func TestSchedulerDefaults(t *testing.T) {
|
|||||||
ContentType: "application/vnd.kubernetes.protobuf",
|
ContentType: "application/vnd.kubernetes.protobuf",
|
||||||
},
|
},
|
||||||
DisablePreemption: pointer.BoolPtr(false),
|
DisablePreemption: pointer.BoolPtr(false),
|
||||||
PercentageOfNodesToScore: pointer.Int32Ptr(50),
|
PercentageOfNodesToScore: pointer.Int32Ptr(0),
|
||||||
BindTimeoutSeconds: pointer.Int64Ptr(600),
|
BindTimeoutSeconds: pointer.Int64Ptr(600),
|
||||||
PodInitialBackoffSeconds: pointer.Int64Ptr(1),
|
PodInitialBackoffSeconds: pointer.Int64Ptr(1),
|
||||||
PodMaxBackoffSeconds: pointer.Int64Ptr(10),
|
PodMaxBackoffSeconds: pointer.Int64Ptr(10),
|
||||||
@ -150,7 +150,7 @@ func TestSchedulerDefaults(t *testing.T) {
|
|||||||
ContentType: "application/vnd.kubernetes.protobuf",
|
ContentType: "application/vnd.kubernetes.protobuf",
|
||||||
},
|
},
|
||||||
DisablePreemption: pointer.BoolPtr(false),
|
DisablePreemption: pointer.BoolPtr(false),
|
||||||
PercentageOfNodesToScore: pointer.Int32Ptr(50),
|
PercentageOfNodesToScore: pointer.Int32Ptr(0),
|
||||||
BindTimeoutSeconds: pointer.Int64Ptr(600),
|
BindTimeoutSeconds: pointer.Int64Ptr(600),
|
||||||
PodInitialBackoffSeconds: pointer.Int64Ptr(1),
|
PodInitialBackoffSeconds: pointer.Int64Ptr(1),
|
||||||
PodMaxBackoffSeconds: pointer.Int64Ptr(10),
|
PodMaxBackoffSeconds: pointer.Int64Ptr(10),
|
||||||
|
@ -41,7 +41,6 @@ import (
|
|||||||
"k8s.io/kubernetes/pkg/scheduler/algorithm"
|
"k8s.io/kubernetes/pkg/scheduler/algorithm"
|
||||||
"k8s.io/kubernetes/pkg/scheduler/algorithm/predicates"
|
"k8s.io/kubernetes/pkg/scheduler/algorithm/predicates"
|
||||||
"k8s.io/kubernetes/pkg/scheduler/algorithm/priorities"
|
"k8s.io/kubernetes/pkg/scheduler/algorithm/priorities"
|
||||||
schedulerapi "k8s.io/kubernetes/pkg/scheduler/apis/config"
|
|
||||||
extenderv1 "k8s.io/kubernetes/pkg/scheduler/apis/extender/v1"
|
extenderv1 "k8s.io/kubernetes/pkg/scheduler/apis/extender/v1"
|
||||||
"k8s.io/kubernetes/pkg/scheduler/framework/plugins/migration"
|
"k8s.io/kubernetes/pkg/scheduler/framework/plugins/migration"
|
||||||
framework "k8s.io/kubernetes/pkg/scheduler/framework/v1alpha1"
|
framework "k8s.io/kubernetes/pkg/scheduler/framework/v1alpha1"
|
||||||
@ -454,7 +453,8 @@ func (g *genericScheduler) numFeasibleNodesToFind(numAllNodes int32) (numNodes i
|
|||||||
|
|
||||||
adaptivePercentage := g.percentageOfNodesToScore
|
adaptivePercentage := g.percentageOfNodesToScore
|
||||||
if adaptivePercentage <= 0 {
|
if adaptivePercentage <= 0 {
|
||||||
adaptivePercentage = schedulerapi.DefaultPercentageOfNodesToScore - numAllNodes/125
|
basePercentageOfNodesToScore := int32(50)
|
||||||
|
adaptivePercentage = basePercentageOfNodesToScore - numAllNodes/125
|
||||||
if adaptivePercentage < minFeasibleNodesPercentageToFind {
|
if adaptivePercentage < minFeasibleNodesPercentageToFind {
|
||||||
adaptivePercentage = minFeasibleNodesPercentageToFind
|
adaptivePercentage = minFeasibleNodesPercentageToFind
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user