mirror of https://github.com/k3s-io/k3s
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
commit
20a1a647f3
|
@ -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)))
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue