-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
rate-limit: make 429 response mapping configurable #4879
rate-limit: make 429 response mapping configurable #4879
Conversation
ab2877a
to
7f58656
Compare
This commit enables the configuration of the mapping that translates 429 response code to a gRPC status code. By default, the Rate Limit filter in Envoy translates a 429 HTTP response code to UNAVAILABLE as specified in the gRPC mapping document. Google, however, recommends translating a 429 response to RESOURCE_EXHAUSTED. This commit provides a flag named rate_limited_as_resource_exhausted in the RateLimit config which allows users to explicitly specify whether they want 429 responses to be mapped to RESOURCE_EXHAUSTED, while UNAVAILABLE remains the default. References: * https://github.com/grpc/grpc/blob/master/doc/http-grpc-status-mapping.md * https://cloud.google.com/apis/design/errors#generating_errors Signed-off-by: Venil Noronha <[email protected]>
7f58656
to
44967f0
Compare
Signed-off-by: Venil Noronha <[email protected]>
b7cd9e7
to
161ba4d
Compare
Signed-off-by: Venil Noronha <[email protected]>
Signed-off-by: Venil Noronha <[email protected]>
This pull request has been automatically marked as stale because it has not had activity in the last 7 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! |
not stale. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, sorry for the delay.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks, just a few comments
*/ | ||
virtual void sendLocalReply(Code response_code, const std::string& body_text, | ||
std::function<void(HeaderMap& headers)> modify_headers) PURE; | ||
std::function<void(HeaderMap& headers)> modify_headers, | ||
const absl::optional<Grpc::Status::GrpcStatus> grpc_status) PURE; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have been thinking more and more about our changes to the filter API. Every time we change this API we are making every person that has written thirdparty filters update. I don't know if there are better solutions to make argument extension in these functions easier/less painful for consumers. I am curious what the rest of the @envoyproxy/maintainers thoughts are about this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are tracking this concern here: #3390. Right now we decided that we are OK with API changes so that we can continue to move relatively fast. This will likely not always be the case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#3390 is for this, I think now we are OK but need release notes for extension impacting API changes.
* Add release note on HTTP filter API change * Update rate_limit proto comment * Update test to use utility function instead of hard-coded string Signed-off-by: Venil Noronha <[email protected]>
The Rate Limit filter in Envoy translates a 429 HTTP response code to UNAVAILABLE as specified in the gRPC mapping document, but Google recommends translating it to RESOURCE_EXHAUSTED (see https://github.com/grpc/grpc/blob/master/doc/http-grpc-status-mapping.md) This commit introduces a new setting to allow contour to forward the same parameter introduced in envoyproxy/envoy#4879 The default value is disabled to retain the original behaviour of returning UNAVAILABLE, as changing it would be a breaking change.
The Rate Limit filter in Envoy translates a 429 HTTP response code to UNAVAILABLE as specified in the gRPC mapping document, but Google recommends translating it to RESOURCE_EXHAUSTED (see https://github.com/grpc/grpc/blob/master/doc/http-grpc-status-mapping.md) This commit introduces a new setting to allow contour to forward the same parameter introduced in envoyproxy/envoy#4879 The default value is disabled to retain the original behaviour of returning UNAVAILABLE, as changing it would be a breaking change. Signed-off-by: Victor Roldan Betancort <[email protected]>
The Rate Limit filter in Envoy translates a 429 HTTP response code to UNAVAILABLE as specified in the gRPC mapping document, but Google recommends translating it to RESOURCE_EXHAUSTED (see https://github.com/grpc/grpc/blob/master/doc/http-grpc-status-mapping.md) This commit introduces a new setting to allow contour to forward the same parameter introduced in envoyproxy/envoy#4879 The default value is disabled to retain the original behaviour of returning UNAVAILABLE, as changing it would be a breaking change. Signed-off-by: Víctor Roldán Betancort <[email protected]>
The Rate Limit filter in Envoy translates a 429 HTTP response code to UNAVAILABLE as specified in the gRPC mapping document, but Google recommends translating it to RESOURCE_EXHAUSTED (see https://github.com/grpc/grpc/blob/master/doc/http-grpc-status-mapping.md) This commit introduces a new setting to allow contour to forward the same parameter introduced in envoyproxy/envoy#4879 The default value is disabled to retain the original behaviour of returning UNAVAILABLE, as changing it would be a breaking change. Signed-off-by: Víctor Roldán Betancort <[email protected]>
The Rate Limit filter in Envoy translates a 429 HTTP response code to UNAVAILABLE as specified in the gRPC mapping document, but Google recommends translating it to RESOURCE_EXHAUSTED (see https://github.com/grpc/grpc/blob/master/doc/http-grpc-status-mapping.md) This commit introduces a new setting to allow contour to forward the same parameter introduced in envoyproxy/envoy#4879 The default value is disabled to retain the original behaviour of returning UNAVAILABLE, as changing it would be a breaking change. Signed-off-by: Víctor Roldán Betancort <[email protected]>
The Rate Limit filter in Envoy translates a 429 HTTP response code to UNAVAILABLE as specified in the gRPC mapping document, but Google recommends translating it to RESOURCE_EXHAUSTED (see https://github.com/grpc/grpc/blob/master/doc/http-grpc-status-mapping.md) This commit introduces a new setting to allow contour to forward the same parameter introduced in envoyproxy/envoy#4879 The default value is disabled to retain the original behaviour of returning UNAVAILABLE, as changing it would be a breaking change. Signed-off-by: Víctor Roldán Betancort <[email protected]>
The Rate Limit filter in Envoy translates a 429 HTTP response code to UNAVAILABLE as specified in the gRPC mapping document, but Google recommends translating it to RESOURCE_EXHAUSTED (see https://github.com/grpc/grpc/blob/master/doc/http-grpc-status-mapping.md) This commit introduces a new setting to allow contour to forward the same parameter introduced in envoyproxy/envoy#4879 The default value is disabled to retain the original behaviour of returning UNAVAILABLE, as changing it would be a breaking change. Signed-off-by: Víctor Roldán Betancort <[email protected]>
The Rate Limit filter in Envoy translates a 429 HTTP response code to UNAVAILABLE as specified in the gRPC mapping document, but Google recommends translating it to RESOURCE_EXHAUSTED (see https://github.com/grpc/grpc/blob/master/doc/http-grpc-status-mapping.md) This commit introduces a new setting to allow contour to forward the same parameter introduced in envoyproxy/envoy#4879 The default value is disabled to retain the original behaviour of returning UNAVAILABLE, as changing it would be a breaking change. Signed-off-by: Víctor Roldán Betancort <[email protected]>
The Rate Limit filter in Envoy translates a 429 HTTP response code to UNAVAILABLE as specified in the gRPC mapping document, but Google recommends translating it to RESOURCE_EXHAUSTED (see https://github.com/grpc/grpc/blob/master/doc/http-grpc-status-mapping.md) This commit introduces a new setting to allow contour to forward the same parameter introduced in envoyproxy/envoy#4879 The default value is disabled to retain the original behaviour of returning UNAVAILABLE, as changing it would be a breaking change. Closes #4901. Signed-off-by: Víctor Roldán Betancort <[email protected]>
…ectcontour#4971) The Rate Limit filter in Envoy translates a 429 HTTP response code to UNAVAILABLE as specified in the gRPC mapping document, but Google recommends translating it to RESOURCE_EXHAUSTED (see https://github.com/grpc/grpc/blob/master/doc/http-grpc-status-mapping.md) This commit introduces a new setting to allow contour to forward the same parameter introduced in envoyproxy/envoy#4879 The default value is disabled to retain the original behaviour of returning UNAVAILABLE, as changing it would be a breaking change. Closes projectcontour#4901. Signed-off-by: Víctor Roldán Betancort <[email protected]> Signed-off-by: yy <[email protected]>
…ectcontour#4971) The Rate Limit filter in Envoy translates a 429 HTTP response code to UNAVAILABLE as specified in the gRPC mapping document, but Google recommends translating it to RESOURCE_EXHAUSTED (see https://github.com/grpc/grpc/blob/master/doc/http-grpc-status-mapping.md) This commit introduces a new setting to allow contour to forward the same parameter introduced in envoyproxy/envoy#4879 The default value is disabled to retain the original behaviour of returning UNAVAILABLE, as changing it would be a breaking change. Closes projectcontour#4901. Signed-off-by: Víctor Roldán Betancort <[email protected]> Signed-off-by: yy <[email protected]>
…ectcontour#4971) The Rate Limit filter in Envoy translates a 429 HTTP response code to UNAVAILABLE as specified in the gRPC mapping document, but Google recommends translating it to RESOURCE_EXHAUSTED (see https://github.com/grpc/grpc/blob/master/doc/http-grpc-status-mapping.md) This commit introduces a new setting to allow contour to forward the same parameter introduced in envoyproxy/envoy#4879 The default value is disabled to retain the original behaviour of returning UNAVAILABLE, as changing it would be a breaking change. Closes projectcontour#4901. Signed-off-by: Víctor Roldán Betancort <[email protected]> Signed-off-by: yy <[email protected]>
…ectcontour#4971) The Rate Limit filter in Envoy translates a 429 HTTP response code to UNAVAILABLE as specified in the gRPC mapping document, but Google recommends translating it to RESOURCE_EXHAUSTED (see https://github.com/grpc/grpc/blob/master/doc/http-grpc-status-mapping.md) This commit introduces a new setting to allow contour to forward the same parameter introduced in envoyproxy/envoy#4879 The default value is disabled to retain the original behaviour of returning UNAVAILABLE, as changing it would be a breaking change. Closes projectcontour#4901. Signed-off-by: Víctor Roldán Betancort <[email protected]> Signed-off-by: yy <[email protected]>
…ectcontour#4971) The Rate Limit filter in Envoy translates a 429 HTTP response code to UNAVAILABLE as specified in the gRPC mapping document, but Google recommends translating it to RESOURCE_EXHAUSTED (see https://github.com/grpc/grpc/blob/master/doc/http-grpc-status-mapping.md) This commit introduces a new setting to allow contour to forward the same parameter introduced in envoyproxy/envoy#4879 The default value is disabled to retain the original behaviour of returning UNAVAILABLE, as changing it would be a breaking change. Closes projectcontour#4901. Signed-off-by: Víctor Roldán Betancort <[email protected]>
Signed-off-by: yy <[email protected]> add some unit test Signed-off-by: yy <[email protected]> git rebase Signed-off-by: yy <[email protected]> expose configuration for envoy's RateLimitedAsResourceExhausted (projectcontour#4971) The Rate Limit filter in Envoy translates a 429 HTTP response code to UNAVAILABLE as specified in the gRPC mapping document, but Google recommends translating it to RESOURCE_EXHAUSTED (see https://github.com/grpc/grpc/blob/master/doc/http-grpc-status-mapping.md) This commit introduces a new setting to allow contour to forward the same parameter introduced in envoyproxy/envoy#4879 The default value is disabled to retain the original behaviour of returning UNAVAILABLE, as changing it would be a breaking change. Closes projectcontour#4901. Signed-off-by: Víctor Roldán Betancort <[email protected]> Signed-off-by: yy <[email protected]> rebase Signed-off-by: yy <[email protected]> update tracing config validate Signed-off-by: yy <[email protected]> make generate Signed-off-by: yy <[email protected]> add chengelog Signed-off-by: yy <[email protected]> update make general Signed-off-by: yy <[email protected]> goimport Signed-off-by: yy <[email protected]> update tracing Signed-off-by: yy <[email protected]> fix golint Signed-off-by: yy <[email protected]> update test Signed-off-by: yy <[email protected]> delete unused code Signed-off-by: yy <[email protected]> delete error file Signed-off-by: yy <[email protected]> update changelog Signed-off-by: yy <[email protected]> fix some mistake Signed-off-by: yy <[email protected]>
Signed-off-by: yy <[email protected]> add some unit test Signed-off-by: yy <[email protected]> git rebase Signed-off-by: yy <[email protected]> expose configuration for envoy's RateLimitedAsResourceExhausted (projectcontour#4971) The Rate Limit filter in Envoy translates a 429 HTTP response code to UNAVAILABLE as specified in the gRPC mapping document, but Google recommends translating it to RESOURCE_EXHAUSTED (see https://github.com/grpc/grpc/blob/master/doc/http-grpc-status-mapping.md) This commit introduces a new setting to allow contour to forward the same parameter introduced in envoyproxy/envoy#4879 The default value is disabled to retain the original behaviour of returning UNAVAILABLE, as changing it would be a breaking change. Closes projectcontour#4901. Signed-off-by: Víctor Roldán Betancort <[email protected]> Signed-off-by: yy <[email protected]> rebase Signed-off-by: yy <[email protected]> update tracing config validate Signed-off-by: yy <[email protected]> make generate Signed-off-by: yy <[email protected]> add chengelog Signed-off-by: yy <[email protected]> update make general Signed-off-by: yy <[email protected]> goimport Signed-off-by: yy <[email protected]> update tracing Signed-off-by: yy <[email protected]> fix golint Signed-off-by: yy <[email protected]> update test Signed-off-by: yy <[email protected]> delete unused code Signed-off-by: yy <[email protected]> delete error file Signed-off-by: yy <[email protected]> update changelog Signed-off-by: yy <[email protected]> fix some mistake Signed-off-by: yy <[email protected]>
Signed-off-by: yy <[email protected]> add some unit test Signed-off-by: yy <[email protected]> git rebase Signed-off-by: yy <[email protected]> expose configuration for envoy's RateLimitedAsResourceExhausted (projectcontour#4971) The Rate Limit filter in Envoy translates a 429 HTTP response code to UNAVAILABLE as specified in the gRPC mapping document, but Google recommends translating it to RESOURCE_EXHAUSTED (see https://github.com/grpc/grpc/blob/master/doc/http-grpc-status-mapping.md) This commit introduces a new setting to allow contour to forward the same parameter introduced in envoyproxy/envoy#4879 The default value is disabled to retain the original behaviour of returning UNAVAILABLE, as changing it would be a breaking change. Closes projectcontour#4901. Signed-off-by: Víctor Roldán Betancort <[email protected]> Signed-off-by: yy <[email protected]> rebase Signed-off-by: yy <[email protected]> update tracing config validate Signed-off-by: yy <[email protected]> make generate Signed-off-by: yy <[email protected]> add chengelog Signed-off-by: yy <[email protected]> update make general Signed-off-by: yy <[email protected]> goimport Signed-off-by: yy <[email protected]> update tracing Signed-off-by: yy <[email protected]> fix golint Signed-off-by: yy <[email protected]> update test Signed-off-by: yy <[email protected]> delete unused code Signed-off-by: yy <[email protected]> delete error file Signed-off-by: yy <[email protected]> update changelog Signed-off-by: yy <[email protected]> fix some mistake Signed-off-by: yy <[email protected]> feat: Add HTTP support for External Auth (projectcontour#4994) Support globally configuring an external auth server which is enabled by default for all vhosts, both HTTP and HTTPS. Closes projectcontour#4954. Signed-off-by: claytonig <[email protected]> Signed-off-by: yy <[email protected]> refactor DAG and DAG consumers to support >2 Listeners (projectcontour#5128) Updates projectcontour#4960. Signed-off-by: Steve Kriss <[email protected]> Signed-off-by: yy <[email protected]> resolve conflict Signed-off-by: yy <[email protected]> fix Signed-off-by: yy <[email protected]>
Signed-off-by: yy <[email protected]> add some unit test Signed-off-by: yy <[email protected]> git rebase Signed-off-by: yy <[email protected]> expose configuration for envoy's RateLimitedAsResourceExhausted (projectcontour#4971) The Rate Limit filter in Envoy translates a 429 HTTP response code to UNAVAILABLE as specified in the gRPC mapping document, but Google recommends translating it to RESOURCE_EXHAUSTED (see https://github.com/grpc/grpc/blob/master/doc/http-grpc-status-mapping.md) This commit introduces a new setting to allow contour to forward the same parameter introduced in envoyproxy/envoy#4879 The default value is disabled to retain the original behaviour of returning UNAVAILABLE, as changing it would be a breaking change. Closes projectcontour#4901. Signed-off-by: Víctor Roldán Betancort <[email protected]> Signed-off-by: yy <[email protected]> rebase Signed-off-by: yy <[email protected]> update tracing config validate Signed-off-by: yy <[email protected]> make generate Signed-off-by: yy <[email protected]> add chengelog Signed-off-by: yy <[email protected]> update make general Signed-off-by: yy <[email protected]> goimport Signed-off-by: yy <[email protected]> update tracing Signed-off-by: yy <[email protected]> fix golint Signed-off-by: yy <[email protected]> update test Signed-off-by: yy <[email protected]> delete unused code Signed-off-by: yy <[email protected]> delete error file Signed-off-by: yy <[email protected]> update changelog Signed-off-by: yy <[email protected]> fix some mistake Signed-off-by: yy <[email protected]> feat: Add HTTP support for External Auth (projectcontour#4994) Support globally configuring an external auth server which is enabled by default for all vhosts, both HTTP and HTTPS. Closes projectcontour#4954. Signed-off-by: claytonig <[email protected]> Signed-off-by: yy <[email protected]> refactor DAG and DAG consumers to support >2 Listeners (projectcontour#5128) Updates projectcontour#4960. Signed-off-by: Steve Kriss <[email protected]> Signed-off-by: yy <[email protected]> resolve conflict Signed-off-by: yy <[email protected]> fix Signed-off-by: yy <[email protected]>
Description: This PR enables the configuration of the mapping that translates
429
response code to a gRPC status code. By default, the Rate Limit filter in Envoy translates a429
HTTP response code toUNAVAILABLE
as specified in the gRPC mapping document. Google, however, recommends translating a429
response toRESOURCE_EXHAUSTED
. This PR provides a flag namedrate_limited_as_resource_exhausted
in theRateLimit
config which allows users to explicitly specify whether they want429
responses to be mapped toRESOURCE_EXHAUSTED
, whileUNAVAILABLE
remains the default.References:
Risk Level: Low
Testing: Added 2 new tests
Docs Changes: N/A
Release Notes: Added a note about the configuration
Fixes #4735
/cc @ramaraochavali @lizan