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

expose configuration for envoy's RateLimitedAsResourceExhausted #4971

Merged

Conversation

vroldanbet
Copy link
Contributor

@vroldanbet vroldanbet commented Jan 10, 2023

Closes #4901

The Rate Limit filter in Envoy translates a 429 HTTP response code to UNAVAILABLE as specified in the gRPC mapping document. Alternatively, Envoy allows translating it to a less ambiguous RESOURCE_EXHAUSTED.

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.

This PR is largely inspired in the work done at #3457

FYI @sunjayBhatia as we discussed about this in #4901

Closes #4901.

@vroldanbet vroldanbet requested a review from a team as a code owner January 10, 2023 18:30
@vroldanbet vroldanbet requested review from tsaarni and stevesloka and removed request for a team January 10, 2023 18:30
@vroldanbet vroldanbet force-pushed the add-ratelimit-grpc-error-code-setting branch from d0d279d to bcc63fa Compare January 10, 2023 18:32
@github-actions
Copy link

Hi @vroldanbet! Welcome to our community and thank you for opening your first Pull Request. Someone will review it soon. Thank you for committing to making Contour better. You can also join us on our mailing list and in our channel in the Kubernetes Slack Workspace

@vroldanbet vroldanbet force-pushed the add-ratelimit-grpc-error-code-setting branch from bcc63fa to 0a3c88d Compare January 10, 2023 18:35
@skriss skriss requested review from sunjayBhatia and skriss January 11, 2023 19:13
@skriss skriss added the release-note/small A small change that needs one line of explanation in the release notes. label Jan 11, 2023
@skriss
Copy link
Member

skriss commented Jan 11, 2023

Thanks for the PR @vroldanbet! Please run make generate and commit the results to get the codegen CI check to pass.

@skriss
Copy link
Member

skriss commented Jan 11, 2023

Please also address https://github.com/projectcontour/contour/actions/runs/3895937483/jobs/6651861120, the output has instructions to follow. Thanks!

@vroldanbet vroldanbet force-pushed the add-ratelimit-grpc-error-code-setting branch 2 times, most recently from 6c32bfb to 147084d Compare January 11, 2023 20:15
@vroldanbet
Copy link
Contributor Author

@skriss done! Ready for another CI run!

examples/contour/01-crds.yaml Outdated Show resolved Hide resolved
@vroldanbet vroldanbet force-pushed the add-ratelimit-grpc-error-code-setting branch 2 times, most recently from 9a9b5e9 to 939e866 Compare January 12, 2023 12:09
@skriss
Copy link
Member

skriss commented Jan 12, 2023

Looks like one UT still needs to be updated for the new field (https://github.com/projectcontour/contour/blob/main/cmd/contour/servecontext_test.go#L623-L645), otherwise this looks good to me

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 vroldanbet force-pushed the add-ratelimit-grpc-error-code-setting branch from 939e866 to 5ecbdb7 Compare January 12, 2023 19:33
@vroldanbet
Copy link
Contributor Author

@skriss just pushed the fix, thanks for your patience and prompt feedback 🙏🏻

@codecov
Copy link

codecov bot commented Jan 12, 2023

Codecov Report

Merging #4971 (5ecbdb7) into main (63dd999) will increase coverage by 0.00%.
The diff coverage is 65.00%.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #4971   +/-   ##
=======================================
  Coverage   77.61%   77.61%           
=======================================
  Files         140      140           
  Lines       16871    16875    +4     
=======================================
+ Hits        13094    13098    +4     
  Misses       3520     3520           
  Partials      257      257           
Impacted Files Coverage Δ
cmd/contour/serve.go 22.31% <0.00%> (-0.04%) ⬇️
pkg/config/parameters.go 86.61% <ø> (ø)
cmd/contour/servecontext.go 80.91% <100.00%> (+0.05%) ⬆️
internal/envoy/v3/ratelimit.go 100.00% <100.00%> (ø)
internal/xdscache/v3/listener.go 91.33% <100.00%> (+0.02%) ⬆️
internal/sorter/sorter.go 98.97% <0.00%> (+0.51%) ⬆️

@vroldanbet vroldanbet requested review from skriss and removed request for tsaarni and stevesloka January 12, 2023 20:19
Copy link
Member

@skriss skriss left a comment

Choose a reason for hiding this comment

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

LGTM, thanks @vroldanbet!

@skriss skriss merged commit c06623a into projectcontour:main Jan 12, 2023
@vroldanbet vroldanbet deleted the add-ratelimit-grpc-error-code-setting branch January 12, 2023 22:41
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
release-note/small A small change that needs one line of explanation in the release notes.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Question: Returning custom gRPC header or status in rate limiting
3 participants