Skip to content

Commit 005485b

Browse files
committed
validation to GPU and hugepages
1 parent d945927 commit 005485b

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

pkg/api/validation/validation.go

+5
Original file line numberDiff line numberDiff line change
@@ -3853,6 +3853,11 @@ func ValidateLimitRange(limitRange *api.LimitRange) field.ErrorList {
38533853
allErrs = append(allErrs, field.Invalid(idxPath.Child("maxLimitRequestRatio").Key(string(k)), maxRatio, fmt.Sprintf("ratio %s is greater than max/min = %f", maxRatio.String(), maxRatioLimit)))
38543854
}
38553855
}
3856+
3857+
// for GPU and hugepages, the default value and defaultRequest value must match if both are specified
3858+
if !helper.IsOvercommitAllowed(api.ResourceName(k)) && defaultQuantityFound && defaultRequestQuantityFound && defaultQuantity.Cmp(defaultRequestQuantity) != 0 {
3859+
allErrs = append(allErrs, field.Invalid(idxPath.Child("defaultRequest").Key(string(k)), defaultRequestQuantity, fmt.Sprintf("default value %s must equal to defaultRequest value %s in %s", defaultQuantity.String(), defaultRequestQuantity.String(), k)))
3860+
}
38563861
}
38573862
}
38583863

0 commit comments

Comments
 (0)