Merge pull request #62275 from CaoShuFeng/resourcequota_code

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>.

not return 500 status code for insufficient quota

This is not an unexpected error, so it should not return a 500 code, I think.
@derekwaynecarr 

**Release note**:
```release-note
NONE
```
pull/8/head
Kubernetes Submit Queue 2018-04-15 15:49:53 -07:00 committed by GitHub
commit 860403dada
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -431,7 +431,7 @@ func (e *quotaEvaluator) checkRequest(quotas []api.ResourceQuota, a admission.At
// if not, we reject the request.
hasNoCoveringQuota := limitedResourceNamesSet.Difference(restrictedResourcesSet)
if len(hasNoCoveringQuota) > 0 {
return quotas, fmt.Errorf("insufficient quota to consume: %v", strings.Join(hasNoCoveringQuota.List(), ","))
return quotas, admission.NewForbidden(a, fmt.Errorf("insufficient quota to consume: %v", strings.Join(hasNoCoveringQuota.List(), ",")))
}
if len(interestingQuotaIndexes) == 0 {