Skip to content

ratelimit: add support for Ratelimit.override per route - #45613

Merged
wbpcode merged 2 commits into
envoyproxy:mainfrom
kanurag94:rl-per-route-override
Jun 13, 2026
Merged

ratelimit: add support for Ratelimit.override per route#45613
wbpcode merged 2 commits into
envoyproxy:mainfrom
kanurag94:rl-per-route-override

Conversation

@kanurag94

@kanurag94 kanurag94 commented Jun 12, 2026

Copy link
Copy Markdown
Member

Commit Message: ratelimit: support the RateLimit.limit override on the RateLimitConfig path

Additional Description:

The RateLimitConfig path (HTTP rate limit filter's rate_limits and per-route RateLimitPerRoute) supported hits_addend but rejected the limit override, so the two couldn't be used on the same rule. This adds override support to that path, matching Router::RateLimitPolicyEntryImpl.

  • RateLimitPolicy now parses RateLimit.Override (when no_limit == false) into the existing Router::DynamicMetadataRateLimitOverride and applies it in populateDescriptors from dynamic metadata.
  • Both FilterConfig (filter-level rate_limits) and FilterConfigPerRoute construct RateLimitConfig with no_limit=false. The local rate limit filter keeps no_limit=true (the override is only meaningful for the gRPC RLS descriptor).

Risk Level: Low — opt-in (only on limit, which previously errored), reuses the existing override impl, no change to existing descriptor output.

Testing: New unit tests for override applied, override + hits_addend together, and missing-metadata; config tests for both the per-route and filter-level wiring. ratelimit_config_test and config_test pass locally.

Docs Changes: Updated the RateLimit.limit field comment in route_components.proto.

Release Notes: Added a new_features changelog entry.

Platform Specific Features: None.

Fixes #45611

Signed-off-by: Anurag Aggarwal <kanurag94@gmail.com>
@repokitteh-read-only

Copy link
Copy Markdown

As a reminder, PRs marked as draft will not be automatically assigned reviewers,
or be handled by maintainer-oncall triage.

Please mark your PR as ready when you want it to be reviewed!

🐱

Caused by: #45613 was opened by kanurag94.

see: more, trace.

@kanurag94
kanurag94 marked this pull request as ready for review June 12, 2026 16:36
@kanurag94
kanurag94 requested a review from mattklein123 as a code owner June 12, 2026 16:36
@repokitteh-read-only

Copy link
Copy Markdown

CC @envoyproxy/api-shepherds: Your approval is needed for changes made to (api/envoy/|docs/root/api-docs/).
envoyproxy/api-shepherds assignee is @wbpcode
CC @envoyproxy/api-watchers: FYI only for changes made to (api/envoy/|docs/root/api-docs/).

🐱

Caused by: #45613 was ready_for_review by kanurag94.

see: more, trace.

The pedantic spell checker rejects the envoyproxy#45611 shorthand.
Use the full issue URL, matching existing convention elsewhere in the repo.

Signed-off-by: Anurag Aggarwal <kanurag94@gmail.com>
@kanurag94
kanurag94 force-pushed the rl-per-route-override branch from ac294eb to 4a84066 Compare June 12, 2026 17:34
@wbpcode

wbpcode commented Jun 13, 2026

Copy link
Copy Markdown
Member

Awesome!

@wbpcode
wbpcode merged commit 656bd59 into envoyproxy:main Jun 13, 2026
29 checks passed
nezdolik pushed a commit to nezdolik/envoy that referenced this pull request Jun 16, 2026
…5613)

**Commit Message:** ratelimit: support the `RateLimit.limit` override on
the `RateLimitConfig` path

**Additional Description:**

The `RateLimitConfig` path (HTTP rate limit filter's `rate_limits` and
per-route `RateLimitPerRoute`) supported `hits_addend` but rejected the
`limit` override, so the two couldn't be used on the same rule. This
adds override support to that path, matching
`Router::RateLimitPolicyEntryImpl`.

- `RateLimitPolicy` now parses `RateLimit.Override` (when `no_limit ==
false`) into the existing `Router::DynamicMetadataRateLimitOverride` and
applies it in `populateDescriptors` from dynamic metadata.
- Both `FilterConfig` (filter-level `rate_limits`) and
`FilterConfigPerRoute` construct `RateLimitConfig` with
`no_limit=false`. The local rate limit filter keeps `no_limit=true` (the
override is only meaningful for the gRPC RLS descriptor).

**Risk Level:** Low — opt-in (only on `limit`, which previously
errored), reuses the existing override impl, no change to existing
descriptor output.

**Testing:** New unit tests for override applied, override +
`hits_addend` together, and missing-metadata; config tests for both the
per-route and filter-level wiring. `ratelimit_config_test` and
`config_test` pass locally.

**Docs Changes:** Updated the `RateLimit.limit` field comment in
`route_components.proto`.

**Release Notes:** Added a `new_features` changelog entry.

**Platform Specific Features:** None.

Fixes envoyproxy#45611

---------

Signed-off-by: Anurag Aggarwal <kanurag94@gmail.com>
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.

Rate limit: limit override (RateLimit.Override) is ignored on the per-route filter-config path, so it can't be combined with hits_addend

2 participants