From dc8b16323e472bb473a5e19e5864dac8d11eb8ff Mon Sep 17 00:00:00 2001 From: "data-plane-api(CircleCI)" Date: Mon, 17 Dec 2018 18:55:42 +0000 Subject: [PATCH] ratelimit: add support for rate limit service config in filters (#5242) Signed-off-by: Rama Chavali Mirrored from https://github.com/envoyproxy/envoy @ 494535f71a1befbaec21ad3aea710186ed2ac8ca --- envoy/config/bootstrap/v2/bootstrap.proto | 2 +- envoy/config/filter/http/rate_limit/v2/BUILD | 3 +++ envoy/config/filter/http/rate_limit/v2/rate_limit.proto | 9 +++++++++ envoy/config/filter/network/rate_limit/v2/BUILD | 5 ++++- .../config/filter/network/rate_limit/v2/rate_limit.proto | 9 +++++++++ envoy/config/filter/thrift/rate_limit/v2alpha1/BUILD | 5 ++++- .../filter/thrift/rate_limit/v2alpha1/rate_limit.proto | 9 +++++++++ envoy/config/ratelimit/v2/BUILD | 4 +--- 8 files changed, 40 insertions(+), 6 deletions(-) diff --git a/envoy/config/bootstrap/v2/bootstrap.proto b/envoy/config/bootstrap/v2/bootstrap.proto index 3a657ebe..453e7dff 100644 --- a/envoy/config/bootstrap/v2/bootstrap.proto +++ b/envoy/config/bootstrap/v2/bootstrap.proto @@ -114,7 +114,7 @@ message Bootstrap { // Configuration for an external rate limit service provider. If not // specified, any calls to the rate limit service will immediately return // success. - envoy.config.ratelimit.v2.RateLimitServiceConfig rate_limit_service = 10; + envoy.config.ratelimit.v2.RateLimitServiceConfig rate_limit_service = 10 [deprecated = true]; // Configuration for the runtime configuration provider. If not specified, a // “null” provider will be used which will result in all defaults being used. diff --git a/envoy/config/filter/http/rate_limit/v2/BUILD b/envoy/config/filter/http/rate_limit/v2/BUILD index 3b90a57c..ea14e697 100644 --- a/envoy/config/filter/http/rate_limit/v2/BUILD +++ b/envoy/config/filter/http/rate_limit/v2/BUILD @@ -5,4 +5,7 @@ licenses(["notice"]) # Apache 2 api_proto_library_internal( name = "rate_limit", srcs = ["rate_limit.proto"], + deps = [ + "//envoy/config/ratelimit/v2:rls", + ], ) diff --git a/envoy/config/filter/http/rate_limit/v2/rate_limit.proto b/envoy/config/filter/http/rate_limit/v2/rate_limit.proto index 72635a74..773d1153 100644 --- a/envoy/config/filter/http/rate_limit/v2/rate_limit.proto +++ b/envoy/config/filter/http/rate_limit/v2/rate_limit.proto @@ -3,6 +3,8 @@ syntax = "proto3"; package envoy.config.filter.http.rate_limit.v2; option go_package = "v2"; +import "envoy/config/ratelimit/v2/rls.proto"; + import "google/protobuf/duration.proto"; import "validate/validate.proto"; @@ -45,4 +47,11 @@ message RateLimit { // of the default `UNAVAILABLE` gRPC code for a rate limited gRPC call. The // HTTP code will be 200 for a gRPC response. bool rate_limited_as_resource_exhausted = 6; + + // Configuration for an external rate limit service provider. If not + // specified, any calls to the rate limit service will immediately return + // success. + // [#comment:TODO(ramaraochavali): Make this required as part of cleanup of deprecated ratelimit + // service config in bootstrap.] + envoy.config.ratelimit.v2.RateLimitServiceConfig rate_limit_service = 7; } diff --git a/envoy/config/filter/network/rate_limit/v2/BUILD b/envoy/config/filter/network/rate_limit/v2/BUILD index 2cda26cf..8840043b 100644 --- a/envoy/config/filter/network/rate_limit/v2/BUILD +++ b/envoy/config/filter/network/rate_limit/v2/BUILD @@ -5,5 +5,8 @@ licenses(["notice"]) # Apache 2 api_proto_library_internal( name = "rate_limit", srcs = ["rate_limit.proto"], - deps = ["//envoy/api/v2/ratelimit"], + deps = [ + "//envoy/api/v2/ratelimit", + "//envoy/config/ratelimit/v2:rls", + ], ) diff --git a/envoy/config/filter/network/rate_limit/v2/rate_limit.proto b/envoy/config/filter/network/rate_limit/v2/rate_limit.proto index fe579f01..c0a2d8f5 100644 --- a/envoy/config/filter/network/rate_limit/v2/rate_limit.proto +++ b/envoy/config/filter/network/rate_limit/v2/rate_limit.proto @@ -4,6 +4,8 @@ package envoy.config.filter.network.rate_limit.v2; option go_package = "v2"; import "envoy/api/v2/ratelimit/ratelimit.proto"; +import "envoy/config/ratelimit/v2/rls.proto"; + import "google/protobuf/duration.proto"; import "validate/validate.proto"; @@ -32,4 +34,11 @@ message RateLimit { // communication failure between rate limiting service and the proxy. // Defaults to false. bool failure_mode_deny = 5; + + // Configuration for an external rate limit service provider. If not + // specified, any calls to the rate limit service will immediately return + // success. + // [#comment:TODO(ramaraochavali): Make this required as part of cleanup of deprecated ratelimit + // service config in bootstrap.] + envoy.config.ratelimit.v2.RateLimitServiceConfig rate_limit_service = 6; } diff --git a/envoy/config/filter/thrift/rate_limit/v2alpha1/BUILD b/envoy/config/filter/thrift/rate_limit/v2alpha1/BUILD index 2cda26cf..8840043b 100644 --- a/envoy/config/filter/thrift/rate_limit/v2alpha1/BUILD +++ b/envoy/config/filter/thrift/rate_limit/v2alpha1/BUILD @@ -5,5 +5,8 @@ licenses(["notice"]) # Apache 2 api_proto_library_internal( name = "rate_limit", srcs = ["rate_limit.proto"], - deps = ["//envoy/api/v2/ratelimit"], + deps = [ + "//envoy/api/v2/ratelimit", + "//envoy/config/ratelimit/v2:rls", + ], ) diff --git a/envoy/config/filter/thrift/rate_limit/v2alpha1/rate_limit.proto b/envoy/config/filter/thrift/rate_limit/v2alpha1/rate_limit.proto index 842187db..9c23d487 100644 --- a/envoy/config/filter/thrift/rate_limit/v2alpha1/rate_limit.proto +++ b/envoy/config/filter/thrift/rate_limit/v2alpha1/rate_limit.proto @@ -3,6 +3,8 @@ syntax = "proto3"; package envoy.config.filter.thrift.rate_limit.v2alpha1; option go_package = "v2alpha1"; +import "envoy/config/ratelimit/v2/rls.proto"; + import "google/protobuf/duration.proto"; import "validate/validate.proto"; @@ -36,4 +38,11 @@ message RateLimit { // communication failure between rate limiting service and the proxy. // Defaults to false. bool failure_mode_deny = 4; + + // Configuration for an external rate limit service provider. If not + // specified, any calls to the rate limit service will immediately return + // success. + // [#comment:TODO(ramaraochavali): Make this required as part of cleanup of deprecated ratelimit + // service config in bootstrap.] + envoy.config.ratelimit.v2.RateLimitServiceConfig rate_limit_service = 5; } diff --git a/envoy/config/ratelimit/v2/BUILD b/envoy/config/ratelimit/v2/BUILD index 2e69326a..3c40fdb0 100644 --- a/envoy/config/ratelimit/v2/BUILD +++ b/envoy/config/ratelimit/v2/BUILD @@ -5,9 +5,7 @@ licenses(["notice"]) # Apache 2 api_proto_library_internal( name = "rls", srcs = ["rls.proto"], - visibility = [ - "//envoy/config/bootstrap/v2:__pkg__", - ], + visibility = ["//visibility:public"], deps = [ "//envoy/api/v2/core:grpc_service", ],