Merge pull request #45122 from ravisantoshgudimetla/priority_overflow#24720
Automatic merge from submit-queue (batch tested with PRs 44727, 45409, 44968, 45122, 45493) Total priority overflow check **What this PR does / why we need it**: **Which issue this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*: fixes #24720 **Special notes for your reviewer**: @adohe. I have borrowed some parts of your code in the closed PR and created this one. **Release note**: ```release-note This fixes the overflow for priorityconfig- valid range {1, 9223372036854775806}. ```
This commit is contained in:
@@ -29,8 +29,8 @@ func ValidatePolicy(policy schedulerapi.Policy) error {
|
||||
var validationErrors []error
|
||||
|
||||
for _, priority := range policy.Priorities {
|
||||
if priority.Weight <= 0 {
|
||||
validationErrors = append(validationErrors, fmt.Errorf("Priority %s should have a positive weight applied to it", priority.Name))
|
||||
if priority.Weight <= 0 || priority.Weight >= schedulerapi.MaxWeight {
|
||||
validationErrors = append(validationErrors, fmt.Errorf("Priority %s should have a positive weight applied to it or it has overflown", priority.Name))
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user