Skip to content
This repository was archived by the owner on Mar 16, 2024. It is now read-only.

Commit 4441b64

Browse files
authored
Merge pull request #2217 from tylerslaton/fix-quota-status
Improve error messaging for QuotaRequestInstances
2 parents 2d44729 + 79804e1 commit 4441b64

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

pkg/controller/quota/quota.go

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -44,18 +44,15 @@ func WaitForAllocation(req router.Request, resp router.Response) error {
4444
}
4545

4646
/*
47-
Determine how to proceed depending on if the quotaRequest exists and what it has written to its status. The four scenarios
48-
are QuotaRequest:
47+
Determine how to proceed depending on if the quotaRequest exists and what it has written to its status. The three scenarios
48+
are the QuotaRequest:
4949
50-
1. Exists and has set FailedResources implying that the quota allocation failed.
51-
2. Exists and had an error while trying to allocate quota.
52-
3. Does not exist or has not yet been allocated the resources requested.
53-
4. Exists and has successfully allocated the resources requested.
50+
1. Exists and had an error while trying to allocate quota.
51+
2. Does not exist or has not yet been allocated the resources requested.
52+
3. Exists and has successfully allocated the resources requested.
5453
*/
55-
if quotaRequest.Status.FailedResources != nil {
56-
status.Error(fmt.Errorf("failed to provision the following resources: %v", quotaRequest.Status.FailedResources.ToString()))
57-
} else if cond := quotaRequest.Status.Condition(adminv1.QuotaRequestCondition); cond.Error {
58-
status.Error(fmt.Errorf("error occurred while trying to allocate quota: %v", cond.Message))
54+
if cond := quotaRequest.Status.Condition(adminv1.QuotaRequestCondition); cond.Error {
55+
status.Error(fmt.Errorf("quota allocation failed: %v", cond.Message))
5956
} else if err != nil || !quotaRequest.Spec.Resources.Equals(quotaRequest.Status.AllocatedResources) {
6057
status.Unknown("waiting for quota allocation")
6158
} else if quotaRequest.Status.Condition(adminv1.QuotaRequestCondition).Success {

0 commit comments

Comments
 (0)