Skip to content

Fix quota result when all limits were exceeded#1059

Merged
agrawroh merged 5 commits intoenvoyproxy:mainfrom
yanavlasov:fix-quota-mode
Mar 18, 2026
Merged

Fix quota result when all limits were exceeded#1059
agrawroh merged 5 commits intoenvoyproxy:mainfrom
yanavlasov:fix-quota-mode

Conversation

@yanavlasov
Copy link
Copy Markdown
Contributor

@yanavlasov yanavlasov commented Feb 5, 2026

Fix results in quota mode when all limits have been exceeded. In this case request should be denied.
Specifically rate limit service will deny the request under following conditions:

  • If at least one descriptor in rate-limit mode had failed (this is the existing behavior and it did not change).
  • Or all quote mode descriptors had failed (this is new behavior introduced in this PR).

@yanavlasov
Copy link
Copy Markdown
Contributor Author

@yuzisun for initial review

@yanavlasov yanavlasov marked this pull request as draft February 5, 2026 23:55
@yanavlasov
Copy link
Copy Markdown
Contributor Author

Need to rework the mixed mode. Will ping when it is ready for review.

exit 1
fi

echo "Wating 1 minute for quota buckets to be refreshed"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
echo "Wating 1 minute for quota buckets to be refreshed"
echo "Waiting 1 minute for quota buckets to be refreshed"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done


response=$(curl -i -s http://envoy-proxy:8888/quota)
if [ $? -ne 0 ]; then
echo "Quota bucket should be refereshed"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
echo "Quota bucket should be refereshed"
echo "Quota bucket should be refreshed"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

response.Statuses = make([]*pb.RateLimitResponse_DescriptorStatus, len(request.Descriptors))
finalCode := pb.RateLimitResponse_OK
if isQuotaMode {
finalCode = pb.RateLimitResponse_OVER_LIMIT
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this behavior be configurable and default to reject ? we may still want to send out and let cloud provider reject as the quota tracking in envoy is best effort and the quota enforcement window may not be exactly aligned with the cloud provider.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like what shadow mode is doing, unless I misunderstand it.

@yanavlasov yanavlasov marked this pull request as ready for review February 9, 2026 20:21
@github-actions
Copy link
Copy Markdown

This pull request has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed in 7 days if no further activity occurs. Please feel free to give a status update now, ping for review, or re-open when it's ready. Thank you for your contributions!

@github-actions github-actions bot added the stale label Mar 12, 2026
@yanavlasov yanavlasov removed the stale label Mar 16, 2026
@yanavlasov yanavlasov assigned agrawroh and unassigned agrawroh Mar 16, 2026
@yanavlasov yanavlasov marked this pull request as draft March 16, 2026 14:54
Signed-off-by: yavlasov <yavlasov@google.com>
Signed-off-by: yavlasov <yavlasov@google.com>
Signed-off-by: yavlasov <yavlasov@google.com>
Signed-off-by: yavlasov <yavlasov@google.com>
Signed-off-by: yavlasov <yavlasov@google.com>
@yanavlasov yanavlasov marked this pull request as ready for review March 17, 2026 14:41
@yuzisun
Copy link
Copy Markdown
Contributor

yuzisun commented Mar 17, 2026

/lgtm

@agrawroh agrawroh merged commit 05c08d0 into envoyproxy:main Mar 18, 2026
6 checks passed
@yanavlasov yanavlasov deleted the fix-quota-mode branch March 18, 2026 14:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants