Skip to content

Support dynamic limit override in ratelimit filter#11770

Merged
mattklein123 merged 3 commits intoenvoyproxy:masterfrom
Pchelolo:rate_limit_overrides
Jun 28, 2020
Merged

Support dynamic limit override in ratelimit filter#11770
mattklein123 merged 3 commits intoenvoyproxy:masterfrom
Pchelolo:rate_limit_overrides

Conversation

@Pchelolo
Copy link
Copy Markdown
Contributor

Signed-off-by: Petr Pchelko ppchelko@wikimedia.org

Commit Message: Support dynamic limit override in ratelimit filter
Additional Description: Provides a way to specify dynamic rate limit override in the rate limit descriptor from static value or from dynamic metadata. New type, RateLimitUnit was created to share across config protocol and rate limit service protocol. A PR for the reference implementation of the rate limit service will follow after the API changes are discussed and accepted.
Risk Level: low
Testing: unit tests
Docs Changes: Documented new proto messages. Added a section on rate limit overrides to rate_limit_filter.rst
Release Notes:
Fixes #11595

@repokitteh-read-only
Copy link
Copy Markdown

CC @envoyproxy/api-shepherds: Your approval is needed for changes made to api/envoy/.
CC @envoyproxy/api-watchers: FYI only for changes made to api/envoy/.

🐱

Caused by: #11770 was opened by Pchelolo.

see: more, trace.

@mattklein123 mattklein123 self-assigned this Jun 26, 2020
@Pchelolo Pchelolo changed the title Support dynamic limit override in ratelimit filter WIP: Support dynamic limit override in ratelimit filter Jun 26, 2020
@Pchelolo
Copy link
Copy Markdown
Contributor Author

Pchelolo commented Jun 26, 2020

Originally I had a GenericValue override type that allowed to provide a static value for the override, just like GenericKey for rate limit actions. However, it required importing the new RateLimitUnit enum into the route_components, and I've hit the bug bufbuild/protoc-gen-validate#172

I intend to fix that bug and create a followup PR to include support for generic value override, but I figured it doesn't worth blocking on it.

@Pchelolo Pchelolo force-pushed the rate_limit_overrides branch 3 times, most recently from 26a932d to 8a7009a Compare June 26, 2020 19:57
Signed-off-by: Petr Pchelko <ppchelko@wikimedia.org>
@Pchelolo Pchelolo force-pushed the rate_limit_overrides branch from 8a7009a to 3facbae Compare June 26, 2020 20:14
@Pchelolo Pchelolo changed the title WIP: Support dynamic limit override in ratelimit filter Support dynamic limit override in ratelimit filter Jun 26, 2020
Signed-off-by: Petr Pchelko <ppchelko@wikimedia.org>
Copy link
Copy Markdown
Member

@mattklein123 mattklein123 left a comment

Choose a reason for hiding this comment

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

Thanks really great work. Just a few small comments.

/wait

// [#protodoc-title: Ratelimit Time Unit]

// Identifies the unit of of time for rate limit.
enum RateLimitUnit {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is copied out from rls.proto, right? Can we at least put a note in that proto to use this type in the next major version? I think I would also be OK with a compile breaking (not wire) change to just use this new proto for the RLS service but will defer to @htuch on that.

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.

Yeah. I wanted to reuse it there initially and then realized that would not be b/c. Left a TODO comment for v4 in rls.proto

path:
- key: test

Will lookup the value of the dynamic metadata, and if it contains the following structure:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

In terms of structure can you be very clear on what the structure needs to be in terms of field names, types, etc.?

Can we also document this here? https://www.envoyproxy.io/docs/envoy/latest/configuration/advanced/well_known_dynamic_metadata and maybe cross link if appropriate?

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.

Signed-off-by: Petr Pchelko <ppchelko@wikimedia.org>
@Pchelolo Pchelolo force-pushed the rate_limit_overrides branch from 35ee458 to 431bd5f Compare June 28, 2020 20:51
@Pchelolo Pchelolo requested a review from mattklein123 June 28, 2020 21:39
Copy link
Copy Markdown
Member

@mattklein123 mattklein123 left a comment

Choose a reason for hiding this comment

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

Thanks! (In the future please never force push as it breaks reviews. Just merge main and add commits.)

@mattklein123 mattklein123 merged commit 7ea1f24 into envoyproxy:master Jun 28, 2020
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.

Proposal: support for dynamic rate limits

2 participants