Merge pull request #54387 from tianshapjq/validation-errorinfo

Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

correct the error info when resourceName equals to hugepage

**What this PR does / why we need it**:
when the resourceName eqauls to hugepage, the error info outputs as NvidiaGPU, which should be corrected.
pull/6/head
Kubernetes Submit Queue 2017-11-05 06:49:30 -08:00 committed by GitHub
commit 20a1a647f3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -4044,7 +4044,7 @@ func ValidateResourceRequirements(requirements *api.ResourceRequirements, fldPat
if exists {
// For GPUs, not only requests can't exceed limits, they also can't be lower, i.e. must be equal.
if quantity.Cmp(limitQuantity) != 0 && !helper.IsOvercommitAllowed(resourceName) {
allErrs = append(allErrs, field.Invalid(reqPath, quantity.String(), fmt.Sprintf("must be equal to %s limit", api.ResourceNvidiaGPU)))
allErrs = append(allErrs, field.Invalid(reqPath, quantity.String(), fmt.Sprintf("must be equal to %s limit", resourceName)))
} else if quantity.Cmp(limitQuantity) > 0 {
allErrs = append(allErrs, field.Invalid(reqPath, quantity.String(), fmt.Sprintf("must be less than or equal to %s limit", resourceName)))
}