Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

scheduler: improve some comments and validation messages #84639

Merged
merged 1 commit into from Nov 11, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions pkg/scheduler/apis/config/types.go
Expand Up @@ -50,7 +50,7 @@ type KubeSchedulerConfiguration struct {
AlgorithmSource SchedulerAlgorithmSource
// RequiredDuringScheduling affinity is not symmetric, but there is an implicit PreferredDuringScheduling 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

// LeaderElection defines the configuration of leader election client.
Expand Down Expand Up @@ -94,7 +94,7 @@ type KubeSchedulerConfiguration struct {
PodInitialBackoffSeconds *int64

// 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.
PodMaxBackoffSeconds *int64

Expand Down Expand Up @@ -140,7 +140,7 @@ type SchedulerPolicyFileSource struct {
type SchedulerPolicyConfigMapSource struct {
// Namespace is the namespace of the policy config map.
Namespace string
// Name is the name of hte policy config map.
// Name is the name of the policy config map.
Name string
}

Expand Down
4 changes: 2 additions & 2 deletions pkg/scheduler/apis/config/validation/validation.go
Expand Up @@ -38,14 +38,14 @@ func ValidateKubeSchedulerConfiguration(cc *config.KubeSchedulerConfiguration) f
allErrs = append(allErrs, field.Invalid(field.NewPath("metricsBindAddress"), cc.MetricsBindAddress, msg))
}
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.BindTimeoutSeconds == nil {
allErrs = append(allErrs, field.Required(field.NewPath("bindTimeoutSeconds"), ""))
}
if cc.PercentageOfNodesToScore < 0 || cc.PercentageOfNodesToScore > 100 {
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 == nil {
allErrs = append(allErrs, field.Required(field.NewPath("podInitialBackoffSeconds"), ""))
Expand Down
2 changes: 1 addition & 1 deletion pkg/scheduler/factory.go
Expand Up @@ -148,7 +148,7 @@ type Configurator struct {

// RequiredDuringScheduling affinity is not symmetric, but there is an implicit PreferredDuringScheduling 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

// Handles volume binding decisions
Expand Down
4 changes: 2 additions & 2 deletions pkg/scheduler/factory_test.go
Expand Up @@ -493,12 +493,12 @@ func TestInvalidFactoryArgs(t *testing.T) {
{
name: "symmetric weight below range",
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",
hardPodAffinitySymmetricWeight: 101,
expectErr: "invalid hardPodAffinitySymmetricWeight: 101, must be in the range 0-100",
expectErr: "invalid hardPodAffinitySymmetricWeight: 101, must be in the range [0-100]",
},
}

Expand Down
Expand Up @@ -31,7 +31,7 @@ type CommunicatingPlugin struct{}
var _ framework.ReservePlugin = 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"

// Name returns name of the plugin. It is used in logs, etc.
Expand All @@ -43,9 +43,9 @@ type stateData struct {
data string
}

func (f *stateData) Clone() framework.StateData {
func (s *stateData) Clone() framework.StateData {
copy := &stateData{
data: f.data,
data: s.data,
}
return copy
}
Expand Down