diff --git a/changelog/v1.14.29/ratelimit-grpc-authority.yaml b/changelog/v1.14.29/ratelimit-grpc-authority.yaml new file mode 100644 index 00000000000..d47b34b7982 --- /dev/null +++ b/changelog/v1.14.29/ratelimit-grpc-authority.yaml @@ -0,0 +1,5 @@ +changelog: + - type: FIX + issueLink: https://github.com/solo-io/gloo/issues/8995 + resolvesIssue: false + description: Expose a new ratelimit option `grpcService.authority` to configure the authority header for the ratelimit gRPC call. diff --git a/docs/content/reference/api/github.com/solo-io/gloo/projects/gloo/api/v1/enterprise/options/ratelimit/ratelimit.proto.sk.md b/docs/content/reference/api/github.com/solo-io/gloo/projects/gloo/api/v1/enterprise/options/ratelimit/ratelimit.proto.sk.md index 9afd8023fc5..231c4c9e71a 100644 --- a/docs/content/reference/api/github.com/solo-io/gloo/projects/gloo/api/v1/enterprise/options/ratelimit/ratelimit.proto.sk.md +++ b/docs/content/reference/api/github.com/solo-io/gloo/projects/gloo/api/v1/enterprise/options/ratelimit/ratelimit.proto.sk.md @@ -13,6 +13,7 @@ weight: 5 - [IngressRateLimit](#ingressratelimit) - [Settings](#settings) +- [GrpcService](#grpcservice) - [ServiceSettings](#servicesettings) - [RateLimitConfigRefs](#ratelimitconfigrefs) - [RateLimitConfigRef](#ratelimitconfigref) @@ -59,6 +60,7 @@ Basic rate-limiting API "denyOnFail": bool "enableXRatelimitHeaders": bool "rateLimitBeforeAuth": bool +"grpcService": .ratelimit.options.gloo.solo.io.GrpcService ``` @@ -69,6 +71,24 @@ Basic rate-limiting API | `denyOnFail` | `bool` | | | `enableXRatelimitHeaders` | `bool` | Set this to true to return Envoy's X-RateLimit headers to the downstream. reference docs here: https://www.envoyproxy.io/docs/envoy/latest/api-v3/extensions/filters/http/ratelimit/v3/rate_limit.proto.html#envoy-v3-api-field-extensions-filters-http-ratelimit-v3-ratelimit-enable-x-ratelimit-headers. | | `rateLimitBeforeAuth` | `bool` | Set this is set to true if you would like to rate limit traffic before applying external auth to it. *Note*: When this is true, you will lose some features like being able to rate limit a request based on its auth state. | +| `grpcService` | [.ratelimit.options.gloo.solo.io.GrpcService](../ratelimit.proto.sk/#grpcservice) | Optional gRPC settings used when calling the ratelimit server. | + + + + +--- +### GrpcService + + + +```yaml +"authority": string + +``` + +| Field | Type | Description | +| ----- | ---- | ----------- | +| `authority` | `string` | Set the authority header when calling the gRPC service. | diff --git a/docs/data/ProtoMap.yaml b/docs/data/ProtoMap.yaml index 80fe592847d..ba8e6660b87 100644 --- a/docs/data/ProtoMap.yaml +++ b/docs/data/ProtoMap.yaml @@ -1331,6 +1331,9 @@ apis: ratelimit.api.solo.io.SimpleDescriptor: relativepath: reference/api/github.com/solo-io/solo-apis/api/rate-limiter/v1alpha1/ratelimit.proto.sk/#SimpleDescriptor package: ratelimit.api.solo.io + ratelimit.options.gloo.solo.io.GrpcService: + relativepath: reference/api/github.com/solo-io/gloo/projects/gloo/api/v1/enterprise/options/ratelimit/ratelimit.proto.sk/#GrpcService + package: ratelimit.options.gloo.solo.io ratelimit.options.gloo.solo.io.IngressRateLimit: relativepath: reference/api/github.com/solo-io/gloo/projects/gloo/api/v1/enterprise/options/ratelimit/ratelimit.proto.sk/#IngressRateLimit package: ratelimit.options.gloo.solo.io diff --git a/install/helm/gloo/crds/gateway.solo.io_v1_Gateway.yaml b/install/helm/gloo/crds/gateway.solo.io_v1_Gateway.yaml index 3828ec3d861..51a36fa5577 100644 --- a/install/helm/gloo/crds/gateway.solo.io_v1_Gateway.yaml +++ b/install/helm/gloo/crds/gateway.solo.io_v1_Gateway.yaml @@ -962,6 +962,11 @@ spec: type: boolean enableXRatelimitHeaders: type: boolean + grpcService: + properties: + authority: + type: string + type: object rateLimitBeforeAuth: type: boolean ratelimitServerRef: @@ -2548,6 +2553,11 @@ spec: type: boolean enableXRatelimitHeaders: type: boolean + grpcService: + properties: + authority: + type: string + type: object rateLimitBeforeAuth: type: boolean ratelimitServerRef: diff --git a/install/helm/gloo/crds/gateway.solo.io_v1_MatchableHttpGateway.yaml b/install/helm/gloo/crds/gateway.solo.io_v1_MatchableHttpGateway.yaml index b97c8d88812..d7b6f3c3ff4 100644 --- a/install/helm/gloo/crds/gateway.solo.io_v1_MatchableHttpGateway.yaml +++ b/install/helm/gloo/crds/gateway.solo.io_v1_MatchableHttpGateway.yaml @@ -957,6 +957,11 @@ spec: type: boolean enableXRatelimitHeaders: type: boolean + grpcService: + properties: + authority: + type: string + type: object rateLimitBeforeAuth: type: boolean ratelimitServerRef: diff --git a/install/helm/gloo/crds/gloo.solo.io_v1_Settings.yaml b/install/helm/gloo/crds/gloo.solo.io_v1_Settings.yaml index e1df8f3e788..0e6587c28cd 100644 --- a/install/helm/gloo/crds/gloo.solo.io_v1_Settings.yaml +++ b/install/helm/gloo/crds/gloo.solo.io_v1_Settings.yaml @@ -623,6 +623,11 @@ spec: type: boolean enableXRatelimitHeaders: type: boolean + grpcService: + properties: + authority: + type: string + type: object rateLimitBeforeAuth: type: boolean ratelimitServerRef: diff --git a/projects/gloo/api/v1/enterprise/options/ratelimit/ratelimit.proto b/projects/gloo/api/v1/enterprise/options/ratelimit/ratelimit.proto index fa14c0f31ff..1897df05ecc 100644 --- a/projects/gloo/api/v1/enterprise/options/ratelimit/ratelimit.proto +++ b/projects/gloo/api/v1/enterprise/options/ratelimit/ratelimit.proto @@ -32,6 +32,16 @@ message Settings { // Set this is set to true if you would like to rate limit traffic before applying external auth to it. // *Note*: When this is true, you will lose some features like being able to rate limit a request based on its auth state bool rate_limit_before_auth = 9; + + oneof service_type { + // Optional gRPC settings used when calling the ratelimit server. + GrpcService grpc_service = 10; + } +} + +message GrpcService { + // Set the authority header when calling the gRPC service. + string authority = 1; } // API based on Envoy's rate-limit service API. (reference here: https://github.com/lyft/ratelimit#configuration) diff --git a/projects/gloo/pkg/api/v1/enterprise/options/ratelimit/ratelimit.pb.clone.go b/projects/gloo/pkg/api/v1/enterprise/options/ratelimit/ratelimit.pb.clone.go index f59c817757d..d4e493fa53c 100644 --- a/projects/gloo/pkg/api/v1/enterprise/options/ratelimit/ratelimit.pb.clone.go +++ b/projects/gloo/pkg/api/v1/enterprise/options/ratelimit/ratelimit.pb.clone.go @@ -80,6 +80,35 @@ func (m *Settings) Clone() proto.Message { target.RateLimitBeforeAuth = m.GetRateLimitBeforeAuth() + switch m.ServiceType.(type) { + + case *Settings_GrpcService: + + if h, ok := interface{}(m.GetGrpcService()).(clone.Cloner); ok { + target.ServiceType = &Settings_GrpcService{ + GrpcService: h.Clone().(*GrpcService), + } + } else { + target.ServiceType = &Settings_GrpcService{ + GrpcService: proto.Clone(m.GetGrpcService()).(*GrpcService), + } + } + + } + + return target +} + +// Clone function +func (m *GrpcService) Clone() proto.Message { + var target *GrpcService + if m == nil { + return target + } + target = &GrpcService{} + + target.Authority = m.GetAuthority() + return target } diff --git a/projects/gloo/pkg/api/v1/enterprise/options/ratelimit/ratelimit.pb.equal.go b/projects/gloo/pkg/api/v1/enterprise/options/ratelimit/ratelimit.pb.equal.go index dd7f2720f61..897ed3aa8d0 100644 --- a/projects/gloo/pkg/api/v1/enterprise/options/ratelimit/ratelimit.pb.equal.go +++ b/projects/gloo/pkg/api/v1/enterprise/options/ratelimit/ratelimit.pb.equal.go @@ -122,6 +122,58 @@ func (m *Settings) Equal(that interface{}) bool { return false } + switch m.ServiceType.(type) { + + case *Settings_GrpcService: + if _, ok := target.ServiceType.(*Settings_GrpcService); !ok { + return false + } + + if h, ok := interface{}(m.GetGrpcService()).(equality.Equalizer); ok { + if !h.Equal(target.GetGrpcService()) { + return false + } + } else { + if !proto.Equal(m.GetGrpcService(), target.GetGrpcService()) { + return false + } + } + + default: + // m is nil but target is not nil + if m.ServiceType != target.ServiceType { + return false + } + } + + return true +} + +// Equal function +func (m *GrpcService) Equal(that interface{}) bool { + if that == nil { + return m == nil + } + + target, ok := that.(*GrpcService) + if !ok { + that2, ok := that.(GrpcService) + if ok { + target = &that2 + } else { + return false + } + } + if target == nil { + return m == nil + } else if m == nil { + return false + } + + if strings.Compare(m.GetAuthority(), target.GetAuthority()) != 0 { + return false + } + return true } diff --git a/projects/gloo/pkg/api/v1/enterprise/options/ratelimit/ratelimit.pb.go b/projects/gloo/pkg/api/v1/enterprise/options/ratelimit/ratelimit.pb.go index b5750b05b01..9b454f007f2 100644 --- a/projects/gloo/pkg/api/v1/enterprise/options/ratelimit/ratelimit.pb.go +++ b/projects/gloo/pkg/api/v1/enterprise/options/ratelimit/ratelimit.pb.go @@ -96,6 +96,10 @@ type Settings struct { // Set this is set to true if you would like to rate limit traffic before applying external auth to it. // *Note*: When this is true, you will lose some features like being able to rate limit a request based on its auth state RateLimitBeforeAuth bool `protobuf:"varint,9,opt,name=rate_limit_before_auth,json=rateLimitBeforeAuth,proto3" json:"rate_limit_before_auth,omitempty"` + // Types that are assignable to ServiceType: + // + // *Settings_GrpcService + ServiceType isSettings_ServiceType `protobuf_oneof:"service_type"` } func (x *Settings) Reset() { @@ -165,6 +169,79 @@ func (x *Settings) GetRateLimitBeforeAuth() bool { return false } +func (m *Settings) GetServiceType() isSettings_ServiceType { + if m != nil { + return m.ServiceType + } + return nil +} + +func (x *Settings) GetGrpcService() *GrpcService { + if x, ok := x.GetServiceType().(*Settings_GrpcService); ok { + return x.GrpcService + } + return nil +} + +type isSettings_ServiceType interface { + isSettings_ServiceType() +} + +type Settings_GrpcService struct { + // Optional gRPC settings used when calling the ratelimit server. + GrpcService *GrpcService `protobuf:"bytes,10,opt,name=grpc_service,json=grpcService,proto3,oneof"` +} + +func (*Settings_GrpcService) isSettings_ServiceType() {} + +type GrpcService struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Set the authority header when calling the gRPC service. + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` +} + +func (x *GrpcService) Reset() { + *x = GrpcService{} + if protoimpl.UnsafeEnabled { + mi := &file_github_com_solo_io_gloo_projects_gloo_api_v1_enterprise_options_ratelimit_ratelimit_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GrpcService) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GrpcService) ProtoMessage() {} + +func (x *GrpcService) ProtoReflect() protoreflect.Message { + mi := &file_github_com_solo_io_gloo_projects_gloo_api_v1_enterprise_options_ratelimit_ratelimit_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GrpcService.ProtoReflect.Descriptor instead. +func (*GrpcService) Descriptor() ([]byte, []int) { + return file_github_com_solo_io_gloo_projects_gloo_api_v1_enterprise_options_ratelimit_ratelimit_proto_rawDescGZIP(), []int{2} +} + +func (x *GrpcService) GetAuthority() string { + if x != nil { + return x.Authority + } + return "" +} + // API based on Envoy's rate-limit service API. (reference here: https://github.com/lyft/ratelimit#configuration) // Sample configuration below: // @@ -193,7 +270,7 @@ type ServiceSettings struct { func (x *ServiceSettings) Reset() { *x = ServiceSettings{} if protoimpl.UnsafeEnabled { - mi := &file_github_com_solo_io_gloo_projects_gloo_api_v1_enterprise_options_ratelimit_ratelimit_proto_msgTypes[2] + mi := &file_github_com_solo_io_gloo_projects_gloo_api_v1_enterprise_options_ratelimit_ratelimit_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -206,7 +283,7 @@ func (x *ServiceSettings) String() string { func (*ServiceSettings) ProtoMessage() {} func (x *ServiceSettings) ProtoReflect() protoreflect.Message { - mi := &file_github_com_solo_io_gloo_projects_gloo_api_v1_enterprise_options_ratelimit_ratelimit_proto_msgTypes[2] + mi := &file_github_com_solo_io_gloo_projects_gloo_api_v1_enterprise_options_ratelimit_ratelimit_proto_msgTypes[3] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -219,7 +296,7 @@ func (x *ServiceSettings) ProtoReflect() protoreflect.Message { // Deprecated: Use ServiceSettings.ProtoReflect.Descriptor instead. func (*ServiceSettings) Descriptor() ([]byte, []int) { - return file_github_com_solo_io_gloo_projects_gloo_api_v1_enterprise_options_ratelimit_ratelimit_proto_rawDescGZIP(), []int{2} + return file_github_com_solo_io_gloo_projects_gloo_api_v1_enterprise_options_ratelimit_ratelimit_proto_rawDescGZIP(), []int{3} } func (x *ServiceSettings) GetDescriptors() []*v1alpha1.Descriptor { @@ -249,7 +326,7 @@ type RateLimitConfigRefs struct { func (x *RateLimitConfigRefs) Reset() { *x = RateLimitConfigRefs{} if protoimpl.UnsafeEnabled { - mi := &file_github_com_solo_io_gloo_projects_gloo_api_v1_enterprise_options_ratelimit_ratelimit_proto_msgTypes[3] + mi := &file_github_com_solo_io_gloo_projects_gloo_api_v1_enterprise_options_ratelimit_ratelimit_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -262,7 +339,7 @@ func (x *RateLimitConfigRefs) String() string { func (*RateLimitConfigRefs) ProtoMessage() {} func (x *RateLimitConfigRefs) ProtoReflect() protoreflect.Message { - mi := &file_github_com_solo_io_gloo_projects_gloo_api_v1_enterprise_options_ratelimit_ratelimit_proto_msgTypes[3] + mi := &file_github_com_solo_io_gloo_projects_gloo_api_v1_enterprise_options_ratelimit_ratelimit_proto_msgTypes[4] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -275,7 +352,7 @@ func (x *RateLimitConfigRefs) ProtoReflect() protoreflect.Message { // Deprecated: Use RateLimitConfigRefs.ProtoReflect.Descriptor instead. func (*RateLimitConfigRefs) Descriptor() ([]byte, []int) { - return file_github_com_solo_io_gloo_projects_gloo_api_v1_enterprise_options_ratelimit_ratelimit_proto_rawDescGZIP(), []int{3} + return file_github_com_solo_io_gloo_projects_gloo_api_v1_enterprise_options_ratelimit_ratelimit_proto_rawDescGZIP(), []int{4} } func (x *RateLimitConfigRefs) GetRefs() []*RateLimitConfigRef { @@ -298,7 +375,7 @@ type RateLimitConfigRef struct { func (x *RateLimitConfigRef) Reset() { *x = RateLimitConfigRef{} if protoimpl.UnsafeEnabled { - mi := &file_github_com_solo_io_gloo_projects_gloo_api_v1_enterprise_options_ratelimit_ratelimit_proto_msgTypes[4] + mi := &file_github_com_solo_io_gloo_projects_gloo_api_v1_enterprise_options_ratelimit_ratelimit_proto_msgTypes[5] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -311,7 +388,7 @@ func (x *RateLimitConfigRef) String() string { func (*RateLimitConfigRef) ProtoMessage() {} func (x *RateLimitConfigRef) ProtoReflect() protoreflect.Message { - mi := &file_github_com_solo_io_gloo_projects_gloo_api_v1_enterprise_options_ratelimit_ratelimit_proto_msgTypes[4] + mi := &file_github_com_solo_io_gloo_projects_gloo_api_v1_enterprise_options_ratelimit_ratelimit_proto_msgTypes[5] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -324,7 +401,7 @@ func (x *RateLimitConfigRef) ProtoReflect() protoreflect.Message { // Deprecated: Use RateLimitConfigRef.ProtoReflect.Descriptor instead. func (*RateLimitConfigRef) Descriptor() ([]byte, []int) { - return file_github_com_solo_io_gloo_projects_gloo_api_v1_enterprise_options_ratelimit_ratelimit_proto_rawDescGZIP(), []int{4} + return file_github_com_solo_io_gloo_projects_gloo_api_v1_enterprise_options_ratelimit_ratelimit_proto_rawDescGZIP(), []int{5} } func (x *RateLimitConfigRef) GetName() string { @@ -358,7 +435,7 @@ type RateLimitVhostExtension struct { func (x *RateLimitVhostExtension) Reset() { *x = RateLimitVhostExtension{} if protoimpl.UnsafeEnabled { - mi := &file_github_com_solo_io_gloo_projects_gloo_api_v1_enterprise_options_ratelimit_ratelimit_proto_msgTypes[5] + mi := &file_github_com_solo_io_gloo_projects_gloo_api_v1_enterprise_options_ratelimit_ratelimit_proto_msgTypes[6] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -371,7 +448,7 @@ func (x *RateLimitVhostExtension) String() string { func (*RateLimitVhostExtension) ProtoMessage() {} func (x *RateLimitVhostExtension) ProtoReflect() protoreflect.Message { - mi := &file_github_com_solo_io_gloo_projects_gloo_api_v1_enterprise_options_ratelimit_ratelimit_proto_msgTypes[5] + mi := &file_github_com_solo_io_gloo_projects_gloo_api_v1_enterprise_options_ratelimit_ratelimit_proto_msgTypes[6] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -384,7 +461,7 @@ func (x *RateLimitVhostExtension) ProtoReflect() protoreflect.Message { // Deprecated: Use RateLimitVhostExtension.ProtoReflect.Descriptor instead. func (*RateLimitVhostExtension) Descriptor() ([]byte, []int) { - return file_github_com_solo_io_gloo_projects_gloo_api_v1_enterprise_options_ratelimit_ratelimit_proto_rawDescGZIP(), []int{5} + return file_github_com_solo_io_gloo_projects_gloo_api_v1_enterprise_options_ratelimit_ratelimit_proto_rawDescGZIP(), []int{6} } func (x *RateLimitVhostExtension) GetRateLimits() []*v1alpha1.RateLimitActions { @@ -413,7 +490,7 @@ type RateLimitRouteExtension struct { func (x *RateLimitRouteExtension) Reset() { *x = RateLimitRouteExtension{} if protoimpl.UnsafeEnabled { - mi := &file_github_com_solo_io_gloo_projects_gloo_api_v1_enterprise_options_ratelimit_ratelimit_proto_msgTypes[6] + mi := &file_github_com_solo_io_gloo_projects_gloo_api_v1_enterprise_options_ratelimit_ratelimit_proto_msgTypes[7] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -426,7 +503,7 @@ func (x *RateLimitRouteExtension) String() string { func (*RateLimitRouteExtension) ProtoMessage() {} func (x *RateLimitRouteExtension) ProtoReflect() protoreflect.Message { - mi := &file_github_com_solo_io_gloo_projects_gloo_api_v1_enterprise_options_ratelimit_ratelimit_proto_msgTypes[6] + mi := &file_github_com_solo_io_gloo_projects_gloo_api_v1_enterprise_options_ratelimit_ratelimit_proto_msgTypes[7] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -439,7 +516,7 @@ func (x *RateLimitRouteExtension) ProtoReflect() protoreflect.Message { // Deprecated: Use RateLimitRouteExtension.ProtoReflect.Descriptor instead. func (*RateLimitRouteExtension) Descriptor() ([]byte, []int) { - return file_github_com_solo_io_gloo_projects_gloo_api_v1_enterprise_options_ratelimit_ratelimit_proto_rawDescGZIP(), []int{6} + return file_github_com_solo_io_gloo_projects_gloo_api_v1_enterprise_options_ratelimit_ratelimit_proto_rawDescGZIP(), []int{7} } func (x *RateLimitRouteExtension) GetIncludeVhRateLimits() bool { @@ -490,7 +567,7 @@ var file_github_com_solo_io_gloo_projects_gloo_api_v1_enterprise_options_ratelim 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x72, 0x61, 0x74, 0x65, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x73, 0x6f, 0x6c, 0x6f, 0x2e, 0x69, 0x6f, 0x2e, 0x52, 0x61, 0x74, 0x65, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x52, 0x0f, 0x61, 0x6e, 0x6f, 0x6e, 0x79, 0x6d, 0x6f, 0x75, 0x73, - 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x73, 0x22, 0xaf, 0x02, 0x0a, 0x08, 0x53, 0x65, 0x74, 0x74, 0x69, + 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x73, 0x22, 0x91, 0x03, 0x0a, 0x08, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x12, 0x4b, 0x0a, 0x14, 0x72, 0x61, 0x74, 0x65, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x5f, 0x72, 0x65, 0x66, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x73, 0x6f, 0x6c, 0x6f, 0x2e, 0x69, 0x6f, @@ -509,50 +586,59 @@ var file_github_com_solo_io_gloo_projects_gloo_api_v1_enterprise_options_ratelim 0x65, 0x72, 0x73, 0x12, 0x33, 0x0a, 0x16, 0x72, 0x61, 0x74, 0x65, 0x5f, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x5f, 0x62, 0x65, 0x66, 0x6f, 0x72, 0x65, 0x5f, 0x61, 0x75, 0x74, 0x68, 0x18, 0x09, 0x20, 0x01, 0x28, 0x08, 0x52, 0x13, 0x72, 0x61, 0x74, 0x65, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x42, 0x65, - 0x66, 0x6f, 0x72, 0x65, 0x41, 0x75, 0x74, 0x68, 0x22, 0xa5, 0x01, 0x0a, 0x0f, 0x53, 0x65, 0x72, - 0x76, 0x69, 0x63, 0x65, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x12, 0x43, 0x0a, 0x0b, - 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, - 0x0b, 0x32, 0x21, 0x2e, 0x72, 0x61, 0x74, 0x65, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x2e, 0x61, 0x70, - 0x69, 0x2e, 0x73, 0x6f, 0x6c, 0x6f, 0x2e, 0x69, 0x6f, 0x2e, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, - 0x70, 0x74, 0x6f, 0x72, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, - 0x73, 0x12, 0x4d, 0x0a, 0x0f, 0x73, 0x65, 0x74, 0x5f, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, - 0x74, 0x6f, 0x72, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x72, 0x61, 0x74, - 0x65, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x73, 0x6f, 0x6c, 0x6f, 0x2e, - 0x69, 0x6f, 0x2e, 0x53, 0x65, 0x74, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, - 0x52, 0x0e, 0x73, 0x65, 0x74, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x73, - 0x22, 0x5d, 0x0a, 0x13, 0x52, 0x61, 0x74, 0x65, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x43, 0x6f, 0x6e, - 0x66, 0x69, 0x67, 0x52, 0x65, 0x66, 0x73, 0x12, 0x46, 0x0a, 0x04, 0x72, 0x65, 0x66, 0x73, 0x18, - 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x32, 0x2e, 0x72, 0x61, 0x74, 0x65, 0x6c, 0x69, 0x6d, 0x69, - 0x74, 0x2e, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x67, 0x6c, 0x6f, 0x6f, 0x2e, 0x73, - 0x6f, 0x6c, 0x6f, 0x2e, 0x69, 0x6f, 0x2e, 0x52, 0x61, 0x74, 0x65, 0x4c, 0x69, 0x6d, 0x69, 0x74, - 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x65, 0x66, 0x52, 0x04, 0x72, 0x65, 0x66, 0x73, 0x22, - 0x46, 0x0a, 0x12, 0x52, 0x61, 0x74, 0x65, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x43, 0x6f, 0x6e, 0x66, - 0x69, 0x67, 0x52, 0x65, 0x66, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x6e, 0x61, 0x6d, - 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6e, 0x61, - 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x22, 0x63, 0x0a, 0x17, 0x52, 0x61, 0x74, 0x65, 0x4c, - 0x69, 0x6d, 0x69, 0x74, 0x56, 0x68, 0x6f, 0x73, 0x74, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, - 0x6f, 0x6e, 0x12, 0x48, 0x0a, 0x0b, 0x72, 0x61, 0x74, 0x65, 0x5f, 0x6c, 0x69, 0x6d, 0x69, 0x74, - 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x72, 0x61, 0x74, 0x65, 0x6c, 0x69, - 0x6d, 0x69, 0x74, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x73, 0x6f, 0x6c, 0x6f, 0x2e, 0x69, 0x6f, 0x2e, - 0x52, 0x61, 0x74, 0x65, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, - 0x52, 0x0a, 0x72, 0x61, 0x74, 0x65, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x73, 0x22, 0x98, 0x01, 0x0a, - 0x17, 0x52, 0x61, 0x74, 0x65, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x45, - 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x33, 0x0a, 0x16, 0x69, 0x6e, 0x63, 0x6c, - 0x75, 0x64, 0x65, 0x5f, 0x76, 0x68, 0x5f, 0x72, 0x61, 0x74, 0x65, 0x5f, 0x6c, 0x69, 0x6d, 0x69, - 0x74, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x13, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, - 0x65, 0x56, 0x68, 0x52, 0x61, 0x74, 0x65, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x73, 0x12, 0x48, 0x0a, - 0x0b, 0x72, 0x61, 0x74, 0x65, 0x5f, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x73, 0x18, 0x02, 0x20, 0x03, - 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x72, 0x61, 0x74, 0x65, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x2e, 0x61, - 0x70, 0x69, 0x2e, 0x73, 0x6f, 0x6c, 0x6f, 0x2e, 0x69, 0x6f, 0x2e, 0x52, 0x61, 0x74, 0x65, 0x4c, - 0x69, 0x6d, 0x69, 0x74, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x0a, 0x72, 0x61, 0x74, - 0x65, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x73, 0x42, 0x5b, 0xb8, 0xf5, 0x04, 0x01, 0xc0, 0xf5, 0x04, - 0x01, 0xd0, 0xf5, 0x04, 0x01, 0x5a, 0x4d, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, - 0x6d, 0x2f, 0x73, 0x6f, 0x6c, 0x6f, 0x2d, 0x69, 0x6f, 0x2f, 0x67, 0x6c, 0x6f, 0x6f, 0x2f, 0x70, - 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x2f, 0x67, 0x6c, 0x6f, 0x6f, 0x2f, 0x70, 0x6b, 0x67, - 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x65, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x69, - 0x73, 0x65, 0x2f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x72, 0x61, 0x74, 0x65, 0x6c, - 0x69, 0x6d, 0x69, 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x66, 0x6f, 0x72, 0x65, 0x41, 0x75, 0x74, 0x68, 0x12, 0x50, 0x0a, 0x0c, 0x67, 0x72, 0x70, 0x63, + 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2b, + 0x2e, 0x72, 0x61, 0x74, 0x65, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x2e, 0x6f, 0x70, 0x74, 0x69, 0x6f, + 0x6e, 0x73, 0x2e, 0x67, 0x6c, 0x6f, 0x6f, 0x2e, 0x73, 0x6f, 0x6c, 0x6f, 0x2e, 0x69, 0x6f, 0x2e, + 0x47, 0x72, 0x70, 0x63, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x48, 0x00, 0x52, 0x0b, 0x67, + 0x72, 0x70, 0x63, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x42, 0x0e, 0x0a, 0x0c, 0x73, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x22, 0x2b, 0x0a, 0x0b, 0x47, 0x72, + 0x70, 0x63, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x61, 0x75, 0x74, + 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x61, 0x75, + 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x22, 0xa5, 0x01, 0x0a, 0x0f, 0x53, 0x65, 0x72, 0x76, + 0x69, 0x63, 0x65, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x12, 0x43, 0x0a, 0x0b, 0x64, + 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, + 0x32, 0x21, 0x2e, 0x72, 0x61, 0x74, 0x65, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x2e, 0x61, 0x70, 0x69, + 0x2e, 0x73, 0x6f, 0x6c, 0x6f, 0x2e, 0x69, 0x6f, 0x2e, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, + 0x74, 0x6f, 0x72, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x73, + 0x12, 0x4d, 0x0a, 0x0f, 0x73, 0x65, 0x74, 0x5f, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, + 0x6f, 0x72, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x72, 0x61, 0x74, 0x65, + 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x73, 0x6f, 0x6c, 0x6f, 0x2e, 0x69, + 0x6f, 0x2e, 0x53, 0x65, 0x74, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x52, + 0x0e, 0x73, 0x65, 0x74, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x73, 0x22, + 0x5d, 0x0a, 0x13, 0x52, 0x61, 0x74, 0x65, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x43, 0x6f, 0x6e, 0x66, + 0x69, 0x67, 0x52, 0x65, 0x66, 0x73, 0x12, 0x46, 0x0a, 0x04, 0x72, 0x65, 0x66, 0x73, 0x18, 0x01, + 0x20, 0x03, 0x28, 0x0b, 0x32, 0x32, 0x2e, 0x72, 0x61, 0x74, 0x65, 0x6c, 0x69, 0x6d, 0x69, 0x74, + 0x2e, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x67, 0x6c, 0x6f, 0x6f, 0x2e, 0x73, 0x6f, + 0x6c, 0x6f, 0x2e, 0x69, 0x6f, 0x2e, 0x52, 0x61, 0x74, 0x65, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x43, + 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x65, 0x66, 0x52, 0x04, 0x72, 0x65, 0x66, 0x73, 0x22, 0x46, + 0x0a, 0x12, 0x52, 0x61, 0x74, 0x65, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, + 0x67, 0x52, 0x65, 0x66, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x6e, 0x61, 0x6d, 0x65, + 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6e, 0x61, 0x6d, + 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x22, 0x63, 0x0a, 0x17, 0x52, 0x61, 0x74, 0x65, 0x4c, 0x69, + 0x6d, 0x69, 0x74, 0x56, 0x68, 0x6f, 0x73, 0x74, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, + 0x6e, 0x12, 0x48, 0x0a, 0x0b, 0x72, 0x61, 0x74, 0x65, 0x5f, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x73, + 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x72, 0x61, 0x74, 0x65, 0x6c, 0x69, 0x6d, + 0x69, 0x74, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x73, 0x6f, 0x6c, 0x6f, 0x2e, 0x69, 0x6f, 0x2e, 0x52, + 0x61, 0x74, 0x65, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, + 0x0a, 0x72, 0x61, 0x74, 0x65, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x73, 0x22, 0x98, 0x01, 0x0a, 0x17, + 0x52, 0x61, 0x74, 0x65, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x45, 0x78, + 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x33, 0x0a, 0x16, 0x69, 0x6e, 0x63, 0x6c, 0x75, + 0x64, 0x65, 0x5f, 0x76, 0x68, 0x5f, 0x72, 0x61, 0x74, 0x65, 0x5f, 0x6c, 0x69, 0x6d, 0x69, 0x74, + 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x13, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, + 0x56, 0x68, 0x52, 0x61, 0x74, 0x65, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x73, 0x12, 0x48, 0x0a, 0x0b, + 0x72, 0x61, 0x74, 0x65, 0x5f, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, + 0x0b, 0x32, 0x27, 0x2e, 0x72, 0x61, 0x74, 0x65, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x2e, 0x61, 0x70, + 0x69, 0x2e, 0x73, 0x6f, 0x6c, 0x6f, 0x2e, 0x69, 0x6f, 0x2e, 0x52, 0x61, 0x74, 0x65, 0x4c, 0x69, + 0x6d, 0x69, 0x74, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x0a, 0x72, 0x61, 0x74, 0x65, + 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x73, 0x42, 0x5b, 0xb8, 0xf5, 0x04, 0x01, 0xc0, 0xf5, 0x04, 0x01, + 0xd0, 0xf5, 0x04, 0x01, 0x5a, 0x4d, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, + 0x2f, 0x73, 0x6f, 0x6c, 0x6f, 0x2d, 0x69, 0x6f, 0x2f, 0x67, 0x6c, 0x6f, 0x6f, 0x2f, 0x70, 0x72, + 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x2f, 0x67, 0x6c, 0x6f, 0x6f, 0x2f, 0x70, 0x6b, 0x67, 0x2f, + 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x65, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x69, 0x73, + 0x65, 0x2f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x72, 0x61, 0x74, 0x65, 0x6c, 0x69, + 0x6d, 0x69, 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -567,37 +653,39 @@ func file_github_com_solo_io_gloo_projects_gloo_api_v1_enterprise_options_rateli return file_github_com_solo_io_gloo_projects_gloo_api_v1_enterprise_options_ratelimit_ratelimit_proto_rawDescData } -var file_github_com_solo_io_gloo_projects_gloo_api_v1_enterprise_options_ratelimit_ratelimit_proto_msgTypes = make([]protoimpl.MessageInfo, 7) +var file_github_com_solo_io_gloo_projects_gloo_api_v1_enterprise_options_ratelimit_ratelimit_proto_msgTypes = make([]protoimpl.MessageInfo, 8) var file_github_com_solo_io_gloo_projects_gloo_api_v1_enterprise_options_ratelimit_ratelimit_proto_goTypes = []interface{}{ (*IngressRateLimit)(nil), // 0: ratelimit.options.gloo.solo.io.IngressRateLimit (*Settings)(nil), // 1: ratelimit.options.gloo.solo.io.Settings - (*ServiceSettings)(nil), // 2: ratelimit.options.gloo.solo.io.ServiceSettings - (*RateLimitConfigRefs)(nil), // 3: ratelimit.options.gloo.solo.io.RateLimitConfigRefs - (*RateLimitConfigRef)(nil), // 4: ratelimit.options.gloo.solo.io.RateLimitConfigRef - (*RateLimitVhostExtension)(nil), // 5: ratelimit.options.gloo.solo.io.RateLimitVhostExtension - (*RateLimitRouteExtension)(nil), // 6: ratelimit.options.gloo.solo.io.RateLimitRouteExtension - (*v1alpha1.RateLimit)(nil), // 7: ratelimit.api.solo.io.RateLimit - (*core.ResourceRef)(nil), // 8: core.solo.io.ResourceRef - (*duration.Duration)(nil), // 9: google.protobuf.Duration - (*v1alpha1.Descriptor)(nil), // 10: ratelimit.api.solo.io.Descriptor - (*v1alpha1.SetDescriptor)(nil), // 11: ratelimit.api.solo.io.SetDescriptor - (*v1alpha1.RateLimitActions)(nil), // 12: ratelimit.api.solo.io.RateLimitActions + (*GrpcService)(nil), // 2: ratelimit.options.gloo.solo.io.GrpcService + (*ServiceSettings)(nil), // 3: ratelimit.options.gloo.solo.io.ServiceSettings + (*RateLimitConfigRefs)(nil), // 4: ratelimit.options.gloo.solo.io.RateLimitConfigRefs + (*RateLimitConfigRef)(nil), // 5: ratelimit.options.gloo.solo.io.RateLimitConfigRef + (*RateLimitVhostExtension)(nil), // 6: ratelimit.options.gloo.solo.io.RateLimitVhostExtension + (*RateLimitRouteExtension)(nil), // 7: ratelimit.options.gloo.solo.io.RateLimitRouteExtension + (*v1alpha1.RateLimit)(nil), // 8: ratelimit.api.solo.io.RateLimit + (*core.ResourceRef)(nil), // 9: core.solo.io.ResourceRef + (*duration.Duration)(nil), // 10: google.protobuf.Duration + (*v1alpha1.Descriptor)(nil), // 11: ratelimit.api.solo.io.Descriptor + (*v1alpha1.SetDescriptor)(nil), // 12: ratelimit.api.solo.io.SetDescriptor + (*v1alpha1.RateLimitActions)(nil), // 13: ratelimit.api.solo.io.RateLimitActions } var file_github_com_solo_io_gloo_projects_gloo_api_v1_enterprise_options_ratelimit_ratelimit_proto_depIdxs = []int32{ - 7, // 0: ratelimit.options.gloo.solo.io.IngressRateLimit.authorized_limits:type_name -> ratelimit.api.solo.io.RateLimit - 7, // 1: ratelimit.options.gloo.solo.io.IngressRateLimit.anonymous_limits:type_name -> ratelimit.api.solo.io.RateLimit - 8, // 2: ratelimit.options.gloo.solo.io.Settings.ratelimit_server_ref:type_name -> core.solo.io.ResourceRef - 9, // 3: ratelimit.options.gloo.solo.io.Settings.request_timeout:type_name -> google.protobuf.Duration - 10, // 4: ratelimit.options.gloo.solo.io.ServiceSettings.descriptors:type_name -> ratelimit.api.solo.io.Descriptor - 11, // 5: ratelimit.options.gloo.solo.io.ServiceSettings.set_descriptors:type_name -> ratelimit.api.solo.io.SetDescriptor - 4, // 6: ratelimit.options.gloo.solo.io.RateLimitConfigRefs.refs:type_name -> ratelimit.options.gloo.solo.io.RateLimitConfigRef - 12, // 7: ratelimit.options.gloo.solo.io.RateLimitVhostExtension.rate_limits:type_name -> ratelimit.api.solo.io.RateLimitActions - 12, // 8: ratelimit.options.gloo.solo.io.RateLimitRouteExtension.rate_limits:type_name -> ratelimit.api.solo.io.RateLimitActions - 9, // [9:9] is the sub-list for method output_type - 9, // [9:9] is the sub-list for method input_type - 9, // [9:9] is the sub-list for extension type_name - 9, // [9:9] is the sub-list for extension extendee - 0, // [0:9] is the sub-list for field type_name + 8, // 0: ratelimit.options.gloo.solo.io.IngressRateLimit.authorized_limits:type_name -> ratelimit.api.solo.io.RateLimit + 8, // 1: ratelimit.options.gloo.solo.io.IngressRateLimit.anonymous_limits:type_name -> ratelimit.api.solo.io.RateLimit + 9, // 2: ratelimit.options.gloo.solo.io.Settings.ratelimit_server_ref:type_name -> core.solo.io.ResourceRef + 10, // 3: ratelimit.options.gloo.solo.io.Settings.request_timeout:type_name -> google.protobuf.Duration + 2, // 4: ratelimit.options.gloo.solo.io.Settings.grpc_service:type_name -> ratelimit.options.gloo.solo.io.GrpcService + 11, // 5: ratelimit.options.gloo.solo.io.ServiceSettings.descriptors:type_name -> ratelimit.api.solo.io.Descriptor + 12, // 6: ratelimit.options.gloo.solo.io.ServiceSettings.set_descriptors:type_name -> ratelimit.api.solo.io.SetDescriptor + 5, // 7: ratelimit.options.gloo.solo.io.RateLimitConfigRefs.refs:type_name -> ratelimit.options.gloo.solo.io.RateLimitConfigRef + 13, // 8: ratelimit.options.gloo.solo.io.RateLimitVhostExtension.rate_limits:type_name -> ratelimit.api.solo.io.RateLimitActions + 13, // 9: ratelimit.options.gloo.solo.io.RateLimitRouteExtension.rate_limits:type_name -> ratelimit.api.solo.io.RateLimitActions + 10, // [10:10] is the sub-list for method output_type + 10, // [10:10] is the sub-list for method input_type + 10, // [10:10] is the sub-list for extension type_name + 10, // [10:10] is the sub-list for extension extendee + 0, // [0:10] is the sub-list for field type_name } func init() { @@ -633,7 +721,7 @@ func file_github_com_solo_io_gloo_projects_gloo_api_v1_enterprise_options_rateli } } file_github_com_solo_io_gloo_projects_gloo_api_v1_enterprise_options_ratelimit_ratelimit_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ServiceSettings); i { + switch v := v.(*GrpcService); i { case 0: return &v.state case 1: @@ -645,7 +733,7 @@ func file_github_com_solo_io_gloo_projects_gloo_api_v1_enterprise_options_rateli } } file_github_com_solo_io_gloo_projects_gloo_api_v1_enterprise_options_ratelimit_ratelimit_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*RateLimitConfigRefs); i { + switch v := v.(*ServiceSettings); i { case 0: return &v.state case 1: @@ -657,7 +745,7 @@ func file_github_com_solo_io_gloo_projects_gloo_api_v1_enterprise_options_rateli } } file_github_com_solo_io_gloo_projects_gloo_api_v1_enterprise_options_ratelimit_ratelimit_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*RateLimitConfigRef); i { + switch v := v.(*RateLimitConfigRefs); i { case 0: return &v.state case 1: @@ -669,7 +757,7 @@ func file_github_com_solo_io_gloo_projects_gloo_api_v1_enterprise_options_rateli } } file_github_com_solo_io_gloo_projects_gloo_api_v1_enterprise_options_ratelimit_ratelimit_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*RateLimitVhostExtension); i { + switch v := v.(*RateLimitConfigRef); i { case 0: return &v.state case 1: @@ -681,6 +769,18 @@ func file_github_com_solo_io_gloo_projects_gloo_api_v1_enterprise_options_rateli } } file_github_com_solo_io_gloo_projects_gloo_api_v1_enterprise_options_ratelimit_ratelimit_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RateLimitVhostExtension); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_github_com_solo_io_gloo_projects_gloo_api_v1_enterprise_options_ratelimit_ratelimit_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*RateLimitRouteExtension); i { case 0: return &v.state @@ -693,13 +793,16 @@ func file_github_com_solo_io_gloo_projects_gloo_api_v1_enterprise_options_rateli } } } + file_github_com_solo_io_gloo_projects_gloo_api_v1_enterprise_options_ratelimit_ratelimit_proto_msgTypes[1].OneofWrappers = []interface{}{ + (*Settings_GrpcService)(nil), + } type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_github_com_solo_io_gloo_projects_gloo_api_v1_enterprise_options_ratelimit_ratelimit_proto_rawDesc, NumEnums: 0, - NumMessages: 7, + NumMessages: 8, NumExtensions: 0, NumServices: 0, }, diff --git a/projects/gloo/pkg/api/v1/enterprise/options/ratelimit/ratelimit.pb.hash.go b/projects/gloo/pkg/api/v1/enterprise/options/ratelimit/ratelimit.pb.hash.go index 9a9c83beadb..19b9f7ee166 100644 --- a/projects/gloo/pkg/api/v1/enterprise/options/ratelimit/ratelimit.pb.hash.go +++ b/projects/gloo/pkg/api/v1/enterprise/options/ratelimit/ratelimit.pb.hash.go @@ -149,6 +149,52 @@ func (m *Settings) Hash(hasher hash.Hash64) (uint64, error) { return 0, err } + switch m.ServiceType.(type) { + + case *Settings_GrpcService: + + if h, ok := interface{}(m.GetGrpcService()).(safe_hasher.SafeHasher); ok { + if _, err = hasher.Write([]byte("GrpcService")); err != nil { + return 0, err + } + if _, err = h.Hash(hasher); err != nil { + return 0, err + } + } else { + if fieldValue, err := hashstructure.Hash(m.GetGrpcService(), nil); err != nil { + return 0, err + } else { + if _, err = hasher.Write([]byte("GrpcService")); err != nil { + return 0, err + } + if err := binary.Write(hasher, binary.LittleEndian, fieldValue); err != nil { + return 0, err + } + } + } + + } + + return hasher.Sum64(), nil +} + +// Hash function +func (m *GrpcService) Hash(hasher hash.Hash64) (uint64, error) { + if m == nil { + return 0, nil + } + if hasher == nil { + hasher = fnv.New64() + } + var err error + if _, err = hasher.Write([]byte("ratelimit.options.gloo.solo.io.github.com/solo-io/gloo/projects/gloo/pkg/api/v1/enterprise/options/ratelimit.GrpcService")); err != nil { + return 0, err + } + + if _, err = hasher.Write([]byte(m.GetAuthority())); err != nil { + return 0, err + } + return hasher.Sum64(), nil } diff --git a/projects/gloo/pkg/plugins/ratelimit/plugin.go b/projects/gloo/pkg/plugins/ratelimit/plugin.go index c5c3fbed47f..c8f7415ff9c 100644 --- a/projects/gloo/pkg/plugins/ratelimit/plugin.go +++ b/projects/gloo/pkg/plugins/ratelimit/plugin.go @@ -143,6 +143,7 @@ func GenerateEnvoyHttpFilterConfig(serverSettings *ratelimit.Settings) *envoy_ex return GenerateEnvoyConfigForFilterWith( serverSettings.GetRatelimitServerRef(), + serverSettings.GetGrpcService(), CustomDomain, rateLimitStage, serverSettings.GetRequestTimeout(), diff --git a/projects/gloo/pkg/plugins/ratelimit/plugin_test.go b/projects/gloo/pkg/plugins/ratelimit/plugin_test.go index 68b176654a9..fc7d3ac4b46 100644 --- a/projects/gloo/pkg/plugins/ratelimit/plugin_test.go +++ b/projects/gloo/pkg/plugins/ratelimit/plugin_test.go @@ -133,6 +133,37 @@ var _ = Describe("RateLimit Plugin", func() { Expect(cfg).To(matchers.MatchProto(expectedConfig)) }) + It("should pass through authority to grpc service", func() { + rlSettings.ServiceType = &ratelimitpb.Settings_GrpcService{ + GrpcService: &ratelimitpb.GrpcService{ + Authority: "xyz", + }, + } + filters, err := rlPlugin.HttpFilters(params, nil) + Expect(err).NotTo(HaveOccurred()) + + Expect(filters).To(HaveLen(1)) + hundredms := DefaultTimeout + expectedConfig := &envoyratelimit.RateLimit{ + Domain: CustomDomain, + FailureModeDeny: false, + Stage: 3, + Timeout: hundredms, + RequestType: "both", + RateLimitService: &rlconfig.RateLimitServiceConfig{ + TransportApiVersion: envoycore.ApiVersion_V3, + GrpcService: &envoycore.GrpcService{TargetSpecifier: &envoycore.GrpcService_EnvoyGrpc_{ + EnvoyGrpc: &envoycore.GrpcService_EnvoyGrpc{ + ClusterName: translator.UpstreamToClusterName(rlServerRef), + Authority: "xyz", + }, + }}, + }, + } + cfg := getTypedConfig(filters[0].HttpFilter) + Expect(cfg).To(matchers.MatchProto(expectedConfig)) + }) + It("default timeout is 100ms", func() { filters, err := rlPlugin.HttpFilters(params, nil) Expect(err).NotTo(HaveOccurred()) diff --git a/projects/gloo/pkg/plugins/ratelimit/util.go b/projects/gloo/pkg/plugins/ratelimit/util.go index 65c20eb9c6b..471bf8b9bf4 100644 --- a/projects/gloo/pkg/plugins/ratelimit/util.go +++ b/projects/gloo/pkg/plugins/ratelimit/util.go @@ -5,24 +5,28 @@ import ( rlconfig "github.com/envoyproxy/go-control-plane/envoy/config/ratelimit/v3" envoyratelimit "github.com/envoyproxy/go-control-plane/envoy/extensions/filters/http/ratelimit/v3" "github.com/golang/protobuf/ptypes/duration" + "github.com/solo-io/gloo/projects/gloo/pkg/api/v1/enterprise/options/ratelimit" "github.com/solo-io/gloo/projects/gloo/pkg/translator" "github.com/solo-io/solo-kit/pkg/api/v1/resources/core" ) func GenerateEnvoyConfigForFilterWith( upstreamRef *core.ResourceRef, + grpcService *ratelimit.GrpcService, domain string, stage uint32, timeout *duration.Duration, denyOnFail bool, enableXRatelimitHeaders bool, ) *envoyratelimit.RateLimit { - var svc *envoycore.GrpcService - svc = &envoycore.GrpcService{TargetSpecifier: &envoycore.GrpcService_EnvoyGrpc_{ - EnvoyGrpc: &envoycore.GrpcService_EnvoyGrpc{ - ClusterName: translator.UpstreamToClusterName(upstreamRef), - }, - }} + + svc := &envoycore.GrpcService{ + TargetSpecifier: &envoycore.GrpcService_EnvoyGrpc_{ + EnvoyGrpc: &envoycore.GrpcService_EnvoyGrpc{ + ClusterName: translator.UpstreamToClusterName(upstreamRef), + Authority: grpcService.GetAuthority(), + }, + }} curtimeout := DefaultTimeout if timeout != nil {