Add validation for percentage-of-nodes-to-score of the scheduler config

This commit is contained in:
Bobby (Babak) Salamat
2018-10-02 17:09:47 -07:00
parent a7da82fb9d
commit 2d9d8c405d
2 changed files with 13 additions and 1 deletions

View File

@@ -44,6 +44,10 @@ func ValidateKubeSchedulerConfiguration(cc *config.KubeSchedulerConfiguration) f
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"))
}
return allErrs
}