mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-08 19:47:56 +00:00
Merge pull request #84639 from SataQiu/clean-scheduler-20191101
scheduler: improve some comments and validation messages
This commit is contained in:
commit
bff9a7774c
@ -52,7 +52,7 @@ type KubeSchedulerConfiguration struct {
|
|||||||
AlgorithmSource SchedulerAlgorithmSource
|
AlgorithmSource SchedulerAlgorithmSource
|
||||||
// RequiredDuringScheduling affinity is not symmetric, but there is an implicit PreferredDuringScheduling affinity rule
|
// RequiredDuringScheduling affinity is not symmetric, but there is an implicit PreferredDuringScheduling affinity rule
|
||||||
// corresponding to every RequiredDuringScheduling affinity rule.
|
// corresponding to every RequiredDuringScheduling affinity rule.
|
||||||
// HardPodAffinitySymmetricWeight represents the weight of implicit PreferredDuringScheduling affinity rule, in the range 0-100.
|
// HardPodAffinitySymmetricWeight represents the weight of implicit PreferredDuringScheduling affinity rule, in the range [0-100].
|
||||||
HardPodAffinitySymmetricWeight int32
|
HardPodAffinitySymmetricWeight int32
|
||||||
|
|
||||||
// LeaderElection defines the configuration of leader election client.
|
// LeaderElection defines the configuration of leader election client.
|
||||||
@ -96,7 +96,7 @@ type KubeSchedulerConfiguration struct {
|
|||||||
PodInitialBackoffSeconds int64
|
PodInitialBackoffSeconds int64
|
||||||
|
|
||||||
// PodMaxBackoffSeconds is the max backoff for unschedulable pods.
|
// PodMaxBackoffSeconds is the max backoff for unschedulable pods.
|
||||||
// If specified, it must be greater than podInitialBackoffSeconds. If this value is null,
|
// If specified, it must be greater than or equal to podInitialBackoffSeconds. If this value is null,
|
||||||
// the default value (10s) will be used.
|
// the default value (10s) will be used.
|
||||||
PodMaxBackoffSeconds int64
|
PodMaxBackoffSeconds int64
|
||||||
|
|
||||||
@ -142,7 +142,7 @@ type SchedulerPolicyFileSource struct {
|
|||||||
type SchedulerPolicyConfigMapSource struct {
|
type SchedulerPolicyConfigMapSource struct {
|
||||||
// Namespace is the namespace of the policy config map.
|
// Namespace is the namespace of the policy config map.
|
||||||
Namespace string
|
Namespace string
|
||||||
// Name is the name of hte policy config map.
|
// Name is the name of the policy config map.
|
||||||
Name string
|
Name string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,11 +45,11 @@ func ValidateKubeSchedulerConfiguration(cc *config.KubeSchedulerConfiguration) f
|
|||||||
allErrs = append(allErrs, field.Invalid(field.NewPath("metricsBindAddress"), cc.MetricsBindAddress, msg))
|
allErrs = append(allErrs, field.Invalid(field.NewPath("metricsBindAddress"), cc.MetricsBindAddress, msg))
|
||||||
}
|
}
|
||||||
if cc.HardPodAffinitySymmetricWeight < 0 || cc.HardPodAffinitySymmetricWeight > 100 {
|
if cc.HardPodAffinitySymmetricWeight < 0 || cc.HardPodAffinitySymmetricWeight > 100 {
|
||||||
allErrs = append(allErrs, field.Invalid(field.NewPath("hardPodAffinitySymmetricWeight"), cc.HardPodAffinitySymmetricWeight, "not in valid range 0-100"))
|
allErrs = append(allErrs, field.Invalid(field.NewPath("hardPodAffinitySymmetricWeight"), cc.HardPodAffinitySymmetricWeight, "not in valid range [0-100]"))
|
||||||
}
|
}
|
||||||
if cc.PercentageOfNodesToScore < 0 || cc.PercentageOfNodesToScore > 100 {
|
if cc.PercentageOfNodesToScore < 0 || cc.PercentageOfNodesToScore > 100 {
|
||||||
allErrs = append(allErrs, field.Invalid(field.NewPath("percentageOfNodesToScore"),
|
allErrs = append(allErrs, field.Invalid(field.NewPath("percentageOfNodesToScore"),
|
||||||
cc.PercentageOfNodesToScore, "not in valid range 0-100"))
|
cc.PercentageOfNodesToScore, "not in valid range [0-100]"))
|
||||||
}
|
}
|
||||||
if cc.PodInitialBackoffSeconds <= 0 {
|
if cc.PodInitialBackoffSeconds <= 0 {
|
||||||
allErrs = append(allErrs, field.Invalid(field.NewPath("podInitialBackoffSeconds"),
|
allErrs = append(allErrs, field.Invalid(field.NewPath("podInitialBackoffSeconds"),
|
||||||
|
@ -147,7 +147,7 @@ type Configurator struct {
|
|||||||
|
|
||||||
// RequiredDuringScheduling affinity is not symmetric, but there is an implicit PreferredDuringScheduling affinity rule
|
// RequiredDuringScheduling affinity is not symmetric, but there is an implicit PreferredDuringScheduling affinity rule
|
||||||
// corresponding to every RequiredDuringScheduling affinity rule.
|
// corresponding to every RequiredDuringScheduling affinity rule.
|
||||||
// HardPodAffinitySymmetricWeight represents the weight of implicit PreferredDuringScheduling affinity rule, in the range 0-100.
|
// HardPodAffinitySymmetricWeight represents the weight of implicit PreferredDuringScheduling affinity rule, in the range [0-100].
|
||||||
hardPodAffinitySymmetricWeight int32
|
hardPodAffinitySymmetricWeight int32
|
||||||
|
|
||||||
// Handles volume binding decisions
|
// Handles volume binding decisions
|
||||||
|
@ -512,12 +512,12 @@ func TestInvalidFactoryArgs(t *testing.T) {
|
|||||||
{
|
{
|
||||||
name: "symmetric weight below range",
|
name: "symmetric weight below range",
|
||||||
hardPodAffinitySymmetricWeight: -1,
|
hardPodAffinitySymmetricWeight: -1,
|
||||||
expectErr: "invalid hardPodAffinitySymmetricWeight: -1, must be in the range 0-100",
|
expectErr: "invalid hardPodAffinitySymmetricWeight: -1, must be in the range [0-100]",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "symmetric weight above range",
|
name: "symmetric weight above range",
|
||||||
hardPodAffinitySymmetricWeight: 101,
|
hardPodAffinitySymmetricWeight: 101,
|
||||||
expectErr: "invalid hardPodAffinitySymmetricWeight: 101, must be in the range 0-100",
|
expectErr: "invalid hardPodAffinitySymmetricWeight: 101, must be in the range [0-100]",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ type CommunicatingPlugin struct{}
|
|||||||
var _ framework.ReservePlugin = CommunicatingPlugin{}
|
var _ framework.ReservePlugin = CommunicatingPlugin{}
|
||||||
var _ framework.PreBindPlugin = CommunicatingPlugin{}
|
var _ framework.PreBindPlugin = CommunicatingPlugin{}
|
||||||
|
|
||||||
// Name is the name of the plug used in Registry and configurations.
|
// Name is the name of the plugin used in Registry and configurations.
|
||||||
const Name = "multipoint-communicating-plugin"
|
const Name = "multipoint-communicating-plugin"
|
||||||
|
|
||||||
// Name returns name of the plugin. It is used in logs, etc.
|
// Name returns name of the plugin. It is used in logs, etc.
|
||||||
@ -43,9 +43,9 @@ type stateData struct {
|
|||||||
data string
|
data string
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f *stateData) Clone() framework.StateData {
|
func (s *stateData) Clone() framework.StateData {
|
||||||
copy := &stateData{
|
copy := &stateData{
|
||||||
data: f.data,
|
data: s.data,
|
||||||
}
|
}
|
||||||
return copy
|
return copy
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user