diff --git a/pkg/api/validation/validation.go b/pkg/api/validation/validation.go index ff38e7fa09..b76bb4fad0 100644 --- a/pkg/api/validation/validation.go +++ b/pkg/api/validation/validation.go @@ -2211,15 +2211,7 @@ func ValidateResourceRequirements(requirements *api.ResourceRequirements, fldPat // Check that request <= limit. requestQuantity, exists := requirements.Requests[resourceName] if exists { - var requestValue, limitValue int64 - requestValue = requestQuantity.Value() - limitValue = quantity.Value() - // Do a more precise comparison if possible (if the value won't overflow). - if requestValue <= resource.MaxMilliValue && limitValue <= resource.MaxMilliValue { - requestValue = requestQuantity.MilliValue() - limitValue = quantity.MilliValue() - } - if limitValue < requestValue { + if quantity.Cmp(requestQuantity) < 0 { allErrs = append(allErrs, field.Invalid(fldPath, quantity.String(), "must be greater than or equal to request")) } }