Skip to content
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

Merged
merged 5 commits into from
Nov 7, 2018

Conversation

venilnoronha
Copy link
Member

@venilnoronha venilnoronha commented Oct 27, 2018

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 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 PR 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:

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

@venilnoronha venilnoronha force-pushed the config-grpc-status branch 2 times, most recently from ab2877a to 7f58656 Compare October 27, 2018 03:42
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]>
@lizan lizan self-assigned this Oct 27, 2018
include/envoy/http/filter.h Show resolved Hide resolved
@stale
Copy link

stale bot commented Nov 6, 2018

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!

@stale stale bot added the stale stalebot believes this issue/PR has not been touched recently label Nov 6, 2018
@venilnoronha
Copy link
Member Author

not stale.

@stale stale bot removed the stale stalebot believes this issue/PR has not been touched recently label Nov 6, 2018
@mattklein123
Copy link
Member

@lizan @junr03 ping on review.

Copy link
Member

@lizan lizan left a 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.

Copy link
Member

@junr03 junr03 left a 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;
Copy link
Member

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.

Copy link
Member

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.

Copy link
Member

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.

test/common/http/utility_test.cc Outdated Show resolved Hide resolved
* 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]>
@mattklein123 mattklein123 merged commit f71a883 into envoyproxy:master Nov 7, 2018
vroldanbet added a commit to vroldanbet/contour that referenced this pull request Jan 10, 2023
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.
vroldanbet added a commit to vroldanbet/contour that referenced this pull request Jan 10, 2023
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]>
vroldanbet added a commit to vroldanbet/contour that referenced this pull request Jan 10, 2023
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]>
vroldanbet added a commit to vroldanbet/contour that referenced this pull request Jan 11, 2023
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]>
vroldanbet added a commit to vroldanbet/contour that referenced this pull request Jan 11, 2023
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]>
vroldanbet added a commit to vroldanbet/contour that referenced this pull request Jan 12, 2023
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]>
vroldanbet added a commit to vroldanbet/contour that referenced this pull request Jan 12, 2023
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]>
vroldanbet added a commit to vroldanbet/contour that referenced this pull request Jan 12, 2023
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]>
skriss pushed a commit to projectcontour/contour that referenced this pull request Jan 12, 2023
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]>
yangyy93 pushed a commit to projectsesame/contour that referenced this pull request Feb 16, 2023
…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]>
yangyy93 pushed a commit to projectsesame/contour that referenced this pull request Feb 16, 2023
…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]>
yangyy93 pushed a commit to projectsesame/contour that referenced this pull request Feb 16, 2023
…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]>
yangyy93 pushed a commit to projectsesame/contour that referenced this pull request Feb 16, 2023
…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]>
vmw-yingy pushed a commit to vmw-yingy/contour that referenced this pull request Feb 28, 2023
…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]>
yangyy93 added a commit to projectsesame/contour that referenced this pull request Mar 10, 2023
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]>
yangyy93 added a commit to projectsesame/contour that referenced this pull request Mar 27, 2023
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]>
yangyy93 added a commit to projectsesame/contour that referenced this pull request Mar 27, 2023
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]>
yangyy93 added a commit to projectsesame/contour that referenced this pull request Mar 27, 2023
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]>
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.

5 participants