local ratelimit support virtualhost config#22895
Conversation
Signed-off-by: wangkai19 <wangkai19@corp.netease.com>
|
CC @envoyproxy/api-shepherds: Your approval is needed for changes made to |
|
issue #22793 PTAL, thanks. @wbpcode @mattklein123 |
adisuissa
left a comment
There was a problem hiding this comment.
Thanks for the fix!
Left a high-level API comment.
I think that the code that handles this configuration should also be shared (I'm assuming that if one adds any other enum value, or updates the code, this should be reflected for both the per-route and the local rate-limit).
| } | ||
|
|
||
| // Specifies if the local rate limit filter should include the virtual host rate limits. | ||
| VhRateLimitsOptions vh_rate_limits = 13 [(validate.rules).enum = {defined_only: true}]; |
There was a problem hiding this comment.
IMHO the enum from envoy.extensions.filters.http.ratelimit.v3 should be used.
It would have been better to move this enum to some common location, but unfortunately I think it will break the current API.
There was a problem hiding this comment.
yes, thanks, i will use envoy.extensions.filters.http.ratelimit.v3 instead.
There was a problem hiding this comment.
x1b[0m/build/tmp/_bazel_envoybuild/b570b5ccd0454dc9af9f65ab1833764d/external/envoy_api/envoy/extensions/filters/http/local_ratelimit/v3/BUILD:7:18: GoCompilePkg external/envoy_api/envoy/extensions/filters/http/local_ratelimit/v3/pkg_go_proto.a failed: (Exit 1): builder failed: error executing command (from target @envoy_api//envoy/extensions/filters/http/local_ratelimit/v3:pkg_go_proto) bazel-out/k8-opt-exec-2B5CBBC6/bin/external/go_sdk/builder compilepkg -sdk external/go_sdk -installsuffix linux_amd64 -src ... (remaining 85 arguments skipped)\n\nUse --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging\nbazel-out/k8-fastbuild/bin/external/envoy_api/envoy/extensions/filters/http/local_ratelimit/v3/pkg_go_proto_/github.com/envoyproxy/go-control-plane/envoy/extensions/filters/http/local_ratelimit/v3/local_rate_limit.pb.validate.go:43:6: undefined: "github.com/envoyproxy/go-control-plane/envoy/extensions/filters/http/ratelimit/v3".XRateLimitHeadersRFCVersion\nbazel-out/k8-fastbuild/bin/external/envoy_api/envoy/extensions/filters/http/local_ratelimit/v3/pkg_go_proto_/github.com/envoyproxy/go-control-plane/envoy/extensions/filters/http/local_ratelimit/v3/local_rate_limit.pb.validate.go:343:11: assignment mismatch: 2 variables but 1 value\nbazel-out/k8-fastbuild/bin/external/envoy_api/envoy/extensions/filters/http/local_ratelimit/v3/pkg_go_proto_/github.com/envoyproxy/go-control-plane/envoy/extensions/filters/http/local_ratelimit/v3/local_rate_limit.pb.validate.go:343:14: undefined: "github.com/envoyproxy/go-control-plane/envoy/extensions/common/ratelimit/v3".RateLimitPerRoute_VhRateLimitsOptions_name\ncompilepkg: error running subcommand external/go_sdk/pkg/tool/linux_amd64/compile: exit status 2\n\x1b[32mINFO: \x1b[0mElapsed time: 189.979s, Critical Path: 20.43s\n\x1b[32mINFO: \x1b[0m1278 processes: 24 internal, 1254 processwrapper-sandbox.\n\x1b[31m\x1b[1mFAILED:\x1b[0m Build did NOT complete successfully\n\x1b[31m\x1b[1mFAILED:\x1b[0m Build did NOT complete successfully\n\x1b[0m'
@adisuissa i tried use envoy.extensions.filters.http.ratelimit.v3, but the bazel.api check failed, detailed errors are above. it seems that the go_package name of envoy.extensions.common.ratelimit.v3 and envoy.extensions.filters.http.ratelimit.v3 conflict?
There was a problem hiding this comment.
Yeah, sorry about that.
I guess the way to get around this is to do something similar to what was done for XRateLimitHeadersRFCVersion (context in PR #18157):
|
Please check the CI, thanks. /wait |
Signed-off-by: wangkai19 <wangkai19@corp.netease.com>
|
/retest |
|
Retrying Azure Pipelines: |
|
WARNING: Download from https://github.com/antlr/antlr4/archive/v4.10.1.tar.gz failed: class java.io.FileNotFoundException GET returned 404 Not Found this blocks the pipeline. |
|
/retest |
|
Retrying Azure Pipelines: |
|
@wbpcode CI is passed, PTAL, thanks. |
wbpcode
left a comment
There was a problem hiding this comment.
Thanks for this contribution and some comments are added.
|
|
||
| switch (vh_rate_limit_option) { | ||
| case VhRateLimitOptions::Ignore: | ||
| break; |
| default: | ||
| PANIC("not reached"); |
There was a problem hiding this comment.
nit: PANIC_DUE_TO_CORRUPT_ENUM could be used here.
| switch (specific_per_route_config->virtualHostRateLimits()) { | ||
| case envoy::extensions::common::ratelimit::v3::INCLUDE: | ||
| vh_rate_limits_ = VhRateLimitOptions::Include; | ||
| break; | ||
| case envoy::extensions::common::ratelimit::v3::IGNORE: | ||
| vh_rate_limits_ = VhRateLimitOptions::Ignore; | ||
| break; | ||
| case envoy::extensions::common::ratelimit::v3::OVERRIDE: | ||
| default: | ||
| vh_rate_limits_ = VhRateLimitOptions::Override; | ||
| } |
There was a problem hiding this comment.
use PANIC_ON_PROTO_ENUM_SENTINEL_VALUES here to avoid the default usage.
Signed-off-by: wangkai19 <wangkai19@corp.netease.com>
|
It's looks good overall for me. And please merge main again to fix the CI. Thanks. /wait |
Signed-off-by: wangkai19 <wangkai19@corp.netease.com>
Signed-off-by: wangkai19 <wangkai19@corp.netease.com>
Signed-off-by: wangkai19 <wangkai19@corp.netease.com>
|
/wait |
Signed-off-by: wangkai19 <wangkai19@corp.netease.com>
|
@wbpcode CI is passed, PTAL again, thanks. |
wbpcode
left a comment
There was a problem hiding this comment.
LGTM. Thanks. Defer this to @mattklein123 for final pass.
mattklein123
left a comment
There was a problem hiding this comment.
Thanks LGTM. Can you add a release note please?
/wait
Signed-off-by: wangkai19 <wangkai19@corp.netease.com>
Signed-off-by: wangkai19 <wangkai19@corp.netease.com>
done, thanks. |
Signed-off-by: wangkai19 <wangkai19@corp.netease.com>
Signed-off-by: wangkai19 <wangkai19@corp.netease.com>
|
/retest |
|
Retrying Azure Pipelines: |
|
/retest |
|
Retrying Azure Pipelines: |
|
/retest |
|
Retrying Azure Pipelines: |
Signed-off-by: wangkai19 wangkai19@corp.netease.com
Commit Message: local ratelimit support virtualhost config
Additional Description: N/A
Risk Level: low
Testing: ut
Docs Changes: N/A
Release Notes: N/A