diff --git a/.tool-versions b/.tool-versions index 4529efbc3d..8ef88543b4 100644 --- a/.tool-versions +++ b/.tool-versions @@ -13,7 +13,7 @@ yq 4.27.2 helm 3.9.2 kubectl 1.24.3 kustomize 4.5.5 -kind 0.14.0 +kind 0.15.0 jb 0.5.1 tanka 0.22.1 tilt 0.30.7 diff --git a/api/aperture/policy/wrappers/v1/decisions.proto b/api/aperture/policy/wrappers/v1/decisions.proto new file mode 100644 index 0000000000..38db836f43 --- /dev/null +++ b/api/aperture/policy/wrappers/v1/decisions.proto @@ -0,0 +1,38 @@ +syntax = "proto3"; + +package aperture.policy.wrappers.v1; + +import "aperture/policy/decisions/v1/decisions.proto"; + +message LoadShedDecsisionWrapper { + // Load Shed Decision + policy.decisions.v1.LoadShedDecision load_shed_decision = 1; + // The index of Component in the Circuit. + int64 component_index = 2; + // Name of the Policy. + string policy_name = 3; + // Hash of the entire Policy spec. + string policy_hash = 4; +} + +message TokensDecisionWrapper { + // Tokens Decision + policy.decisions.v1.TokensDecision tokens_decision = 1; + // The index of Component in the Circuit. + int64 component_index = 2; + // Name of the Policy. + string policy_name = 3; + // Hash of the entire Policy spec. + string policy_hash = 4; +} + +message RateLimiterDecisionWrapper { + // Rate Limiter Decision + policy.decisions.v1.RateLimiterDecision rate_limiter_decision = 1; + // The index of Component in the Circuit. + int64 component_index = 2; + // Name of the Policy. + string policy_name = 3; + // Hash of the entire Policy spec. + string policy_hash = 4; +} diff --git a/api/aperture/common/config/v1/config_properties_wrapper.proto b/api/aperture/policy/wrappers/v1/policy.proto similarity index 51% rename from api/aperture/common/config/v1/config_properties_wrapper.proto rename to api/aperture/policy/wrappers/v1/policy.proto index 85196c3b6c..cf587f5526 100644 --- a/api/aperture/common/config/v1/config_properties_wrapper.proto +++ b/api/aperture/policy/wrappers/v1/policy.proto @@ -1,8 +1,7 @@ syntax = "proto3"; -package aperture.common.config.v1; +package aperture.policy.wrappers.v1; -import "aperture/policy/decisions/v1/decisions.proto"; import "aperture/policy/language/v1/fluxmeter.proto"; import "aperture/policy/language/v1/policy.proto"; @@ -43,36 +42,3 @@ message RateLimiterWrapper { // Hash of the entire Policy spec. string policy_hash = 4; } - -message LoadShedDecsisionWrapper { - // Load Shed Decision - policy.decisions.v1.LoadShedDecision load_shed_decision = 1; - // The index of Component in the Circuit. - int64 component_index = 2; - // Name of the Policy. - string policy_name = 3; - // Hash of the entire Policy spec. - string policy_hash = 4; -} - -message TokensDecisionWrapper { - // Tokens Decision - policy.decisions.v1.TokensDecision tokens_decision = 1; - // The index of Component in the Circuit. - int64 component_index = 2; - // Name of the Policy. - string policy_name = 3; - // Hash of the entire Policy spec. - string policy_hash = 4; -} - -message RateLimiterDecisionWrapper { - // Rate Limiter Decision - policy.decisions.v1.RateLimiterDecision rate_limiter_decision = 1; - // The index of Component in the Circuit. - int64 component_index = 2; - // Name of the Policy. - string policy_name = 3; - // Hash of the entire Policy spec. - string policy_hash = 4; -} diff --git a/api/gen/openapiv2/aperture.swagger.yaml b/api/gen/openapiv2/aperture.swagger.yaml index abb87c0a8e..261a3ca7cf 100644 --- a/api/gen/openapiv2/aperture.swagger.yaml +++ b/api/gen/openapiv2/aperture.swagger.yaml @@ -3,12 +3,12 @@ info: title: Aperture API version: "1.0" tags: - - name: PolicyService - name: EntityCacheService - name: InfoService - name: StatusService - name: FlowControlService - name: FluxNinjaService + - name: PolicyService consumes: - application/json produces: diff --git a/api/gen/proto/go/aperture/common/config/v1/config_properties_wrapper.pb.go b/api/gen/proto/go/aperture/common/config/v1/config_properties_wrapper.pb.go deleted file mode 100644 index 3f99df30b7..0000000000 --- a/api/gen/proto/go/aperture/common/config/v1/config_properties_wrapper.pb.go +++ /dev/null @@ -1,801 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.27.1 -// protoc (unknown) -// source: aperture/common/config/v1/config_properties_wrapper.proto - -package configv1 - -import ( - v11 "github.com/fluxninja/aperture/api/gen/proto/go/aperture/policy/decisions/v1" - v1 "github.com/fluxninja/aperture/api/gen/proto/go/aperture/policy/language/v1" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -type PolicyWrapper struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Policy - Policy *v1.Policy `protobuf:"bytes,1,opt,name=policy,proto3" json:"policy,omitempty"` - // Name of the Policy. - PolicyName string `protobuf:"bytes,2,opt,name=policy_name,json=policyName,proto3" json:"policy_name,omitempty"` - // Hash of the entire Policy spec. - PolicyHash string `protobuf:"bytes,3,opt,name=policy_hash,json=policyHash,proto3" json:"policy_hash,omitempty"` -} - -func (x *PolicyWrapper) Reset() { - *x = PolicyWrapper{} - if protoimpl.UnsafeEnabled { - mi := &file_aperture_common_config_v1_config_properties_wrapper_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *PolicyWrapper) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PolicyWrapper) ProtoMessage() {} - -func (x *PolicyWrapper) ProtoReflect() protoreflect.Message { - mi := &file_aperture_common_config_v1_config_properties_wrapper_proto_msgTypes[0] - 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 PolicyWrapper.ProtoReflect.Descriptor instead. -func (*PolicyWrapper) Descriptor() ([]byte, []int) { - return file_aperture_common_config_v1_config_properties_wrapper_proto_rawDescGZIP(), []int{0} -} - -func (x *PolicyWrapper) GetPolicy() *v1.Policy { - if x != nil { - return x.Policy - } - return nil -} - -func (x *PolicyWrapper) GetPolicyName() string { - if x != nil { - return x.PolicyName - } - return "" -} - -func (x *PolicyWrapper) GetPolicyHash() string { - if x != nil { - return x.PolicyHash - } - return "" -} - -type FluxMeterWrapper struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Flux Meter - FluxMeter *v1.FluxMeter `protobuf:"bytes,1,opt,name=flux_meter,json=fluxMeter,proto3" json:"flux_meter,omitempty"` - // Name of fluxmeter metric. - FluxmeterName string `protobuf:"bytes,4,opt,name=fluxmeter_name,json=fluxmeterName,proto3" json:"fluxmeter_name,omitempty"` -} - -func (x *FluxMeterWrapper) Reset() { - *x = FluxMeterWrapper{} - if protoimpl.UnsafeEnabled { - mi := &file_aperture_common_config_v1_config_properties_wrapper_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *FluxMeterWrapper) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*FluxMeterWrapper) ProtoMessage() {} - -func (x *FluxMeterWrapper) ProtoReflect() protoreflect.Message { - mi := &file_aperture_common_config_v1_config_properties_wrapper_proto_msgTypes[1] - 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 FluxMeterWrapper.ProtoReflect.Descriptor instead. -func (*FluxMeterWrapper) Descriptor() ([]byte, []int) { - return file_aperture_common_config_v1_config_properties_wrapper_proto_rawDescGZIP(), []int{1} -} - -func (x *FluxMeterWrapper) GetFluxMeter() *v1.FluxMeter { - if x != nil { - return x.FluxMeter - } - return nil -} - -func (x *FluxMeterWrapper) GetFluxmeterName() string { - if x != nil { - return x.FluxmeterName - } - return "" -} - -type ConcurrencyLimiterWrapper struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Concurrency Limiter - ConcurrencyLimiter *v1.ConcurrencyLimiter `protobuf:"bytes,1,opt,name=concurrency_limiter,json=concurrencyLimiter,proto3" json:"concurrency_limiter,omitempty"` - // The index of Component in the Circuit. - ComponentIndex int64 `protobuf:"varint,2,opt,name=component_index,json=componentIndex,proto3" json:"component_index,omitempty"` - // Name of the Policy. - PolicyName string `protobuf:"bytes,3,opt,name=policy_name,json=policyName,proto3" json:"policy_name,omitempty"` - // Hash of the entire Policy spec. - PolicyHash string `protobuf:"bytes,4,opt,name=policy_hash,json=policyHash,proto3" json:"policy_hash,omitempty"` -} - -func (x *ConcurrencyLimiterWrapper) Reset() { - *x = ConcurrencyLimiterWrapper{} - if protoimpl.UnsafeEnabled { - mi := &file_aperture_common_config_v1_config_properties_wrapper_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ConcurrencyLimiterWrapper) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ConcurrencyLimiterWrapper) ProtoMessage() {} - -func (x *ConcurrencyLimiterWrapper) ProtoReflect() protoreflect.Message { - mi := &file_aperture_common_config_v1_config_properties_wrapper_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 ConcurrencyLimiterWrapper.ProtoReflect.Descriptor instead. -func (*ConcurrencyLimiterWrapper) Descriptor() ([]byte, []int) { - return file_aperture_common_config_v1_config_properties_wrapper_proto_rawDescGZIP(), []int{2} -} - -func (x *ConcurrencyLimiterWrapper) GetConcurrencyLimiter() *v1.ConcurrencyLimiter { - if x != nil { - return x.ConcurrencyLimiter - } - return nil -} - -func (x *ConcurrencyLimiterWrapper) GetComponentIndex() int64 { - if x != nil { - return x.ComponentIndex - } - return 0 -} - -func (x *ConcurrencyLimiterWrapper) GetPolicyName() string { - if x != nil { - return x.PolicyName - } - return "" -} - -func (x *ConcurrencyLimiterWrapper) GetPolicyHash() string { - if x != nil { - return x.PolicyHash - } - return "" -} - -type RateLimiterWrapper struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Rate Limiter - RateLimiter *v1.RateLimiter `protobuf:"bytes,1,opt,name=rate_limiter,json=rateLimiter,proto3" json:"rate_limiter,omitempty"` - // The index of Component in the Circuit. - ComponentIndex int64 `protobuf:"varint,2,opt,name=component_index,json=componentIndex,proto3" json:"component_index,omitempty"` - // Name of the Policy. - PolicyName string `protobuf:"bytes,3,opt,name=policy_name,json=policyName,proto3" json:"policy_name,omitempty"` - // Hash of the entire Policy spec. - PolicyHash string `protobuf:"bytes,4,opt,name=policy_hash,json=policyHash,proto3" json:"policy_hash,omitempty"` -} - -func (x *RateLimiterWrapper) Reset() { - *x = RateLimiterWrapper{} - if protoimpl.UnsafeEnabled { - mi := &file_aperture_common_config_v1_config_properties_wrapper_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *RateLimiterWrapper) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*RateLimiterWrapper) ProtoMessage() {} - -func (x *RateLimiterWrapper) ProtoReflect() protoreflect.Message { - mi := &file_aperture_common_config_v1_config_properties_wrapper_proto_msgTypes[3] - 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 RateLimiterWrapper.ProtoReflect.Descriptor instead. -func (*RateLimiterWrapper) Descriptor() ([]byte, []int) { - return file_aperture_common_config_v1_config_properties_wrapper_proto_rawDescGZIP(), []int{3} -} - -func (x *RateLimiterWrapper) GetRateLimiter() *v1.RateLimiter { - if x != nil { - return x.RateLimiter - } - return nil -} - -func (x *RateLimiterWrapper) GetComponentIndex() int64 { - if x != nil { - return x.ComponentIndex - } - return 0 -} - -func (x *RateLimiterWrapper) GetPolicyName() string { - if x != nil { - return x.PolicyName - } - return "" -} - -func (x *RateLimiterWrapper) GetPolicyHash() string { - if x != nil { - return x.PolicyHash - } - return "" -} - -type LoadShedDecsisionWrapper struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Load Shed Decision - LoadShedDecision *v11.LoadShedDecision `protobuf:"bytes,1,opt,name=load_shed_decision,json=loadShedDecision,proto3" json:"load_shed_decision,omitempty"` - // The index of Component in the Circuit. - ComponentIndex int64 `protobuf:"varint,2,opt,name=component_index,json=componentIndex,proto3" json:"component_index,omitempty"` - // Name of the Policy. - PolicyName string `protobuf:"bytes,3,opt,name=policy_name,json=policyName,proto3" json:"policy_name,omitempty"` - // Hash of the entire Policy spec. - PolicyHash string `protobuf:"bytes,4,opt,name=policy_hash,json=policyHash,proto3" json:"policy_hash,omitempty"` -} - -func (x *LoadShedDecsisionWrapper) Reset() { - *x = LoadShedDecsisionWrapper{} - if protoimpl.UnsafeEnabled { - mi := &file_aperture_common_config_v1_config_properties_wrapper_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *LoadShedDecsisionWrapper) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*LoadShedDecsisionWrapper) ProtoMessage() {} - -func (x *LoadShedDecsisionWrapper) ProtoReflect() protoreflect.Message { - mi := &file_aperture_common_config_v1_config_properties_wrapper_proto_msgTypes[4] - 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 LoadShedDecsisionWrapper.ProtoReflect.Descriptor instead. -func (*LoadShedDecsisionWrapper) Descriptor() ([]byte, []int) { - return file_aperture_common_config_v1_config_properties_wrapper_proto_rawDescGZIP(), []int{4} -} - -func (x *LoadShedDecsisionWrapper) GetLoadShedDecision() *v11.LoadShedDecision { - if x != nil { - return x.LoadShedDecision - } - return nil -} - -func (x *LoadShedDecsisionWrapper) GetComponentIndex() int64 { - if x != nil { - return x.ComponentIndex - } - return 0 -} - -func (x *LoadShedDecsisionWrapper) GetPolicyName() string { - if x != nil { - return x.PolicyName - } - return "" -} - -func (x *LoadShedDecsisionWrapper) GetPolicyHash() string { - if x != nil { - return x.PolicyHash - } - return "" -} - -type TokensDecisionWrapper struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Tokens Decision - TokensDecision *v11.TokensDecision `protobuf:"bytes,1,opt,name=tokens_decision,json=tokensDecision,proto3" json:"tokens_decision,omitempty"` - // The index of Component in the Circuit. - ComponentIndex int64 `protobuf:"varint,2,opt,name=component_index,json=componentIndex,proto3" json:"component_index,omitempty"` - // Name of the Policy. - PolicyName string `protobuf:"bytes,3,opt,name=policy_name,json=policyName,proto3" json:"policy_name,omitempty"` - // Hash of the entire Policy spec. - PolicyHash string `protobuf:"bytes,4,opt,name=policy_hash,json=policyHash,proto3" json:"policy_hash,omitempty"` -} - -func (x *TokensDecisionWrapper) Reset() { - *x = TokensDecisionWrapper{} - if protoimpl.UnsafeEnabled { - mi := &file_aperture_common_config_v1_config_properties_wrapper_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *TokensDecisionWrapper) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*TokensDecisionWrapper) ProtoMessage() {} - -func (x *TokensDecisionWrapper) ProtoReflect() protoreflect.Message { - mi := &file_aperture_common_config_v1_config_properties_wrapper_proto_msgTypes[5] - 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 TokensDecisionWrapper.ProtoReflect.Descriptor instead. -func (*TokensDecisionWrapper) Descriptor() ([]byte, []int) { - return file_aperture_common_config_v1_config_properties_wrapper_proto_rawDescGZIP(), []int{5} -} - -func (x *TokensDecisionWrapper) GetTokensDecision() *v11.TokensDecision { - if x != nil { - return x.TokensDecision - } - return nil -} - -func (x *TokensDecisionWrapper) GetComponentIndex() int64 { - if x != nil { - return x.ComponentIndex - } - return 0 -} - -func (x *TokensDecisionWrapper) GetPolicyName() string { - if x != nil { - return x.PolicyName - } - return "" -} - -func (x *TokensDecisionWrapper) GetPolicyHash() string { - if x != nil { - return x.PolicyHash - } - return "" -} - -type RateLimiterDecisionWrapper struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Rate Limiter Decision - RateLimiterDecision *v11.RateLimiterDecision `protobuf:"bytes,1,opt,name=rate_limiter_decision,json=rateLimiterDecision,proto3" json:"rate_limiter_decision,omitempty"` - // The index of Component in the Circuit. - ComponentIndex int64 `protobuf:"varint,2,opt,name=component_index,json=componentIndex,proto3" json:"component_index,omitempty"` - // Name of the Policy. - PolicyName string `protobuf:"bytes,3,opt,name=policy_name,json=policyName,proto3" json:"policy_name,omitempty"` - // Hash of the entire Policy spec. - PolicyHash string `protobuf:"bytes,4,opt,name=policy_hash,json=policyHash,proto3" json:"policy_hash,omitempty"` -} - -func (x *RateLimiterDecisionWrapper) Reset() { - *x = RateLimiterDecisionWrapper{} - if protoimpl.UnsafeEnabled { - mi := &file_aperture_common_config_v1_config_properties_wrapper_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *RateLimiterDecisionWrapper) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*RateLimiterDecisionWrapper) ProtoMessage() {} - -func (x *RateLimiterDecisionWrapper) ProtoReflect() protoreflect.Message { - mi := &file_aperture_common_config_v1_config_properties_wrapper_proto_msgTypes[6] - 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 RateLimiterDecisionWrapper.ProtoReflect.Descriptor instead. -func (*RateLimiterDecisionWrapper) Descriptor() ([]byte, []int) { - return file_aperture_common_config_v1_config_properties_wrapper_proto_rawDescGZIP(), []int{6} -} - -func (x *RateLimiterDecisionWrapper) GetRateLimiterDecision() *v11.RateLimiterDecision { - if x != nil { - return x.RateLimiterDecision - } - return nil -} - -func (x *RateLimiterDecisionWrapper) GetComponentIndex() int64 { - if x != nil { - return x.ComponentIndex - } - return 0 -} - -func (x *RateLimiterDecisionWrapper) GetPolicyName() string { - if x != nil { - return x.PolicyName - } - return "" -} - -func (x *RateLimiterDecisionWrapper) GetPolicyHash() string { - if x != nil { - return x.PolicyHash - } - return "" -} - -var File_aperture_common_config_v1_config_properties_wrapper_proto protoreflect.FileDescriptor - -var file_aperture_common_config_v1_config_properties_wrapper_proto_rawDesc = []byte{ - 0x0a, 0x39, 0x61, 0x70, 0x65, 0x72, 0x74, 0x75, 0x72, 0x65, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, - 0x6e, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2f, 0x76, 0x31, 0x2f, 0x63, 0x6f, 0x6e, 0x66, - 0x69, 0x67, 0x5f, 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x5f, 0x77, 0x72, - 0x61, 0x70, 0x70, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x19, 0x61, 0x70, 0x65, - 0x72, 0x74, 0x75, 0x72, 0x65, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x63, 0x6f, 0x6e, - 0x66, 0x69, 0x67, 0x2e, 0x76, 0x31, 0x1a, 0x2c, 0x61, 0x70, 0x65, 0x72, 0x74, 0x75, 0x72, 0x65, - 0x2f, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2f, 0x64, 0x65, 0x63, 0x69, 0x73, 0x69, 0x6f, 0x6e, - 0x73, 0x2f, 0x76, 0x31, 0x2f, 0x64, 0x65, 0x63, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x2b, 0x61, 0x70, 0x65, 0x72, 0x74, 0x75, 0x72, 0x65, 0x2f, 0x70, - 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2f, 0x6c, 0x61, 0x6e, 0x67, 0x75, 0x61, 0x67, 0x65, 0x2f, 0x76, - 0x31, 0x2f, 0x66, 0x6c, 0x75, 0x78, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x1a, 0x28, 0x61, 0x70, 0x65, 0x72, 0x74, 0x75, 0x72, 0x65, 0x2f, 0x70, 0x6f, 0x6c, 0x69, - 0x63, 0x79, 0x2f, 0x6c, 0x61, 0x6e, 0x67, 0x75, 0x61, 0x67, 0x65, 0x2f, 0x76, 0x31, 0x2f, 0x70, - 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x8e, 0x01, 0x0a, 0x0d, - 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x57, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x12, 0x3b, 0x0a, - 0x06, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, - 0x61, 0x70, 0x65, 0x72, 0x74, 0x75, 0x72, 0x65, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, - 0x6c, 0x61, 0x6e, 0x67, 0x75, 0x61, 0x67, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x6f, 0x6c, 0x69, - 0x63, 0x79, 0x52, 0x06, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x12, 0x1f, 0x0a, 0x0b, 0x70, 0x6f, - 0x6c, 0x69, 0x63, 0x79, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x0a, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x70, - 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x0a, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x48, 0x61, 0x73, 0x68, 0x22, 0x80, 0x01, 0x0a, - 0x10, 0x46, 0x6c, 0x75, 0x78, 0x4d, 0x65, 0x74, 0x65, 0x72, 0x57, 0x72, 0x61, 0x70, 0x70, 0x65, - 0x72, 0x12, 0x45, 0x0a, 0x0a, 0x66, 0x6c, 0x75, 0x78, 0x5f, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x61, 0x70, 0x65, 0x72, 0x74, 0x75, 0x72, 0x65, - 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6c, 0x61, 0x6e, 0x67, 0x75, 0x61, 0x67, 0x65, - 0x2e, 0x76, 0x31, 0x2e, 0x46, 0x6c, 0x75, 0x78, 0x4d, 0x65, 0x74, 0x65, 0x72, 0x52, 0x09, 0x66, - 0x6c, 0x75, 0x78, 0x4d, 0x65, 0x74, 0x65, 0x72, 0x12, 0x25, 0x0a, 0x0e, 0x66, 0x6c, 0x75, 0x78, - 0x6d, 0x65, 0x74, 0x65, 0x72, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x0d, 0x66, 0x6c, 0x75, 0x78, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x22, - 0xe8, 0x01, 0x0a, 0x19, 0x43, 0x6f, 0x6e, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x63, 0x79, 0x4c, - 0x69, 0x6d, 0x69, 0x74, 0x65, 0x72, 0x57, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x12, 0x60, 0x0a, - 0x13, 0x63, 0x6f, 0x6e, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x63, 0x79, 0x5f, 0x6c, 0x69, 0x6d, - 0x69, 0x74, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2f, 0x2e, 0x61, 0x70, 0x65, - 0x72, 0x74, 0x75, 0x72, 0x65, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6c, 0x61, 0x6e, - 0x67, 0x75, 0x61, 0x67, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x6f, 0x6e, 0x63, 0x75, 0x72, 0x72, - 0x65, 0x6e, 0x63, 0x79, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x65, 0x72, 0x52, 0x12, 0x63, 0x6f, 0x6e, - 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x63, 0x79, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x65, 0x72, 0x12, - 0x27, 0x0a, 0x0f, 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x5f, 0x69, 0x6e, 0x64, - 0x65, 0x78, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0e, 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, - 0x65, 0x6e, 0x74, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x12, 0x1f, 0x0a, 0x0b, 0x70, 0x6f, 0x6c, 0x69, - 0x63, 0x79, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x70, - 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x70, 0x6f, 0x6c, - 0x69, 0x63, 0x79, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, - 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x48, 0x61, 0x73, 0x68, 0x22, 0xcc, 0x01, 0x0a, 0x12, 0x52, - 0x61, 0x74, 0x65, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x65, 0x72, 0x57, 0x72, 0x61, 0x70, 0x70, 0x65, - 0x72, 0x12, 0x4b, 0x0a, 0x0c, 0x72, 0x61, 0x74, 0x65, 0x5f, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x65, - 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x28, 0x2e, 0x61, 0x70, 0x65, 0x72, 0x74, 0x75, - 0x72, 0x65, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6c, 0x61, 0x6e, 0x67, 0x75, 0x61, - 0x67, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x52, 0x61, 0x74, 0x65, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x65, - 0x72, 0x52, 0x0b, 0x72, 0x61, 0x74, 0x65, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x65, 0x72, 0x12, 0x27, - 0x0a, 0x0f, 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x5f, 0x69, 0x6e, 0x64, 0x65, - 0x78, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0e, 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, - 0x6e, 0x74, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x12, 0x1f, 0x0a, 0x0b, 0x70, 0x6f, 0x6c, 0x69, 0x63, - 0x79, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x70, 0x6f, - 0x6c, 0x69, 0x63, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x70, 0x6f, 0x6c, 0x69, - 0x63, 0x79, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x70, - 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x48, 0x61, 0x73, 0x68, 0x22, 0xe3, 0x01, 0x0a, 0x18, 0x4c, 0x6f, - 0x61, 0x64, 0x53, 0x68, 0x65, 0x64, 0x44, 0x65, 0x63, 0x73, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x57, - 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x12, 0x5c, 0x0a, 0x12, 0x6c, 0x6f, 0x61, 0x64, 0x5f, 0x73, - 0x68, 0x65, 0x64, 0x5f, 0x64, 0x65, 0x63, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x2e, 0x2e, 0x61, 0x70, 0x65, 0x72, 0x74, 0x75, 0x72, 0x65, 0x2e, 0x70, 0x6f, - 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x64, 0x65, 0x63, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x76, - 0x31, 0x2e, 0x4c, 0x6f, 0x61, 0x64, 0x53, 0x68, 0x65, 0x64, 0x44, 0x65, 0x63, 0x69, 0x73, 0x69, - 0x6f, 0x6e, 0x52, 0x10, 0x6c, 0x6f, 0x61, 0x64, 0x53, 0x68, 0x65, 0x64, 0x44, 0x65, 0x63, 0x69, - 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x27, 0x0a, 0x0f, 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, - 0x74, 0x5f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0e, 0x63, - 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x12, 0x1f, 0x0a, - 0x0b, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x0a, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1f, - 0x0a, 0x0b, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x18, 0x04, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x0a, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x48, 0x61, 0x73, 0x68, 0x22, - 0xd9, 0x01, 0x0a, 0x15, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x44, 0x65, 0x63, 0x69, 0x73, 0x69, - 0x6f, 0x6e, 0x57, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x12, 0x55, 0x0a, 0x0f, 0x74, 0x6f, 0x6b, - 0x65, 0x6e, 0x73, 0x5f, 0x64, 0x65, 0x63, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x61, 0x70, 0x65, 0x72, 0x74, 0x75, 0x72, 0x65, 0x2e, 0x70, 0x6f, - 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x64, 0x65, 0x63, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x76, - 0x31, 0x2e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x44, 0x65, 0x63, 0x69, 0x73, 0x69, 0x6f, 0x6e, - 0x52, 0x0e, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x44, 0x65, 0x63, 0x69, 0x73, 0x69, 0x6f, 0x6e, - 0x12, 0x27, 0x0a, 0x0f, 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x5f, 0x69, 0x6e, - 0x64, 0x65, 0x78, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0e, 0x63, 0x6f, 0x6d, 0x70, 0x6f, - 0x6e, 0x65, 0x6e, 0x74, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x12, 0x1f, 0x0a, 0x0b, 0x70, 0x6f, 0x6c, - 0x69, 0x63, 0x79, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, - 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x70, 0x6f, - 0x6c, 0x69, 0x63, 0x79, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x0a, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x48, 0x61, 0x73, 0x68, 0x22, 0xee, 0x01, 0x0a, 0x1a, - 0x52, 0x61, 0x74, 0x65, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x65, 0x72, 0x44, 0x65, 0x63, 0x69, 0x73, - 0x69, 0x6f, 0x6e, 0x57, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x12, 0x65, 0x0a, 0x15, 0x72, 0x61, - 0x74, 0x65, 0x5f, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x65, 0x72, 0x5f, 0x64, 0x65, 0x63, 0x69, 0x73, - 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x31, 0x2e, 0x61, 0x70, 0x65, 0x72, - 0x74, 0x75, 0x72, 0x65, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x64, 0x65, 0x63, 0x69, - 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x52, 0x61, 0x74, 0x65, 0x4c, 0x69, 0x6d, - 0x69, 0x74, 0x65, 0x72, 0x44, 0x65, 0x63, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x13, 0x72, 0x61, - 0x74, 0x65, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x65, 0x72, 0x44, 0x65, 0x63, 0x69, 0x73, 0x69, 0x6f, - 0x6e, 0x12, 0x27, 0x0a, 0x0f, 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x5f, 0x69, - 0x6e, 0x64, 0x65, 0x78, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0e, 0x63, 0x6f, 0x6d, 0x70, - 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x12, 0x1f, 0x0a, 0x0b, 0x70, 0x6f, - 0x6c, 0x69, 0x63, 0x79, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x0a, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x70, - 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x0a, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x48, 0x61, 0x73, 0x68, 0x42, 0x97, 0x02, 0x0a, - 0x1d, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x70, 0x65, 0x72, 0x74, 0x75, 0x72, 0x65, 0x2e, 0x63, 0x6f, - 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x76, 0x31, 0x42, 0x1c, - 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, - 0x57, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x51, - 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x66, 0x6c, 0x75, 0x78, 0x6e, - 0x69, 0x6e, 0x6a, 0x61, 0x2f, 0x61, 0x70, 0x65, 0x72, 0x74, 0x75, 0x72, 0x65, 0x2f, 0x61, 0x70, - 0x69, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x2f, 0x61, - 0x70, 0x65, 0x72, 0x74, 0x75, 0x72, 0x65, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x63, - 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2f, 0x76, 0x31, 0x3b, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x76, - 0x31, 0xa2, 0x02, 0x03, 0x41, 0x43, 0x43, 0xaa, 0x02, 0x19, 0x41, 0x70, 0x65, 0x72, 0x74, 0x75, - 0x72, 0x65, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, - 0x2e, 0x56, 0x31, 0xca, 0x02, 0x19, 0x41, 0x70, 0x65, 0x72, 0x74, 0x75, 0x72, 0x65, 0x5c, 0x43, - 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x5c, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x5c, 0x56, 0x31, 0xe2, - 0x02, 0x25, 0x41, 0x70, 0x65, 0x72, 0x74, 0x75, 0x72, 0x65, 0x5c, 0x43, 0x6f, 0x6d, 0x6d, 0x6f, - 0x6e, 0x5c, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, - 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x1c, 0x41, 0x70, 0x65, 0x72, 0x74, 0x75, - 0x72, 0x65, 0x3a, 0x3a, 0x43, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x3a, 0x3a, 0x43, 0x6f, 0x6e, 0x66, - 0x69, 0x67, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_aperture_common_config_v1_config_properties_wrapper_proto_rawDescOnce sync.Once - file_aperture_common_config_v1_config_properties_wrapper_proto_rawDescData = file_aperture_common_config_v1_config_properties_wrapper_proto_rawDesc -) - -func file_aperture_common_config_v1_config_properties_wrapper_proto_rawDescGZIP() []byte { - file_aperture_common_config_v1_config_properties_wrapper_proto_rawDescOnce.Do(func() { - file_aperture_common_config_v1_config_properties_wrapper_proto_rawDescData = protoimpl.X.CompressGZIP(file_aperture_common_config_v1_config_properties_wrapper_proto_rawDescData) - }) - return file_aperture_common_config_v1_config_properties_wrapper_proto_rawDescData -} - -var file_aperture_common_config_v1_config_properties_wrapper_proto_msgTypes = make([]protoimpl.MessageInfo, 7) -var file_aperture_common_config_v1_config_properties_wrapper_proto_goTypes = []interface{}{ - (*PolicyWrapper)(nil), // 0: aperture.common.config.v1.PolicyWrapper - (*FluxMeterWrapper)(nil), // 1: aperture.common.config.v1.FluxMeterWrapper - (*ConcurrencyLimiterWrapper)(nil), // 2: aperture.common.config.v1.ConcurrencyLimiterWrapper - (*RateLimiterWrapper)(nil), // 3: aperture.common.config.v1.RateLimiterWrapper - (*LoadShedDecsisionWrapper)(nil), // 4: aperture.common.config.v1.LoadShedDecsisionWrapper - (*TokensDecisionWrapper)(nil), // 5: aperture.common.config.v1.TokensDecisionWrapper - (*RateLimiterDecisionWrapper)(nil), // 6: aperture.common.config.v1.RateLimiterDecisionWrapper - (*v1.Policy)(nil), // 7: aperture.policy.language.v1.Policy - (*v1.FluxMeter)(nil), // 8: aperture.policy.language.v1.FluxMeter - (*v1.ConcurrencyLimiter)(nil), // 9: aperture.policy.language.v1.ConcurrencyLimiter - (*v1.RateLimiter)(nil), // 10: aperture.policy.language.v1.RateLimiter - (*v11.LoadShedDecision)(nil), // 11: aperture.policy.decisions.v1.LoadShedDecision - (*v11.TokensDecision)(nil), // 12: aperture.policy.decisions.v1.TokensDecision - (*v11.RateLimiterDecision)(nil), // 13: aperture.policy.decisions.v1.RateLimiterDecision -} -var file_aperture_common_config_v1_config_properties_wrapper_proto_depIdxs = []int32{ - 7, // 0: aperture.common.config.v1.PolicyWrapper.policy:type_name -> aperture.policy.language.v1.Policy - 8, // 1: aperture.common.config.v1.FluxMeterWrapper.flux_meter:type_name -> aperture.policy.language.v1.FluxMeter - 9, // 2: aperture.common.config.v1.ConcurrencyLimiterWrapper.concurrency_limiter:type_name -> aperture.policy.language.v1.ConcurrencyLimiter - 10, // 3: aperture.common.config.v1.RateLimiterWrapper.rate_limiter:type_name -> aperture.policy.language.v1.RateLimiter - 11, // 4: aperture.common.config.v1.LoadShedDecsisionWrapper.load_shed_decision:type_name -> aperture.policy.decisions.v1.LoadShedDecision - 12, // 5: aperture.common.config.v1.TokensDecisionWrapper.tokens_decision:type_name -> aperture.policy.decisions.v1.TokensDecision - 13, // 6: aperture.common.config.v1.RateLimiterDecisionWrapper.rate_limiter_decision:type_name -> aperture.policy.decisions.v1.RateLimiterDecision - 7, // [7:7] is the sub-list for method output_type - 7, // [7:7] is the sub-list for method input_type - 7, // [7:7] is the sub-list for extension type_name - 7, // [7:7] is the sub-list for extension extendee - 0, // [0:7] is the sub-list for field type_name -} - -func init() { file_aperture_common_config_v1_config_properties_wrapper_proto_init() } -func file_aperture_common_config_v1_config_properties_wrapper_proto_init() { - if File_aperture_common_config_v1_config_properties_wrapper_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_aperture_common_config_v1_config_properties_wrapper_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PolicyWrapper); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_aperture_common_config_v1_config_properties_wrapper_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*FluxMeterWrapper); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_aperture_common_config_v1_config_properties_wrapper_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ConcurrencyLimiterWrapper); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_aperture_common_config_v1_config_properties_wrapper_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*RateLimiterWrapper); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_aperture_common_config_v1_config_properties_wrapper_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*LoadShedDecsisionWrapper); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_aperture_common_config_v1_config_properties_wrapper_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*TokensDecisionWrapper); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_aperture_common_config_v1_config_properties_wrapper_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*RateLimiterDecisionWrapper); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_aperture_common_config_v1_config_properties_wrapper_proto_rawDesc, - NumEnums: 0, - NumMessages: 7, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_aperture_common_config_v1_config_properties_wrapper_proto_goTypes, - DependencyIndexes: file_aperture_common_config_v1_config_properties_wrapper_proto_depIdxs, - MessageInfos: file_aperture_common_config_v1_config_properties_wrapper_proto_msgTypes, - }.Build() - File_aperture_common_config_v1_config_properties_wrapper_proto = out.File - file_aperture_common_config_v1_config_properties_wrapper_proto_rawDesc = nil - file_aperture_common_config_v1_config_properties_wrapper_proto_goTypes = nil - file_aperture_common_config_v1_config_properties_wrapper_proto_depIdxs = nil -} diff --git a/api/gen/proto/go/aperture/policy/wrappers/v1/decisions.pb.go b/api/gen/proto/go/aperture/policy/wrappers/v1/decisions.pb.go new file mode 100644 index 0000000000..f0c468f75d --- /dev/null +++ b/api/gen/proto/go/aperture/policy/wrappers/v1/decisions.pb.go @@ -0,0 +1,416 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.27.1 +// protoc (unknown) +// source: aperture/policy/wrappers/v1/decisions.proto + +package wrappersv1 + +import ( + v1 "github.com/fluxninja/aperture/api/gen/proto/go/aperture/policy/decisions/v1" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type LoadShedDecsisionWrapper struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Load Shed Decision + LoadShedDecision *v1.LoadShedDecision `protobuf:"bytes,1,opt,name=load_shed_decision,json=loadShedDecision,proto3" json:"load_shed_decision,omitempty"` + // The index of Component in the Circuit. + ComponentIndex int64 `protobuf:"varint,2,opt,name=component_index,json=componentIndex,proto3" json:"component_index,omitempty"` + // Name of the Policy. + PolicyName string `protobuf:"bytes,3,opt,name=policy_name,json=policyName,proto3" json:"policy_name,omitempty"` + // Hash of the entire Policy spec. + PolicyHash string `protobuf:"bytes,4,opt,name=policy_hash,json=policyHash,proto3" json:"policy_hash,omitempty"` +} + +func (x *LoadShedDecsisionWrapper) Reset() { + *x = LoadShedDecsisionWrapper{} + if protoimpl.UnsafeEnabled { + mi := &file_aperture_policy_wrappers_v1_decisions_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *LoadShedDecsisionWrapper) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LoadShedDecsisionWrapper) ProtoMessage() {} + +func (x *LoadShedDecsisionWrapper) ProtoReflect() protoreflect.Message { + mi := &file_aperture_policy_wrappers_v1_decisions_proto_msgTypes[0] + 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 LoadShedDecsisionWrapper.ProtoReflect.Descriptor instead. +func (*LoadShedDecsisionWrapper) Descriptor() ([]byte, []int) { + return file_aperture_policy_wrappers_v1_decisions_proto_rawDescGZIP(), []int{0} +} + +func (x *LoadShedDecsisionWrapper) GetLoadShedDecision() *v1.LoadShedDecision { + if x != nil { + return x.LoadShedDecision + } + return nil +} + +func (x *LoadShedDecsisionWrapper) GetComponentIndex() int64 { + if x != nil { + return x.ComponentIndex + } + return 0 +} + +func (x *LoadShedDecsisionWrapper) GetPolicyName() string { + if x != nil { + return x.PolicyName + } + return "" +} + +func (x *LoadShedDecsisionWrapper) GetPolicyHash() string { + if x != nil { + return x.PolicyHash + } + return "" +} + +type TokensDecisionWrapper struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Tokens Decision + TokensDecision *v1.TokensDecision `protobuf:"bytes,1,opt,name=tokens_decision,json=tokensDecision,proto3" json:"tokens_decision,omitempty"` + // The index of Component in the Circuit. + ComponentIndex int64 `protobuf:"varint,2,opt,name=component_index,json=componentIndex,proto3" json:"component_index,omitempty"` + // Name of the Policy. + PolicyName string `protobuf:"bytes,3,opt,name=policy_name,json=policyName,proto3" json:"policy_name,omitempty"` + // Hash of the entire Policy spec. + PolicyHash string `protobuf:"bytes,4,opt,name=policy_hash,json=policyHash,proto3" json:"policy_hash,omitempty"` +} + +func (x *TokensDecisionWrapper) Reset() { + *x = TokensDecisionWrapper{} + if protoimpl.UnsafeEnabled { + mi := &file_aperture_policy_wrappers_v1_decisions_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *TokensDecisionWrapper) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TokensDecisionWrapper) ProtoMessage() {} + +func (x *TokensDecisionWrapper) ProtoReflect() protoreflect.Message { + mi := &file_aperture_policy_wrappers_v1_decisions_proto_msgTypes[1] + 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 TokensDecisionWrapper.ProtoReflect.Descriptor instead. +func (*TokensDecisionWrapper) Descriptor() ([]byte, []int) { + return file_aperture_policy_wrappers_v1_decisions_proto_rawDescGZIP(), []int{1} +} + +func (x *TokensDecisionWrapper) GetTokensDecision() *v1.TokensDecision { + if x != nil { + return x.TokensDecision + } + return nil +} + +func (x *TokensDecisionWrapper) GetComponentIndex() int64 { + if x != nil { + return x.ComponentIndex + } + return 0 +} + +func (x *TokensDecisionWrapper) GetPolicyName() string { + if x != nil { + return x.PolicyName + } + return "" +} + +func (x *TokensDecisionWrapper) GetPolicyHash() string { + if x != nil { + return x.PolicyHash + } + return "" +} + +type RateLimiterDecisionWrapper struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Rate Limiter Decision + RateLimiterDecision *v1.RateLimiterDecision `protobuf:"bytes,1,opt,name=rate_limiter_decision,json=rateLimiterDecision,proto3" json:"rate_limiter_decision,omitempty"` + // The index of Component in the Circuit. + ComponentIndex int64 `protobuf:"varint,2,opt,name=component_index,json=componentIndex,proto3" json:"component_index,omitempty"` + // Name of the Policy. + PolicyName string `protobuf:"bytes,3,opt,name=policy_name,json=policyName,proto3" json:"policy_name,omitempty"` + // Hash of the entire Policy spec. + PolicyHash string `protobuf:"bytes,4,opt,name=policy_hash,json=policyHash,proto3" json:"policy_hash,omitempty"` +} + +func (x *RateLimiterDecisionWrapper) Reset() { + *x = RateLimiterDecisionWrapper{} + if protoimpl.UnsafeEnabled { + mi := &file_aperture_policy_wrappers_v1_decisions_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RateLimiterDecisionWrapper) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RateLimiterDecisionWrapper) ProtoMessage() {} + +func (x *RateLimiterDecisionWrapper) ProtoReflect() protoreflect.Message { + mi := &file_aperture_policy_wrappers_v1_decisions_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 RateLimiterDecisionWrapper.ProtoReflect.Descriptor instead. +func (*RateLimiterDecisionWrapper) Descriptor() ([]byte, []int) { + return file_aperture_policy_wrappers_v1_decisions_proto_rawDescGZIP(), []int{2} +} + +func (x *RateLimiterDecisionWrapper) GetRateLimiterDecision() *v1.RateLimiterDecision { + if x != nil { + return x.RateLimiterDecision + } + return nil +} + +func (x *RateLimiterDecisionWrapper) GetComponentIndex() int64 { + if x != nil { + return x.ComponentIndex + } + return 0 +} + +func (x *RateLimiterDecisionWrapper) GetPolicyName() string { + if x != nil { + return x.PolicyName + } + return "" +} + +func (x *RateLimiterDecisionWrapper) GetPolicyHash() string { + if x != nil { + return x.PolicyHash + } + return "" +} + +var File_aperture_policy_wrappers_v1_decisions_proto protoreflect.FileDescriptor + +var file_aperture_policy_wrappers_v1_decisions_proto_rawDesc = []byte{ + 0x0a, 0x2b, 0x61, 0x70, 0x65, 0x72, 0x74, 0x75, 0x72, 0x65, 0x2f, 0x70, 0x6f, 0x6c, 0x69, 0x63, + 0x79, 0x2f, 0x77, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x73, 0x2f, 0x76, 0x31, 0x2f, 0x64, 0x65, + 0x63, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x1b, 0x61, + 0x70, 0x65, 0x72, 0x74, 0x75, 0x72, 0x65, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x77, + 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x73, 0x2e, 0x76, 0x31, 0x1a, 0x2c, 0x61, 0x70, 0x65, 0x72, + 0x74, 0x75, 0x72, 0x65, 0x2f, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2f, 0x64, 0x65, 0x63, 0x69, + 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x76, 0x31, 0x2f, 0x64, 0x65, 0x63, 0x69, 0x73, 0x69, 0x6f, + 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xe3, 0x01, 0x0a, 0x18, 0x4c, 0x6f, 0x61, + 0x64, 0x53, 0x68, 0x65, 0x64, 0x44, 0x65, 0x63, 0x73, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x57, 0x72, + 0x61, 0x70, 0x70, 0x65, 0x72, 0x12, 0x5c, 0x0a, 0x12, 0x6c, 0x6f, 0x61, 0x64, 0x5f, 0x73, 0x68, + 0x65, 0x64, 0x5f, 0x64, 0x65, 0x63, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x2e, 0x2e, 0x61, 0x70, 0x65, 0x72, 0x74, 0x75, 0x72, 0x65, 0x2e, 0x70, 0x6f, 0x6c, + 0x69, 0x63, 0x79, 0x2e, 0x64, 0x65, 0x63, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x76, 0x31, + 0x2e, 0x4c, 0x6f, 0x61, 0x64, 0x53, 0x68, 0x65, 0x64, 0x44, 0x65, 0x63, 0x69, 0x73, 0x69, 0x6f, + 0x6e, 0x52, 0x10, 0x6c, 0x6f, 0x61, 0x64, 0x53, 0x68, 0x65, 0x64, 0x44, 0x65, 0x63, 0x69, 0x73, + 0x69, 0x6f, 0x6e, 0x12, 0x27, 0x0a, 0x0f, 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, + 0x5f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0e, 0x63, 0x6f, + 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x12, 0x1f, 0x0a, 0x0b, + 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x0a, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1f, 0x0a, + 0x0b, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x18, 0x04, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x0a, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x48, 0x61, 0x73, 0x68, 0x22, 0xd9, + 0x01, 0x0a, 0x15, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x44, 0x65, 0x63, 0x69, 0x73, 0x69, 0x6f, + 0x6e, 0x57, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x12, 0x55, 0x0a, 0x0f, 0x74, 0x6f, 0x6b, 0x65, + 0x6e, 0x73, 0x5f, 0x64, 0x65, 0x63, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x2c, 0x2e, 0x61, 0x70, 0x65, 0x72, 0x74, 0x75, 0x72, 0x65, 0x2e, 0x70, 0x6f, 0x6c, + 0x69, 0x63, 0x79, 0x2e, 0x64, 0x65, 0x63, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x76, 0x31, + 0x2e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x44, 0x65, 0x63, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x52, + 0x0e, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x44, 0x65, 0x63, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x12, + 0x27, 0x0a, 0x0f, 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x5f, 0x69, 0x6e, 0x64, + 0x65, 0x78, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0e, 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, + 0x65, 0x6e, 0x74, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x12, 0x1f, 0x0a, 0x0b, 0x70, 0x6f, 0x6c, 0x69, + 0x63, 0x79, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x70, + 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x70, 0x6f, 0x6c, + 0x69, 0x63, 0x79, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, + 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x48, 0x61, 0x73, 0x68, 0x22, 0xee, 0x01, 0x0a, 0x1a, 0x52, + 0x61, 0x74, 0x65, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x65, 0x72, 0x44, 0x65, 0x63, 0x69, 0x73, 0x69, + 0x6f, 0x6e, 0x57, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x12, 0x65, 0x0a, 0x15, 0x72, 0x61, 0x74, + 0x65, 0x5f, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x65, 0x72, 0x5f, 0x64, 0x65, 0x63, 0x69, 0x73, 0x69, + 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x31, 0x2e, 0x61, 0x70, 0x65, 0x72, 0x74, + 0x75, 0x72, 0x65, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x64, 0x65, 0x63, 0x69, 0x73, + 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x52, 0x61, 0x74, 0x65, 0x4c, 0x69, 0x6d, 0x69, + 0x74, 0x65, 0x72, 0x44, 0x65, 0x63, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x13, 0x72, 0x61, 0x74, + 0x65, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x65, 0x72, 0x44, 0x65, 0x63, 0x69, 0x73, 0x69, 0x6f, 0x6e, + 0x12, 0x27, 0x0a, 0x0f, 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x5f, 0x69, 0x6e, + 0x64, 0x65, 0x78, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0e, 0x63, 0x6f, 0x6d, 0x70, 0x6f, + 0x6e, 0x65, 0x6e, 0x74, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x12, 0x1f, 0x0a, 0x0b, 0x70, 0x6f, 0x6c, + 0x69, 0x63, 0x79, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, + 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x70, 0x6f, + 0x6c, 0x69, 0x63, 0x79, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x0a, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x48, 0x61, 0x73, 0x68, 0x42, 0x97, 0x02, 0x0a, 0x1f, + 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x70, 0x65, 0x72, 0x74, 0x75, 0x72, 0x65, 0x2e, 0x70, 0x6f, 0x6c, + 0x69, 0x63, 0x79, 0x2e, 0x77, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x73, 0x2e, 0x76, 0x31, 0x42, + 0x0e, 0x44, 0x65, 0x63, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, + 0x01, 0x5a, 0x55, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x66, 0x6c, + 0x75, 0x78, 0x6e, 0x69, 0x6e, 0x6a, 0x61, 0x2f, 0x61, 0x70, 0x65, 0x72, 0x74, 0x75, 0x72, 0x65, + 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, + 0x6f, 0x2f, 0x61, 0x70, 0x65, 0x72, 0x74, 0x75, 0x72, 0x65, 0x2f, 0x70, 0x6f, 0x6c, 0x69, 0x63, + 0x79, 0x2f, 0x77, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x73, 0x2f, 0x76, 0x31, 0x3b, 0x77, 0x72, + 0x61, 0x70, 0x70, 0x65, 0x72, 0x73, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x41, 0x50, 0x57, 0xaa, 0x02, + 0x1b, 0x41, 0x70, 0x65, 0x72, 0x74, 0x75, 0x72, 0x65, 0x2e, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, + 0x2e, 0x57, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x73, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x1b, 0x41, + 0x70, 0x65, 0x72, 0x74, 0x75, 0x72, 0x65, 0x5c, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x5c, 0x57, + 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x73, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x27, 0x41, 0x70, 0x65, + 0x72, 0x74, 0x75, 0x72, 0x65, 0x5c, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x5c, 0x57, 0x72, 0x61, + 0x70, 0x70, 0x65, 0x72, 0x73, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, + 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x1e, 0x41, 0x70, 0x65, 0x72, 0x74, 0x75, 0x72, 0x65, 0x3a, + 0x3a, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x3a, 0x3a, 0x57, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, + 0x73, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_aperture_policy_wrappers_v1_decisions_proto_rawDescOnce sync.Once + file_aperture_policy_wrappers_v1_decisions_proto_rawDescData = file_aperture_policy_wrappers_v1_decisions_proto_rawDesc +) + +func file_aperture_policy_wrappers_v1_decisions_proto_rawDescGZIP() []byte { + file_aperture_policy_wrappers_v1_decisions_proto_rawDescOnce.Do(func() { + file_aperture_policy_wrappers_v1_decisions_proto_rawDescData = protoimpl.X.CompressGZIP(file_aperture_policy_wrappers_v1_decisions_proto_rawDescData) + }) + return file_aperture_policy_wrappers_v1_decisions_proto_rawDescData +} + +var file_aperture_policy_wrappers_v1_decisions_proto_msgTypes = make([]protoimpl.MessageInfo, 3) +var file_aperture_policy_wrappers_v1_decisions_proto_goTypes = []interface{}{ + (*LoadShedDecsisionWrapper)(nil), // 0: aperture.policy.wrappers.v1.LoadShedDecsisionWrapper + (*TokensDecisionWrapper)(nil), // 1: aperture.policy.wrappers.v1.TokensDecisionWrapper + (*RateLimiterDecisionWrapper)(nil), // 2: aperture.policy.wrappers.v1.RateLimiterDecisionWrapper + (*v1.LoadShedDecision)(nil), // 3: aperture.policy.decisions.v1.LoadShedDecision + (*v1.TokensDecision)(nil), // 4: aperture.policy.decisions.v1.TokensDecision + (*v1.RateLimiterDecision)(nil), // 5: aperture.policy.decisions.v1.RateLimiterDecision +} +var file_aperture_policy_wrappers_v1_decisions_proto_depIdxs = []int32{ + 3, // 0: aperture.policy.wrappers.v1.LoadShedDecsisionWrapper.load_shed_decision:type_name -> aperture.policy.decisions.v1.LoadShedDecision + 4, // 1: aperture.policy.wrappers.v1.TokensDecisionWrapper.tokens_decision:type_name -> aperture.policy.decisions.v1.TokensDecision + 5, // 2: aperture.policy.wrappers.v1.RateLimiterDecisionWrapper.rate_limiter_decision:type_name -> aperture.policy.decisions.v1.RateLimiterDecision + 3, // [3:3] is the sub-list for method output_type + 3, // [3:3] is the sub-list for method input_type + 3, // [3:3] is the sub-list for extension type_name + 3, // [3:3] is the sub-list for extension extendee + 0, // [0:3] is the sub-list for field type_name +} + +func init() { file_aperture_policy_wrappers_v1_decisions_proto_init() } +func file_aperture_policy_wrappers_v1_decisions_proto_init() { + if File_aperture_policy_wrappers_v1_decisions_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_aperture_policy_wrappers_v1_decisions_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*LoadShedDecsisionWrapper); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_aperture_policy_wrappers_v1_decisions_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*TokensDecisionWrapper); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_aperture_policy_wrappers_v1_decisions_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RateLimiterDecisionWrapper); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_aperture_policy_wrappers_v1_decisions_proto_rawDesc, + NumEnums: 0, + NumMessages: 3, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_aperture_policy_wrappers_v1_decisions_proto_goTypes, + DependencyIndexes: file_aperture_policy_wrappers_v1_decisions_proto_depIdxs, + MessageInfos: file_aperture_policy_wrappers_v1_decisions_proto_msgTypes, + }.Build() + File_aperture_policy_wrappers_v1_decisions_proto = out.File + file_aperture_policy_wrappers_v1_decisions_proto_rawDesc = nil + file_aperture_policy_wrappers_v1_decisions_proto_goTypes = nil + file_aperture_policy_wrappers_v1_decisions_proto_depIdxs = nil +} diff --git a/api/gen/proto/go/aperture/policy/wrappers/v1/decisions.pb.json.go b/api/gen/proto/go/aperture/policy/wrappers/v1/decisions.pb.json.go new file mode 100644 index 0000000000..48a5e48cbb --- /dev/null +++ b/api/gen/proto/go/aperture/policy/wrappers/v1/decisions.pb.json.go @@ -0,0 +1,56 @@ +// Code generated by protoc-gen-go-json. DO NOT EDIT. +// source: aperture/policy/wrappers/v1/decisions.proto + +package wrappersv1 + +import ( + "google.golang.org/protobuf/encoding/protojson" +) + +// MarshalJSON implements json.Marshaler +func (msg *LoadShedDecsisionWrapper) MarshalJSON() ([]byte, error) { + return protojson.MarshalOptions{ + UseEnumNumbers: false, + EmitUnpopulated: true, + UseProtoNames: true, + }.Marshal(msg) +} + +// UnmarshalJSON implements json.Unmarshaler +func (msg *LoadShedDecsisionWrapper) UnmarshalJSON(b []byte) error { + return protojson.UnmarshalOptions{ + DiscardUnknown: false, + }.Unmarshal(b, msg) +} + +// MarshalJSON implements json.Marshaler +func (msg *TokensDecisionWrapper) MarshalJSON() ([]byte, error) { + return protojson.MarshalOptions{ + UseEnumNumbers: false, + EmitUnpopulated: true, + UseProtoNames: true, + }.Marshal(msg) +} + +// UnmarshalJSON implements json.Unmarshaler +func (msg *TokensDecisionWrapper) UnmarshalJSON(b []byte) error { + return protojson.UnmarshalOptions{ + DiscardUnknown: false, + }.Unmarshal(b, msg) +} + +// MarshalJSON implements json.Marshaler +func (msg *RateLimiterDecisionWrapper) MarshalJSON() ([]byte, error) { + return protojson.MarshalOptions{ + UseEnumNumbers: false, + EmitUnpopulated: true, + UseProtoNames: true, + }.Marshal(msg) +} + +// UnmarshalJSON implements json.Unmarshaler +func (msg *RateLimiterDecisionWrapper) UnmarshalJSON(b []byte) error { + return protojson.UnmarshalOptions{ + DiscardUnknown: false, + }.Unmarshal(b, msg) +} diff --git a/api/gen/proto/go/aperture/policy/wrappers/v1/decisions_deepcopy.gen.go b/api/gen/proto/go/aperture/policy/wrappers/v1/decisions_deepcopy.gen.go new file mode 100644 index 0000000000..c95fe02ac5 --- /dev/null +++ b/api/gen/proto/go/aperture/policy/wrappers/v1/decisions_deepcopy.gen.go @@ -0,0 +1,69 @@ +// Code generated by protoc-gen-deepcopy. DO NOT EDIT. +package wrappersv1 + +import ( + proto "github.com/golang/protobuf/proto" +) + +// DeepCopyInto supports using LoadShedDecsisionWrapper within kubernetes types, where deepcopy-gen is used. +func (in *LoadShedDecsisionWrapper) DeepCopyInto(out *LoadShedDecsisionWrapper) { + p := proto.Clone(in).(*LoadShedDecsisionWrapper) + *out = *p +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LoadShedDecsisionWrapper. Required by controller-gen. +func (in *LoadShedDecsisionWrapper) DeepCopy() *LoadShedDecsisionWrapper { + if in == nil { + return nil + } + out := new(LoadShedDecsisionWrapper) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInterface is an autogenerated deepcopy function, copying the receiver, creating a new LoadShedDecsisionWrapper. Required by controller-gen. +func (in *LoadShedDecsisionWrapper) DeepCopyInterface() interface{} { + return in.DeepCopy() +} + +// DeepCopyInto supports using TokensDecisionWrapper within kubernetes types, where deepcopy-gen is used. +func (in *TokensDecisionWrapper) DeepCopyInto(out *TokensDecisionWrapper) { + p := proto.Clone(in).(*TokensDecisionWrapper) + *out = *p +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TokensDecisionWrapper. Required by controller-gen. +func (in *TokensDecisionWrapper) DeepCopy() *TokensDecisionWrapper { + if in == nil { + return nil + } + out := new(TokensDecisionWrapper) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInterface is an autogenerated deepcopy function, copying the receiver, creating a new TokensDecisionWrapper. Required by controller-gen. +func (in *TokensDecisionWrapper) DeepCopyInterface() interface{} { + return in.DeepCopy() +} + +// DeepCopyInto supports using RateLimiterDecisionWrapper within kubernetes types, where deepcopy-gen is used. +func (in *RateLimiterDecisionWrapper) DeepCopyInto(out *RateLimiterDecisionWrapper) { + p := proto.Clone(in).(*RateLimiterDecisionWrapper) + *out = *p +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RateLimiterDecisionWrapper. Required by controller-gen. +func (in *RateLimiterDecisionWrapper) DeepCopy() *RateLimiterDecisionWrapper { + if in == nil { + return nil + } + out := new(RateLimiterDecisionWrapper) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInterface is an autogenerated deepcopy function, copying the receiver, creating a new RateLimiterDecisionWrapper. Required by controller-gen. +func (in *RateLimiterDecisionWrapper) DeepCopyInterface() interface{} { + return in.DeepCopy() +} diff --git a/api/gen/proto/go/aperture/policy/wrappers/v1/policy.pb.go b/api/gen/proto/go/aperture/policy/wrappers/v1/policy.pb.go new file mode 100644 index 0000000000..446ad35774 --- /dev/null +++ b/api/gen/proto/go/aperture/policy/wrappers/v1/policy.pb.go @@ -0,0 +1,483 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.27.1 +// protoc (unknown) +// source: aperture/policy/wrappers/v1/policy.proto + +package wrappersv1 + +import ( + v1 "github.com/fluxninja/aperture/api/gen/proto/go/aperture/policy/language/v1" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type PolicyWrapper struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Policy + Policy *v1.Policy `protobuf:"bytes,1,opt,name=policy,proto3" json:"policy,omitempty"` + // Name of the Policy. + PolicyName string `protobuf:"bytes,2,opt,name=policy_name,json=policyName,proto3" json:"policy_name,omitempty"` + // Hash of the entire Policy spec. + PolicyHash string `protobuf:"bytes,3,opt,name=policy_hash,json=policyHash,proto3" json:"policy_hash,omitempty"` +} + +func (x *PolicyWrapper) Reset() { + *x = PolicyWrapper{} + if protoimpl.UnsafeEnabled { + mi := &file_aperture_policy_wrappers_v1_policy_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PolicyWrapper) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PolicyWrapper) ProtoMessage() {} + +func (x *PolicyWrapper) ProtoReflect() protoreflect.Message { + mi := &file_aperture_policy_wrappers_v1_policy_proto_msgTypes[0] + 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 PolicyWrapper.ProtoReflect.Descriptor instead. +func (*PolicyWrapper) Descriptor() ([]byte, []int) { + return file_aperture_policy_wrappers_v1_policy_proto_rawDescGZIP(), []int{0} +} + +func (x *PolicyWrapper) GetPolicy() *v1.Policy { + if x != nil { + return x.Policy + } + return nil +} + +func (x *PolicyWrapper) GetPolicyName() string { + if x != nil { + return x.PolicyName + } + return "" +} + +func (x *PolicyWrapper) GetPolicyHash() string { + if x != nil { + return x.PolicyHash + } + return "" +} + +type FluxMeterWrapper struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Flux Meter + FluxMeter *v1.FluxMeter `protobuf:"bytes,1,opt,name=flux_meter,json=fluxMeter,proto3" json:"flux_meter,omitempty"` + // Name of fluxmeter metric. + FluxmeterName string `protobuf:"bytes,4,opt,name=fluxmeter_name,json=fluxmeterName,proto3" json:"fluxmeter_name,omitempty"` +} + +func (x *FluxMeterWrapper) Reset() { + *x = FluxMeterWrapper{} + if protoimpl.UnsafeEnabled { + mi := &file_aperture_policy_wrappers_v1_policy_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *FluxMeterWrapper) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*FluxMeterWrapper) ProtoMessage() {} + +func (x *FluxMeterWrapper) ProtoReflect() protoreflect.Message { + mi := &file_aperture_policy_wrappers_v1_policy_proto_msgTypes[1] + 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 FluxMeterWrapper.ProtoReflect.Descriptor instead. +func (*FluxMeterWrapper) Descriptor() ([]byte, []int) { + return file_aperture_policy_wrappers_v1_policy_proto_rawDescGZIP(), []int{1} +} + +func (x *FluxMeterWrapper) GetFluxMeter() *v1.FluxMeter { + if x != nil { + return x.FluxMeter + } + return nil +} + +func (x *FluxMeterWrapper) GetFluxmeterName() string { + if x != nil { + return x.FluxmeterName + } + return "" +} + +type ConcurrencyLimiterWrapper struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Concurrency Limiter + ConcurrencyLimiter *v1.ConcurrencyLimiter `protobuf:"bytes,1,opt,name=concurrency_limiter,json=concurrencyLimiter,proto3" json:"concurrency_limiter,omitempty"` + // The index of Component in the Circuit. + ComponentIndex int64 `protobuf:"varint,2,opt,name=component_index,json=componentIndex,proto3" json:"component_index,omitempty"` + // Name of the Policy. + PolicyName string `protobuf:"bytes,3,opt,name=policy_name,json=policyName,proto3" json:"policy_name,omitempty"` + // Hash of the entire Policy spec. + PolicyHash string `protobuf:"bytes,4,opt,name=policy_hash,json=policyHash,proto3" json:"policy_hash,omitempty"` +} + +func (x *ConcurrencyLimiterWrapper) Reset() { + *x = ConcurrencyLimiterWrapper{} + if protoimpl.UnsafeEnabled { + mi := &file_aperture_policy_wrappers_v1_policy_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ConcurrencyLimiterWrapper) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ConcurrencyLimiterWrapper) ProtoMessage() {} + +func (x *ConcurrencyLimiterWrapper) ProtoReflect() protoreflect.Message { + mi := &file_aperture_policy_wrappers_v1_policy_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 ConcurrencyLimiterWrapper.ProtoReflect.Descriptor instead. +func (*ConcurrencyLimiterWrapper) Descriptor() ([]byte, []int) { + return file_aperture_policy_wrappers_v1_policy_proto_rawDescGZIP(), []int{2} +} + +func (x *ConcurrencyLimiterWrapper) GetConcurrencyLimiter() *v1.ConcurrencyLimiter { + if x != nil { + return x.ConcurrencyLimiter + } + return nil +} + +func (x *ConcurrencyLimiterWrapper) GetComponentIndex() int64 { + if x != nil { + return x.ComponentIndex + } + return 0 +} + +func (x *ConcurrencyLimiterWrapper) GetPolicyName() string { + if x != nil { + return x.PolicyName + } + return "" +} + +func (x *ConcurrencyLimiterWrapper) GetPolicyHash() string { + if x != nil { + return x.PolicyHash + } + return "" +} + +type RateLimiterWrapper struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Rate Limiter + RateLimiter *v1.RateLimiter `protobuf:"bytes,1,opt,name=rate_limiter,json=rateLimiter,proto3" json:"rate_limiter,omitempty"` + // The index of Component in the Circuit. + ComponentIndex int64 `protobuf:"varint,2,opt,name=component_index,json=componentIndex,proto3" json:"component_index,omitempty"` + // Name of the Policy. + PolicyName string `protobuf:"bytes,3,opt,name=policy_name,json=policyName,proto3" json:"policy_name,omitempty"` + // Hash of the entire Policy spec. + PolicyHash string `protobuf:"bytes,4,opt,name=policy_hash,json=policyHash,proto3" json:"policy_hash,omitempty"` +} + +func (x *RateLimiterWrapper) Reset() { + *x = RateLimiterWrapper{} + if protoimpl.UnsafeEnabled { + mi := &file_aperture_policy_wrappers_v1_policy_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RateLimiterWrapper) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RateLimiterWrapper) ProtoMessage() {} + +func (x *RateLimiterWrapper) ProtoReflect() protoreflect.Message { + mi := &file_aperture_policy_wrappers_v1_policy_proto_msgTypes[3] + 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 RateLimiterWrapper.ProtoReflect.Descriptor instead. +func (*RateLimiterWrapper) Descriptor() ([]byte, []int) { + return file_aperture_policy_wrappers_v1_policy_proto_rawDescGZIP(), []int{3} +} + +func (x *RateLimiterWrapper) GetRateLimiter() *v1.RateLimiter { + if x != nil { + return x.RateLimiter + } + return nil +} + +func (x *RateLimiterWrapper) GetComponentIndex() int64 { + if x != nil { + return x.ComponentIndex + } + return 0 +} + +func (x *RateLimiterWrapper) GetPolicyName() string { + if x != nil { + return x.PolicyName + } + return "" +} + +func (x *RateLimiterWrapper) GetPolicyHash() string { + if x != nil { + return x.PolicyHash + } + return "" +} + +var File_aperture_policy_wrappers_v1_policy_proto protoreflect.FileDescriptor + +var file_aperture_policy_wrappers_v1_policy_proto_rawDesc = []byte{ + 0x0a, 0x28, 0x61, 0x70, 0x65, 0x72, 0x74, 0x75, 0x72, 0x65, 0x2f, 0x70, 0x6f, 0x6c, 0x69, 0x63, + 0x79, 0x2f, 0x77, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x73, 0x2f, 0x76, 0x31, 0x2f, 0x70, 0x6f, + 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x1b, 0x61, 0x70, 0x65, 0x72, + 0x74, 0x75, 0x72, 0x65, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x77, 0x72, 0x61, 0x70, + 0x70, 0x65, 0x72, 0x73, 0x2e, 0x76, 0x31, 0x1a, 0x2b, 0x61, 0x70, 0x65, 0x72, 0x74, 0x75, 0x72, + 0x65, 0x2f, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2f, 0x6c, 0x61, 0x6e, 0x67, 0x75, 0x61, 0x67, + 0x65, 0x2f, 0x76, 0x31, 0x2f, 0x66, 0x6c, 0x75, 0x78, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x28, 0x61, 0x70, 0x65, 0x72, 0x74, 0x75, 0x72, 0x65, 0x2f, 0x70, + 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2f, 0x6c, 0x61, 0x6e, 0x67, 0x75, 0x61, 0x67, 0x65, 0x2f, 0x76, + 0x31, 0x2f, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x8e, + 0x01, 0x0a, 0x0d, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x57, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, + 0x12, 0x3b, 0x0a, 0x06, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x23, 0x2e, 0x61, 0x70, 0x65, 0x72, 0x74, 0x75, 0x72, 0x65, 0x2e, 0x70, 0x6f, 0x6c, 0x69, + 0x63, 0x79, 0x2e, 0x6c, 0x61, 0x6e, 0x67, 0x75, 0x61, 0x67, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x50, + 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x52, 0x06, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x12, 0x1f, 0x0a, + 0x0b, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x0a, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1f, + 0x0a, 0x0b, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x0a, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x48, 0x61, 0x73, 0x68, 0x22, + 0x80, 0x01, 0x0a, 0x10, 0x46, 0x6c, 0x75, 0x78, 0x4d, 0x65, 0x74, 0x65, 0x72, 0x57, 0x72, 0x61, + 0x70, 0x70, 0x65, 0x72, 0x12, 0x45, 0x0a, 0x0a, 0x66, 0x6c, 0x75, 0x78, 0x5f, 0x6d, 0x65, 0x74, + 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x61, 0x70, 0x65, 0x72, 0x74, + 0x75, 0x72, 0x65, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6c, 0x61, 0x6e, 0x67, 0x75, + 0x61, 0x67, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x46, 0x6c, 0x75, 0x78, 0x4d, 0x65, 0x74, 0x65, 0x72, + 0x52, 0x09, 0x66, 0x6c, 0x75, 0x78, 0x4d, 0x65, 0x74, 0x65, 0x72, 0x12, 0x25, 0x0a, 0x0e, 0x66, + 0x6c, 0x75, 0x78, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x0d, 0x66, 0x6c, 0x75, 0x78, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x4e, 0x61, + 0x6d, 0x65, 0x22, 0xe8, 0x01, 0x0a, 0x19, 0x43, 0x6f, 0x6e, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, + 0x63, 0x79, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x65, 0x72, 0x57, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, + 0x12, 0x60, 0x0a, 0x13, 0x63, 0x6f, 0x6e, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x63, 0x79, 0x5f, + 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2f, 0x2e, + 0x61, 0x70, 0x65, 0x72, 0x74, 0x75, 0x72, 0x65, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, + 0x6c, 0x61, 0x6e, 0x67, 0x75, 0x61, 0x67, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x6f, 0x6e, 0x63, + 0x75, 0x72, 0x72, 0x65, 0x6e, 0x63, 0x79, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x65, 0x72, 0x52, 0x12, + 0x63, 0x6f, 0x6e, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x63, 0x79, 0x4c, 0x69, 0x6d, 0x69, 0x74, + 0x65, 0x72, 0x12, 0x27, 0x0a, 0x0f, 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x5f, + 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0e, 0x63, 0x6f, 0x6d, + 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x12, 0x1f, 0x0a, 0x0b, 0x70, + 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x0a, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1f, 0x0a, 0x0b, + 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x18, 0x04, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x0a, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x48, 0x61, 0x73, 0x68, 0x22, 0xcc, 0x01, + 0x0a, 0x12, 0x52, 0x61, 0x74, 0x65, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x65, 0x72, 0x57, 0x72, 0x61, + 0x70, 0x70, 0x65, 0x72, 0x12, 0x4b, 0x0a, 0x0c, 0x72, 0x61, 0x74, 0x65, 0x5f, 0x6c, 0x69, 0x6d, + 0x69, 0x74, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x28, 0x2e, 0x61, 0x70, 0x65, + 0x72, 0x74, 0x75, 0x72, 0x65, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x6c, 0x61, 0x6e, + 0x67, 0x75, 0x61, 0x67, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x52, 0x61, 0x74, 0x65, 0x4c, 0x69, 0x6d, + 0x69, 0x74, 0x65, 0x72, 0x52, 0x0b, 0x72, 0x61, 0x74, 0x65, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x65, + 0x72, 0x12, 0x27, 0x0a, 0x0f, 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x5f, 0x69, + 0x6e, 0x64, 0x65, 0x78, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0e, 0x63, 0x6f, 0x6d, 0x70, + 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x12, 0x1f, 0x0a, 0x0b, 0x70, 0x6f, + 0x6c, 0x69, 0x63, 0x79, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x0a, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x70, + 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x0a, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x48, 0x61, 0x73, 0x68, 0x42, 0x94, 0x02, 0x0a, + 0x1f, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x70, 0x65, 0x72, 0x74, 0x75, 0x72, 0x65, 0x2e, 0x70, 0x6f, + 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x77, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x73, 0x2e, 0x76, 0x31, + 0x42, 0x0b, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, + 0x55, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x66, 0x6c, 0x75, 0x78, + 0x6e, 0x69, 0x6e, 0x6a, 0x61, 0x2f, 0x61, 0x70, 0x65, 0x72, 0x74, 0x75, 0x72, 0x65, 0x2f, 0x61, + 0x70, 0x69, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x2f, + 0x61, 0x70, 0x65, 0x72, 0x74, 0x75, 0x72, 0x65, 0x2f, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2f, + 0x77, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x73, 0x2f, 0x76, 0x31, 0x3b, 0x77, 0x72, 0x61, 0x70, + 0x70, 0x65, 0x72, 0x73, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x41, 0x50, 0x57, 0xaa, 0x02, 0x1b, 0x41, + 0x70, 0x65, 0x72, 0x74, 0x75, 0x72, 0x65, 0x2e, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x57, + 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x73, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x1b, 0x41, 0x70, 0x65, + 0x72, 0x74, 0x75, 0x72, 0x65, 0x5c, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x5c, 0x57, 0x72, 0x61, + 0x70, 0x70, 0x65, 0x72, 0x73, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x27, 0x41, 0x70, 0x65, 0x72, 0x74, + 0x75, 0x72, 0x65, 0x5c, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x5c, 0x57, 0x72, 0x61, 0x70, 0x70, + 0x65, 0x72, 0x73, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, + 0x74, 0x61, 0xea, 0x02, 0x1e, 0x41, 0x70, 0x65, 0x72, 0x74, 0x75, 0x72, 0x65, 0x3a, 0x3a, 0x50, + 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x3a, 0x3a, 0x57, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x73, 0x3a, + 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_aperture_policy_wrappers_v1_policy_proto_rawDescOnce sync.Once + file_aperture_policy_wrappers_v1_policy_proto_rawDescData = file_aperture_policy_wrappers_v1_policy_proto_rawDesc +) + +func file_aperture_policy_wrappers_v1_policy_proto_rawDescGZIP() []byte { + file_aperture_policy_wrappers_v1_policy_proto_rawDescOnce.Do(func() { + file_aperture_policy_wrappers_v1_policy_proto_rawDescData = protoimpl.X.CompressGZIP(file_aperture_policy_wrappers_v1_policy_proto_rawDescData) + }) + return file_aperture_policy_wrappers_v1_policy_proto_rawDescData +} + +var file_aperture_policy_wrappers_v1_policy_proto_msgTypes = make([]protoimpl.MessageInfo, 4) +var file_aperture_policy_wrappers_v1_policy_proto_goTypes = []interface{}{ + (*PolicyWrapper)(nil), // 0: aperture.policy.wrappers.v1.PolicyWrapper + (*FluxMeterWrapper)(nil), // 1: aperture.policy.wrappers.v1.FluxMeterWrapper + (*ConcurrencyLimiterWrapper)(nil), // 2: aperture.policy.wrappers.v1.ConcurrencyLimiterWrapper + (*RateLimiterWrapper)(nil), // 3: aperture.policy.wrappers.v1.RateLimiterWrapper + (*v1.Policy)(nil), // 4: aperture.policy.language.v1.Policy + (*v1.FluxMeter)(nil), // 5: aperture.policy.language.v1.FluxMeter + (*v1.ConcurrencyLimiter)(nil), // 6: aperture.policy.language.v1.ConcurrencyLimiter + (*v1.RateLimiter)(nil), // 7: aperture.policy.language.v1.RateLimiter +} +var file_aperture_policy_wrappers_v1_policy_proto_depIdxs = []int32{ + 4, // 0: aperture.policy.wrappers.v1.PolicyWrapper.policy:type_name -> aperture.policy.language.v1.Policy + 5, // 1: aperture.policy.wrappers.v1.FluxMeterWrapper.flux_meter:type_name -> aperture.policy.language.v1.FluxMeter + 6, // 2: aperture.policy.wrappers.v1.ConcurrencyLimiterWrapper.concurrency_limiter:type_name -> aperture.policy.language.v1.ConcurrencyLimiter + 7, // 3: aperture.policy.wrappers.v1.RateLimiterWrapper.rate_limiter:type_name -> aperture.policy.language.v1.RateLimiter + 4, // [4:4] is the sub-list for method output_type + 4, // [4:4] is the sub-list for method input_type + 4, // [4:4] is the sub-list for extension type_name + 4, // [4:4] is the sub-list for extension extendee + 0, // [0:4] is the sub-list for field type_name +} + +func init() { file_aperture_policy_wrappers_v1_policy_proto_init() } +func file_aperture_policy_wrappers_v1_policy_proto_init() { + if File_aperture_policy_wrappers_v1_policy_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_aperture_policy_wrappers_v1_policy_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PolicyWrapper); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_aperture_policy_wrappers_v1_policy_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*FluxMeterWrapper); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_aperture_policy_wrappers_v1_policy_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ConcurrencyLimiterWrapper); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_aperture_policy_wrappers_v1_policy_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RateLimiterWrapper); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_aperture_policy_wrappers_v1_policy_proto_rawDesc, + NumEnums: 0, + NumMessages: 4, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_aperture_policy_wrappers_v1_policy_proto_goTypes, + DependencyIndexes: file_aperture_policy_wrappers_v1_policy_proto_depIdxs, + MessageInfos: file_aperture_policy_wrappers_v1_policy_proto_msgTypes, + }.Build() + File_aperture_policy_wrappers_v1_policy_proto = out.File + file_aperture_policy_wrappers_v1_policy_proto_rawDesc = nil + file_aperture_policy_wrappers_v1_policy_proto_goTypes = nil + file_aperture_policy_wrappers_v1_policy_proto_depIdxs = nil +} diff --git a/api/gen/proto/go/aperture/common/config/v1/config_properties_wrapper.pb.json.go b/api/gen/proto/go/aperture/policy/wrappers/v1/policy.pb.json.go similarity index 56% rename from api/gen/proto/go/aperture/common/config/v1/config_properties_wrapper.pb.json.go rename to api/gen/proto/go/aperture/policy/wrappers/v1/policy.pb.json.go index 2fa5afa5f7..b99a464825 100644 --- a/api/gen/proto/go/aperture/common/config/v1/config_properties_wrapper.pb.json.go +++ b/api/gen/proto/go/aperture/policy/wrappers/v1/policy.pb.json.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go-json. DO NOT EDIT. -// source: aperture/common/config/v1/config_properties_wrapper.proto +// source: aperture/policy/wrappers/v1/policy.proto -package configv1 +package wrappersv1 import ( "google.golang.org/protobuf/encoding/protojson" @@ -70,51 +70,3 @@ func (msg *RateLimiterWrapper) UnmarshalJSON(b []byte) error { DiscardUnknown: false, }.Unmarshal(b, msg) } - -// MarshalJSON implements json.Marshaler -func (msg *LoadShedDecsisionWrapper) MarshalJSON() ([]byte, error) { - return protojson.MarshalOptions{ - UseEnumNumbers: false, - EmitUnpopulated: true, - UseProtoNames: true, - }.Marshal(msg) -} - -// UnmarshalJSON implements json.Unmarshaler -func (msg *LoadShedDecsisionWrapper) UnmarshalJSON(b []byte) error { - return protojson.UnmarshalOptions{ - DiscardUnknown: false, - }.Unmarshal(b, msg) -} - -// MarshalJSON implements json.Marshaler -func (msg *TokensDecisionWrapper) MarshalJSON() ([]byte, error) { - return protojson.MarshalOptions{ - UseEnumNumbers: false, - EmitUnpopulated: true, - UseProtoNames: true, - }.Marshal(msg) -} - -// UnmarshalJSON implements json.Unmarshaler -func (msg *TokensDecisionWrapper) UnmarshalJSON(b []byte) error { - return protojson.UnmarshalOptions{ - DiscardUnknown: false, - }.Unmarshal(b, msg) -} - -// MarshalJSON implements json.Marshaler -func (msg *RateLimiterDecisionWrapper) MarshalJSON() ([]byte, error) { - return protojson.MarshalOptions{ - UseEnumNumbers: false, - EmitUnpopulated: true, - UseProtoNames: true, - }.Marshal(msg) -} - -// UnmarshalJSON implements json.Unmarshaler -func (msg *RateLimiterDecisionWrapper) UnmarshalJSON(b []byte) error { - return protojson.UnmarshalOptions{ - DiscardUnknown: false, - }.Unmarshal(b, msg) -} diff --git a/api/gen/proto/go/aperture/common/config/v1/config_properties_wrapper_deepcopy.gen.go b/api/gen/proto/go/aperture/policy/wrappers/v1/policy_deepcopy.gen.go similarity index 56% rename from api/gen/proto/go/aperture/common/config/v1/config_properties_wrapper_deepcopy.gen.go rename to api/gen/proto/go/aperture/policy/wrappers/v1/policy_deepcopy.gen.go index 63d041793c..4f765c9268 100644 --- a/api/gen/proto/go/aperture/common/config/v1/config_properties_wrapper_deepcopy.gen.go +++ b/api/gen/proto/go/aperture/policy/wrappers/v1/policy_deepcopy.gen.go @@ -1,5 +1,5 @@ // Code generated by protoc-gen-deepcopy. DO NOT EDIT. -package configv1 +package wrappersv1 import ( proto "github.com/golang/protobuf/proto" @@ -88,66 +88,3 @@ func (in *RateLimiterWrapper) DeepCopy() *RateLimiterWrapper { func (in *RateLimiterWrapper) DeepCopyInterface() interface{} { return in.DeepCopy() } - -// DeepCopyInto supports using LoadShedDecsisionWrapper within kubernetes types, where deepcopy-gen is used. -func (in *LoadShedDecsisionWrapper) DeepCopyInto(out *LoadShedDecsisionWrapper) { - p := proto.Clone(in).(*LoadShedDecsisionWrapper) - *out = *p -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LoadShedDecsisionWrapper. Required by controller-gen. -func (in *LoadShedDecsisionWrapper) DeepCopy() *LoadShedDecsisionWrapper { - if in == nil { - return nil - } - out := new(LoadShedDecsisionWrapper) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInterface is an autogenerated deepcopy function, copying the receiver, creating a new LoadShedDecsisionWrapper. Required by controller-gen. -func (in *LoadShedDecsisionWrapper) DeepCopyInterface() interface{} { - return in.DeepCopy() -} - -// DeepCopyInto supports using TokensDecisionWrapper within kubernetes types, where deepcopy-gen is used. -func (in *TokensDecisionWrapper) DeepCopyInto(out *TokensDecisionWrapper) { - p := proto.Clone(in).(*TokensDecisionWrapper) - *out = *p -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TokensDecisionWrapper. Required by controller-gen. -func (in *TokensDecisionWrapper) DeepCopy() *TokensDecisionWrapper { - if in == nil { - return nil - } - out := new(TokensDecisionWrapper) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInterface is an autogenerated deepcopy function, copying the receiver, creating a new TokensDecisionWrapper. Required by controller-gen. -func (in *TokensDecisionWrapper) DeepCopyInterface() interface{} { - return in.DeepCopy() -} - -// DeepCopyInto supports using RateLimiterDecisionWrapper within kubernetes types, where deepcopy-gen is used. -func (in *RateLimiterDecisionWrapper) DeepCopyInto(out *RateLimiterDecisionWrapper) { - p := proto.Clone(in).(*RateLimiterDecisionWrapper) - *out = *p -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RateLimiterDecisionWrapper. Required by controller-gen. -func (in *RateLimiterDecisionWrapper) DeepCopy() *RateLimiterDecisionWrapper { - if in == nil { - return nil - } - out := new(RateLimiterDecisionWrapper) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInterface is an autogenerated deepcopy function, copying the receiver, creating a new RateLimiterDecisionWrapper. Required by controller-gen. -func (in *RateLimiterDecisionWrapper) DeepCopyInterface() interface{} { - return in.DeepCopy() -} diff --git a/cmd/aperture-agent/agent.go b/cmd/aperture-agent/agent.go index 791fba2698..6d3fbabb3d 100644 --- a/cmd/aperture-agent/agent.go +++ b/cmd/aperture-agent/agent.go @@ -49,7 +49,7 @@ func main() { distcache.Module(), dataplane.PolicyModule(), discovery.Module(), - grpc.ClientConstructor{Name: "flowcontrol-grpc-client", Key: "flowcontrol.client.grpc"}.Annotate(), + grpc.ClientConstructor{Name: "flowcontrol-grpc-client", ConfigKey: "flowcontrol.client.grpc"}.Annotate(), ) if err := app.Err(); err != nil { diff --git a/docs/gen/config/aperture-agent/config-swagger.yaml b/docs/gen/config/aperture-agent/config-swagger.yaml index 6febd8000f..b121c6fa60 100644 --- a/docs/gen/config/aperture-agent/config-swagger.yaml +++ b/docs/gen/config/aperture-agent/config-swagger.yaml @@ -779,9 +779,9 @@ definitions: type: array x-go-name: DisabledSymbols plugins_path: - description: Path to plugins directory. This can be set via command line arguments - as well. + description: Path to plugins directory. "default" points to `/var/lib/aperture//plugins`. type: string + x-go-default: default x-go-name: PluginsPath title: PluginsConfig holds configuration for plugins. type: object @@ -806,9 +806,9 @@ definitions: x-go-default: "false" x-go-name: CPUProfile profiles_path: - description: Path to save performance profiles. This can be set via command - line arguments as well. E.g. default path for aperture-agent is /var/log/aperture/aperture-agent/profiles. + description: Path to save performance profiles. "default" path is `/var/log/aperture//profiles`. type: string + x-go-default: default x-go-name: ProfilesPath register_http_routes: description: Register routes. Profile types profile, symbol and cmdline will diff --git a/docs/gen/config/aperture-agent/swagger.md b/docs/gen/config/aperture-agent/swagger.md index 528593a277..cb926eb101 100644 --- a/docs/gen/config/aperture-agent/swagger.md +++ b/docs/gen/config/aperture-agent/swagger.md @@ -1387,7 +1387,7 @@ PluginsConfig holds configuration for plugins.
plugins_path
-(string) Path to plugins directory. This can be set via command line arguments as well. +(string, default: `default`) Path to plugins directory. "default" points to `/var/lib/aperture//plugins`.
@@ -1408,7 +1408,7 @@ ProfilersConfig holds configuration for profilers.
profiles_path
-(string) Path to save performance profiles. This can be set via command line arguments as well. E.g. default path for aperture-agent is /var/log/aperture/aperture-agent/profiles. +(string, default: `default`) Path to save performance profiles. "default" path is `/var/log/aperture//profiles`.
register_http_routes
diff --git a/docs/gen/config/aperture-controller/config-swagger.yaml b/docs/gen/config/aperture-controller/config-swagger.yaml index 5f621a1067..3d860912c2 100644 --- a/docs/gen/config/aperture-controller/config-swagger.yaml +++ b/docs/gen/config/aperture-controller/config-swagger.yaml @@ -702,9 +702,9 @@ definitions: type: array x-go-name: DisabledSymbols plugins_path: - description: Path to plugins directory. This can be set via command line arguments - as well. + description: Path to plugins directory. "default" points to `/var/lib/aperture//plugins`. type: string + x-go-default: default x-go-name: PluginsPath title: PluginsConfig holds configuration for plugins. type: object @@ -729,9 +729,9 @@ definitions: x-go-default: "false" x-go-name: CPUProfile profiles_path: - description: Path to save performance profiles. This can be set via command - line arguments as well. E.g. default path for aperture-agent is /var/log/aperture/aperture-agent/profiles. + description: Path to save performance profiles. "default" path is `/var/log/aperture//profiles`. type: string + x-go-default: default x-go-name: ProfilesPath register_http_routes: description: Register routes. Profile types profile, symbol and cmdline will diff --git a/docs/gen/config/aperture-controller/swagger.md b/docs/gen/config/aperture-controller/swagger.md index 040bb942a1..863142ea00 100644 --- a/docs/gen/config/aperture-controller/swagger.md +++ b/docs/gen/config/aperture-controller/swagger.md @@ -1217,7 +1217,7 @@ PluginsConfig holds configuration for plugins.
plugins_path
-(string) Path to plugins directory. This can be set via command line arguments as well. +(string, default: `default`) Path to plugins directory. "default" points to `/var/lib/aperture//plugins`.
@@ -1238,7 +1238,7 @@ ProfilersConfig holds configuration for profilers.
profiles_path
-(string) Path to save performance profiles. This can be set via command line arguments as well. E.g. default path for aperture-agent is /var/log/aperture/aperture-agent/profiles. +(string, default: `default`) Path to save performance profiles. "default" path is `/var/log/aperture//profiles`.
register_http_routes
diff --git a/docs/gen/policies/gen.yaml b/docs/gen/policies/gen.yaml index 540e4a9fcd..af823af6e2 100644 --- a/docs/gen/policies/gen.yaml +++ b/docs/gen/policies/gen.yaml @@ -1589,9 +1589,9 @@ definitions: x-order: 0 $ref: '#/definitions/v1Port' tags: -- name: PolicyService - name: EntityCacheService - name: InfoService - name: StatusService - name: FlowControlService - name: FluxNinjaService +- name: PolicyService diff --git a/pkg/config/log.go b/pkg/config/log.go index a6f82e5f6e..aa15518668 100644 --- a/pkg/config/log.go +++ b/pkg/config/log.go @@ -18,20 +18,20 @@ import ( "github.com/fluxninja/aperture/pkg/panichandler" ) -// DefaultLogFilePath is the default path for the log files to be stored. -var DefaultLogFilePath = path.Join(DefaultLogDirectory, info.Service+".log") +// defaultLogFilePath is the default path for the log files to be stored. +var defaultLogFilePath = path.Join(DefaultLogDirectory, info.Service+".log") const ( - configKey = "log" - stdOutFile = "stdout" - stdErrFile = "stderr" - emptyFile = "" + configKey = "log" + stdOutFile = "stdout" + stdErrFile = "stderr" + defaultFile = "default" ) // LogModule is a fx module that provides a logger and invokes setting global and standard loggers. func LogModule() fx.Option { return fx.Options( - LoggerConstructor{Key: configKey}.Annotate(), + LoggerConstructor{ConfigKey: configKey}.Annotate(), fx.Invoke(log.SetGlobalLogger), fx.Invoke(log.SetStdLogger), fx.WithLogger(WithApertureLogger()), @@ -86,8 +86,8 @@ type LogWriterConfig struct { type LoggerConstructor struct { // Name of logger instance Name string - // Viper config key - Key string + // Config key + ConfigKey string // Default Config DefaultConfig LogConfig } @@ -118,7 +118,7 @@ func (constructor LoggerConstructor) provideLogger(w []io.Writer, ) (log.Logger, error) { config := constructor.DefaultConfig - if err := unmarshaller.UnmarshalKey(constructor.Key, &config); err != nil { + if err := unmarshaller.UnmarshalKey(constructor.ConfigKey, &config); err != nil { log.Panic().Err(err).Msg("Unable to deserialize log configuration!") } logger, writers := NewLogger(config) @@ -149,32 +149,35 @@ func (constructor LoggerConstructor) provideLogger(w []io.Writer, // NewLogger creates a new instance of logger and writers with the given configuration. func NewLogger(config LogConfig) (log.Logger, []io.Writer) { var writers []io.Writer - - if !config.PrettyConsole { - if config.File == stdErrFile { - writers = append(writers, os.Stderr) - } else if config.File == stdOutFile { - writers = append(writers, os.Stdout) - } - } - if config.File == "default" { - config.Writers = append(config.Writers, config.LogWriterConfig) - } // append file writers for _, writerConfig := range config.Writers { - lj := &lumberjack.Logger{ - Filename: writerConfig.File, - MaxSize: writerConfig.MaxSize, - MaxBackups: writerConfig.MaxBackups, - MaxAge: writerConfig.MaxAge, - Compress: writerConfig.Compress, + var writer io.Writer + if config.File != "" { + switch writerConfig.File { + case stdErrFile: + writer = os.Stderr + case stdOutFile: + writer = os.Stdout + default: + if writerConfig.File == defaultFile { + writerConfig.File = defaultLogFilePath + } + lj := &lumberjack.Logger{ + Filename: writerConfig.File, + MaxSize: writerConfig.MaxSize, + MaxBackups: writerConfig.MaxBackups, + MaxAge: writerConfig.MaxAge, + Compress: writerConfig.Compress, + } + // Set finalizer to automatically close file writers + runtime.SetFinalizer(lj, func(lj *lumberjack.Logger) { + log.Debug().Msg("Closing lumberjack file writer") + _ = lj.Close() + }) + writer = lj + } + writers = append(writers, writer) } - writers = append(writers, lj) - // Set finalizer to automatically close file writers - runtime.SetFinalizer(lj, func(lj *lumberjack.Logger) { - log.Debug().Msg("Closing lumberjack file writer") - _ = lj.Close() - }) } if config.PrettyConsole { diff --git a/pkg/distcache/provider.go b/pkg/distcache/provider.go index 65e4275dc1..a64fbb66ef 100644 --- a/pkg/distcache/provider.go +++ b/pkg/distcache/provider.go @@ -28,7 +28,7 @@ const ( // Module provides a new DistCache FX module. func Module() fx.Option { return fx.Options( - fx.Provide(DistCacheConstructor{Key: defaultKey}.ProvideDistCache), + fx.Provide(DistCacheConstructor{ConfigKey: defaultKey}.ProvideDistCache), ) } @@ -83,7 +83,7 @@ type DistCacheConstructorIn struct { // DistCacheConstructor holds fields to create an instance of *DistCache. type DistCacheConstructor struct { - Key string + ConfigKey string DefaultConfig DistCacheConfig } @@ -91,7 +91,7 @@ type DistCacheConstructor struct { // It also hooks in the service discovery plugin. func (constructor DistCacheConstructor) ProvideDistCache(in DistCacheConstructorIn) (*DistCache, error) { config := constructor.DefaultConfig - if err := in.Unmarshaller.UnmarshalKey(constructor.Key, &config); err != nil { + if err := in.Unmarshaller.UnmarshalKey(constructor.ConfigKey, &config); err != nil { log.Error().Err(err).Msg("Unable to deserialize configuration of DistCache") return nil, err } diff --git a/pkg/filesystem/watcher/provider.go b/pkg/filesystem/watcher/provider.go index d4695f59fe..f480d8c3d3 100644 --- a/pkg/filesystem/watcher/provider.go +++ b/pkg/filesystem/watcher/provider.go @@ -15,7 +15,7 @@ import ( // Module is a fx module that provides filesystem watcher. func Module() fx.Option { return fx.Options( - Constructor{PathKey: config.ConfigPathFlag, Path: config.DefaultConfigDirectory}.Annotate(), + Constructor{ConfigKey: config.ConfigPathFlag, Path: config.DefaultConfigDirectory}.Annotate(), ) } @@ -25,7 +25,7 @@ type Constructor struct { Name string // Config key from which to read directory path from. // If the pathkey is empty or is not set then fallback to Path. - PathKey string + ConfigKey string // Directory path to fall back to. Path string // File types to watch. The extension needs to include leading dot. @@ -52,9 +52,9 @@ func (constructor Constructor) Annotate() fx.Option { func (constructor Constructor) provideWatcher(unmarshaller config.Unmarshaller, lifecycle fx.Lifecycle) (notifiers.Watcher, error) { var directory string - if constructor.PathKey != "" { + if constructor.ConfigKey != "" { // Get directory from config - directory = cast.ToString(unmarshaller.Get(constructor.PathKey)) + directory = cast.ToString(unmarshaller.Get(constructor.ConfigKey)) } if directory == "" { diff --git a/pkg/flowcontrol/common/flowcontrol_test.go b/pkg/flowcontrol/common/flowcontrol_test.go index 0d7f955f78..414c3f44f6 100644 --- a/pkg/flowcontrol/common/flowcontrol_test.go +++ b/pkg/flowcontrol/common/flowcontrol_test.go @@ -48,7 +48,7 @@ var _ = BeforeEach(func() { fx.Provide(common.ProvideNopMetrics), fx.Provide(common.ProvideHandler), fx.Provide(dataplane.ProvideEngineAPI), - grpcclient.ClientConstructor{Name: "flowcontrol-grpc-client", Key: "flowcontrol.client.grpc"}.Annotate(), + grpcclient.ClientConstructor{Name: "flowcontrol-grpc-client", ConfigKey: "flowcontrol.client.grpc"}.Annotate(), fx.Populate(&svc), ) ctx, cancel := context.WithTimeout(context.Background(), time.Second) diff --git a/pkg/k8s/provide.go b/pkg/k8s/provide.go index 3a91e08dfd..a4c0ae9070 100644 --- a/pkg/k8s/provide.go +++ b/pkg/k8s/provide.go @@ -43,7 +43,7 @@ type K8sClientConstructorIn struct { // Module provides a K8sClient. func Module() fx.Option { return fx.Options( - commonhttp.ClientConstructor{Name: "k8s-http-client", Key: httpConfigKey}.Annotate(), + commonhttp.ClientConstructor{Name: "k8s-http-client", ConfigKey: httpConfigKey}.Annotate(), fx.Provide(Providek8sClient), ) } diff --git a/pkg/net/grpc/client.go b/pkg/net/grpc/client.go index 196db4d985..efa517c033 100644 --- a/pkg/net/grpc/client.go +++ b/pkg/net/grpc/client.go @@ -23,7 +23,7 @@ func ClientModule() fx.Option { // ClientConstructor holds fields to create an annotated instance of ClientConnectionBuilder. type ClientConstructor struct { Name string - Key string + ConfigKey string DefaultConfig GRPCClientConfig } @@ -59,7 +59,7 @@ type BackoffConfig struct { // Annotate creates an annotated instance of GRPC ClientConnectionBuilder. func (c ClientConstructor) Annotate() fx.Option { - if c.Key == "" { + if c.ConfigKey == "" { log.Panic().Msg("config key not provided") } @@ -75,7 +75,7 @@ func (c ClientConstructor) Annotate() fx.Option { func (c ClientConstructor) provideClientConnectionBuilder(unmarshaller config.Unmarshaller) (ClientConnectionBuilder, *GRPCClientConfig, error) { config := c.DefaultConfig - err := unmarshaller.UnmarshalKey(c.Key, &config) + err := unmarshaller.UnmarshalKey(c.ConfigKey, &config) if err != nil { return nil, nil, err } diff --git a/pkg/net/grpc/server.go b/pkg/net/grpc/server.go index 1a1ef57268..0b221e2a7c 100644 --- a/pkg/net/grpc/server.go +++ b/pkg/net/grpc/server.go @@ -18,7 +18,7 @@ import ( ) const ( - defaultServerKey = "server.grpc" + defaultServerConfigKey = "server.grpc" // Name of gmux based listener. defaultGMuxListener = "grpc-gmux-listener" ) @@ -57,7 +57,7 @@ type ServerConstructor struct { // Name of listener instance ListenerName string // Viper config key/server name - Key string + ConfigKey string // Default Server Config DefaultConfig GRPCServerConfig // Additional server Options @@ -66,8 +66,8 @@ type ServerConstructor struct { // Annotate creates an annotated instance of GRPC Server. func (constructor ServerConstructor) Annotate() fx.Option { - if constructor.Key == "" { - constructor.Key = defaultServerKey + if constructor.ConfigKey == "" { + constructor.ConfigKey = defaultServerConfigKey } return fx.Options( @@ -88,7 +88,7 @@ func (constructor ServerConstructor) provideServer( shutdowner fx.Shutdowner, ) (*grpc.Server, *grpc_prometheus.ServerMetrics, error) { config := constructor.DefaultConfig - if err := unmarshaller.UnmarshalKey(constructor.Key, &config); err != nil { + if err := unmarshaller.UnmarshalKey(constructor.ConfigKey, &config); err != nil { log.Error().Err(err).Msg("Unable to deserialize grpcserver configuration!") return nil, nil, err } @@ -118,7 +118,7 @@ func (constructor ServerConstructor) provideServer( // request shutdown if this server exits defer func() { _ = shutdowner.Shutdown() }() listener := listener.GetListener() - log.Info().Str("constructor", constructor.Key).Str("addr", listener.Addr().String()).Msg("Starting GRPC server") + log.Info().Str("constructor", constructor.ConfigKey).Str("addr", listener.Addr().String()).Msg("Starting GRPC server") grpcServerMetrics.InitializeMetrics(server) @@ -134,7 +134,7 @@ func (constructor ServerConstructor) provideServer( }, OnStop: func(context.Context) error { listener := listener.GetListener() - log.Info().Str("constructor", constructor.Key).Str("addr", listener.Addr().String()).Msg("Stopping GRPC server") + log.Info().Str("constructor", constructor.ConfigKey).Str("addr", listener.Addr().String()).Msg("Stopping GRPC server") server.GracefulStop() return nil }, diff --git a/pkg/net/grpcgateway/grpcgateway.go b/pkg/net/grpcgateway/grpcgateway.go index 08c49eff3d..ae8feaf366 100644 --- a/pkg/net/grpcgateway/grpcgateway.go +++ b/pkg/net/grpcgateway/grpcgateway.go @@ -39,7 +39,7 @@ type Constructor struct { // Name of http server instance -- empty for main server. Gateway name will be the same as HTTP server name Name string // Config key - Key string + ConfigKey string // Default gateway config DefaultConfig GRPCGatewayConfig } @@ -69,8 +69,8 @@ func (gw *GRPCGateway) registerGW(fn RegisterHandlerFunc) error { // Annotate returns fx options that set up grpc-http gateway. func (constructor Constructor) Annotate() fx.Option { - if constructor.Key == "" { - constructor.Key = defaultKey + if constructor.ConfigKey == "" { + constructor.ConfigKey = defaultKey } var group, name string @@ -129,7 +129,7 @@ func (constructor Constructor) setupGRPCGateway( ) error { config := constructor.DefaultConfig - if err := unmarshaller.UnmarshalKey(constructor.Key, &config); err != nil { + if err := unmarshaller.UnmarshalKey(constructor.ConfigKey, &config); err != nil { log.Error().Err(err).Msg("Unable to deserialize grpc gateway configuration!") return err } diff --git a/pkg/net/health/health.go b/pkg/net/health/health.go index 4573533561..4ea5b7d94a 100644 --- a/pkg/net/health/health.go +++ b/pkg/net/health/health.go @@ -16,7 +16,7 @@ import ( // HealthModule is a module that provides grpc health server for checking services status. func HealthModule() fx.Option { return fx.Options( - grpcclient.ClientConstructor{Name: "health-grpc-client", Key: "health.client.grpc"}.Annotate(), + grpcclient.ClientConstructor{Name: "health-grpc-client", ConfigKey: "health.client.grpc"}.Annotate(), fx.Provide(ProvideHealthServer), fx.Provide(fx.Annotate( ProvideHealthClient, diff --git a/pkg/net/http/client.go b/pkg/net/http/client.go index da16e3b4d8..8be445c9bf 100644 --- a/pkg/net/http/client.go +++ b/pkg/net/http/client.go @@ -22,7 +22,7 @@ func ClientModule() fx.Option { // ClientConstructor holds fields to create an annotated instance of HTTP client. type ClientConstructor struct { Name string - Key string + ConfigKey string DefaultConfig HTTPClientConfig } @@ -72,7 +72,7 @@ type HTTPClientConfig struct { // Annotate creates an annotated instance of HTTP Client. func (constructor ClientConstructor) Annotate() fx.Option { - if constructor.Key == "" { + if constructor.ConfigKey == "" { log.Panic().Msg("config key not provided") } @@ -91,7 +91,7 @@ func (constructor ClientConstructor) provideHTTPClient(unmarshaller config.Unmar var err error config := constructor.DefaultConfig - if err = unmarshaller.UnmarshalKey(constructor.Key, &config); err != nil { + if err = unmarshaller.UnmarshalKey(constructor.ConfigKey, &config); err != nil { log.Error().Err(err).Msg("Unable to deserialize httpclient configuration!") return nil, nil, nil, err } diff --git a/pkg/net/http/proxy.go b/pkg/net/http/proxy.go index 2cb0e1d9e3..432994237f 100644 --- a/pkg/net/http/proxy.go +++ b/pkg/net/http/proxy.go @@ -23,7 +23,7 @@ func ProxyModule() fx.Option { // ProxyConstructor holds fields used to configure Proxy. type ProxyConstructor struct { - Key string + ConfigKey string DefaultConfig ProxyConfig } @@ -40,14 +40,14 @@ type ProxyConfig struct { } func (constructor ProxyConstructor) applyProxyConfig(unmarshaller config.Unmarshaller) error { - if constructor.Key == "" { - constructor.Key = defaultProxyKey + if constructor.ConfigKey == "" { + constructor.ConfigKey = defaultProxyKey } var err error config := constructor.DefaultConfig - if err = unmarshaller.UnmarshalKey(constructor.Key, &config); err != nil { + if err = unmarshaller.UnmarshalKey(constructor.ConfigKey, &config); err != nil { log.Error().Err(err).Msg("Unable to deserialize client proxy configuration!") return err } diff --git a/pkg/net/http/server.go b/pkg/net/http/server.go index 889f51f94c..727f9a7068 100644 --- a/pkg/net/http/server.go +++ b/pkg/net/http/server.go @@ -63,15 +63,15 @@ type ServerConstructor struct { // Name of tls config instance TLSConfigName string // Viper config key/server name - Key string + ConfigKey string // Default Server Config DefaultConfig HTTPServerConfig } // Annotate creates an annotated instance of HTTP Server. func (constructor ServerConstructor) Annotate() fx.Option { - if constructor.Key == "" { - constructor.Key = defaultServerKey + if constructor.ConfigKey == "" { + constructor.ConfigKey = defaultServerKey } tlsName := config.NameTag(constructor.TLSConfigName) + ` optional:"true"` name := config.NameTag(constructor.Name) @@ -108,7 +108,7 @@ func (constructor ServerConstructor) provideServer( pr *prometheus.Registry, ) (*mux.Router, *http.Server, *Server, error) { config := constructor.DefaultConfig - if err := unmarshaller.UnmarshalKey(constructor.Key, &config); err != nil { + if err := unmarshaller.UnmarshalKey(constructor.ConfigKey, &config); err != nil { log.Error().Err(err).Msg("Unable to deserialize httpserver configuration!") return nil, nil, nil, err } @@ -175,7 +175,7 @@ func (constructor ServerConstructor) provideServer( listener = tls.NewListener(listener, tlsConfig) } - log.Info().Str("constructor", constructor.Key).Str("addr", listener.Addr().String()).Msg("Starting HTTP server") + log.Info().Str("constructor", constructor.ConfigKey).Str("addr", listener.Addr().String()).Msg("Starting HTTP server") // check if RootHandler is set if httpServer.RootHandler != nil { log.Info().Msg("Registering RootHandlerFunc!") @@ -189,7 +189,7 @@ func (constructor ServerConstructor) provideServer( }, OnStop: func(ctx context.Context) error { listener := listener.GetListener() - log.Info().Str("constructor", constructor.Key).Str("addr", listener.Addr().String()).Msg("Stopping HTTP server") + log.Info().Str("constructor", constructor.ConfigKey).Str("addr", listener.Addr().String()).Msg("Stopping HTTP server") return server.Shutdown(ctx) }, }) diff --git a/pkg/net/listener/provider.go b/pkg/net/listener/provider.go index 905774db96..d73130a934 100644 --- a/pkg/net/listener/provider.go +++ b/pkg/net/listener/provider.go @@ -45,15 +45,15 @@ func Module() fx.Option { // Constructor holds fields to create an annotated Listener. type Constructor struct { - Key string + ConfigKey string Name string DefaultConfig ListenerConfig } // ProvideAnnotated provides an annotated instance of Listener. func (constructor Constructor) ProvideAnnotated() fx.Annotated { - if constructor.Key == "" { - constructor.Key = defaultKey + if constructor.ConfigKey == "" { + constructor.ConfigKey = defaultKey } return fx.Annotated{ Name: constructor.Name, @@ -72,7 +72,7 @@ type ListenerIn struct { func (constructor Constructor) provideListener(in ListenerIn) (*Listener, error) { config := constructor.DefaultConfig - if err := in.Unmarshaller.UnmarshalKey(constructor.Key, &config); err != nil { + if err := in.Unmarshaller.UnmarshalKey(constructor.ConfigKey, &config); err != nil { log.Error().Err(err).Msg("Unable to deserialize listener configuration!") return nil, err } diff --git a/pkg/net/tlsconfig/server.go b/pkg/net/tlsconfig/server.go index 037947e3d2..c2bd84c070 100644 --- a/pkg/net/tlsconfig/server.go +++ b/pkg/net/tlsconfig/server.go @@ -20,7 +20,7 @@ const ( // Module is a fx module that constructs annotated instance of *tls.Config. func Module() fx.Option { - constructor := Constructor{Key: defaultKey} + constructor := Constructor{ConfigKey: defaultKey} return fx.Options( constructor.Annotate(), ) @@ -47,7 +47,7 @@ type ServerTLSConfig struct { // Constructor holds fields to create an annotated instance of *tls.Config. type Constructor struct { Name string - Key string + ConfigKey string DefaultConfig ServerTLSConfig } @@ -64,7 +64,7 @@ func (constructor Constructor) Annotate() fx.Option { func (constructor Constructor) provideTLSConfig(unmarshaller config.Unmarshaller) (*tls.Config, error) { config := constructor.DefaultConfig - if err := unmarshaller.UnmarshalKey(constructor.Key, &config); err != nil { + if err := unmarshaller.UnmarshalKey(constructor.ConfigKey, &config); err != nil { log.Error().Err(err).Msg("Unable to deserialize tls configuration!") return nil, err } diff --git a/pkg/peers/peers.go b/pkg/peers/peers.go index 533d0f9dbd..14cc534f6c 100644 --- a/pkg/peers/peers.go +++ b/pkg/peers/peers.go @@ -33,8 +33,8 @@ const ( // - in: body // schema: // "$ref": "#/definitions/PeerDiscoveryConfig" - defaultKey = "peer_discovery" - watcherFxTag = "peer-discovery-watcher" + defaultConfigKey = "peer_discovery" + watcherFxTag = "peer-discovery-watcher" ) var ( @@ -52,7 +52,7 @@ type PeerDiscoveryConfig struct { // Constructor holds fields to create and configure PeerDiscovery. type Constructor struct { - Key string + ConfigKey string DefaultConfig PeerDiscoveryConfig Service string } @@ -82,10 +82,10 @@ type PeerDiscoveryIn struct { func (constructor Constructor) providePeerDiscovery(in PeerDiscoveryIn) (*PeerDiscovery, error) { var configKey string - if constructor.Key == "" { - configKey = defaultKey + if constructor.ConfigKey == "" { + configKey = defaultConfigKey } else { - configKey = constructor.Key + configKey = constructor.ConfigKey } var cfg PeerDiscoveryConfig diff --git a/pkg/platform/platform.go b/pkg/platform/platform.go index 463e171bc0..0761d5a188 100644 --- a/pkg/platform/platform.go +++ b/pkg/platform/platform.go @@ -119,7 +119,6 @@ func (cfg Config) Module() fx.Option { status.Module(), fx.Populate(&platform.statusRegistry), platformStatusModule(), - plugins.ModuleConfig{OnlyCommandLineFlags: true}.Module(), fx.Supply(registry), fx.Populate(&platform.unmarshaller), fx.Populate(&platform.dotgraph), diff --git a/pkg/plugins/plugin-registry.go b/pkg/plugins/plugin-registry.go index c69c04928c..e5b428b6c0 100644 --- a/pkg/plugins/plugin-registry.go +++ b/pkg/plugins/plugin-registry.go @@ -6,7 +6,6 @@ import ( "path/filepath" "plugin" - "github.com/spf13/pflag" "go.uber.org/fx" "github.com/fluxninja/aperture/pkg/config" @@ -28,10 +27,9 @@ const ( ) var ( - pluginPrefix = info.Prefix + "-plugin-" - pluginGlob = pluginPrefix + "*.so" - defaultPath = path.Join(config.DefaultArtifactsDirectory, "plugins") - defaultPathFlag = defaultKey + ".plugins_path" + pluginPrefix = info.Prefix + "-plugin-" + pluginGlob = pluginPrefix + "*.so" + defaultPath = path.Join(config.DefaultArtifactsDirectory, "plugins") ) // PluginRegistry holds fields used for internal tracking of plugin symbols and disabled symbols or plugins of the service. @@ -71,8 +69,8 @@ type PluginTrackers map[string]*PluginTracker // swagger:model // +kubebuilder:object:generate=true type PluginsConfig struct { - // Path to plugins directory. This can be set via command line arguments as well. - PluginsPath string `json:"plugins_path"` + // Path to plugins directory. "default" points to `/var/lib/aperture//plugins`. + PluginsPath string `json:"plugins_path" default:"default"` // Specific plugin types to disable DisabledSymbols []string `json:"disabled_symbols"` // Specific plugins to disable @@ -84,53 +82,34 @@ type PluginsConfig struct { // Constructor holds fields for constructing a PluginRegistry. type Constructor struct { // Config key - Key string - // Path key - PathKey string + ConfigKey string // Plugin Symbols to look for PluginSymbols []string // default config DefaultConfig PluginsConfig } -func (constructor Constructor) setFlags(fs *pflag.FlagSet) error { - fs.String(constructor.PathKey, defaultPath, "path to plugins") - return nil -} - -func (constructor Constructor) provideFlagSetBuilder() config.FlagSetBuilderOut { - return config.FlagSetBuilderOut{Builder: constructor.setFlags} -} - // ModuleConfig holds configuration for the plugin module. type ModuleConfig struct { - PluginSymbols []string - OnlyCommandLineFlags bool + PluginSymbols []string } -// Module is a fx module that provides flag set builder and new plugin registry. +// Module is a fx module that provides new plugin registry. func (config ModuleConfig) Module() fx.Option { constructor := Constructor{ - Key: defaultKey, - PathKey: defaultPathFlag, + ConfigKey: defaultKey, PluginSymbols: config.PluginSymbols, } options := fx.Options( - fx.Provide(constructor.provideFlagSetBuilder), + fx.Provide(constructor.newPluginRegistry), ) - if !config.OnlyCommandLineFlags { - options = fx.Options( - options, - fx.Provide(constructor.newPluginRegistry), - ) - } return options } func (constructor Constructor) newPluginRegistry(unmarshaller config.Unmarshaller) (*PluginRegistry, fx.Option, error) { var pluginOptions fx.Option config := constructor.DefaultConfig - if err := unmarshaller.UnmarshalKey(constructor.Key, &config); err != nil { + if err := unmarshaller.UnmarshalKey(constructor.ConfigKey, &config); err != nil { log.Error().Err(err).Msg("Unable to deserialize plugin configuration") return nil, nil, err } @@ -152,6 +131,9 @@ func (constructor Constructor) newPluginRegistry(unmarshaller config.Unmarshalle // Discover Plugins var pluginPaths []string var err error + if config.PluginsPath == "default" { + config.PluginsPath = defaultPath + } // Make the directory absolute if it isn't already if !filepath.IsAbs(config.PluginsPath) { config.PluginsPath, err = filepath.Abs(config.PluginsPath) diff --git a/pkg/policies/controlplane/components/actuators/concurrency/concurrency-limiter.go b/pkg/policies/controlplane/components/actuators/concurrency/concurrency-limiter.go index 7a58b92690..6711cf4407 100644 --- a/pkg/policies/controlplane/components/actuators/concurrency/concurrency-limiter.go +++ b/pkg/policies/controlplane/components/actuators/concurrency/concurrency-limiter.go @@ -8,8 +8,8 @@ import ( "go.uber.org/fx" "google.golang.org/protobuf/proto" - configv1 "github.com/fluxninja/aperture/api/gen/proto/go/aperture/common/config/v1" policylangv1 "github.com/fluxninja/aperture/api/gen/proto/go/aperture/policy/language/v1" + wrappersv1 "github.com/fluxninja/aperture/api/gen/proto/go/aperture/policy/wrappers/v1" etcdclient "github.com/fluxninja/aperture/pkg/etcd/client" "github.com/fluxninja/aperture/pkg/log" "github.com/fluxninja/aperture/pkg/paths" @@ -61,7 +61,7 @@ func (configSync *concurrencyLimiterConfigSync) doSync(etcdClient *etcdclient.Cl // Add/remove file in lifecycle hooks in order to sync with etcd. lifecycle.Append(fx.Hook{ OnStart: func(ctx context.Context) error { - wrapper := &configv1.ConcurrencyLimiterWrapper{ + wrapper := &wrappersv1.ConcurrencyLimiterWrapper{ ConcurrencyLimiter: configSync.concurrencyLimiterProto, ComponentIndex: int64(configSync.componentIndex), PolicyName: configSync.policyBaseAPI.GetPolicyName(), diff --git a/pkg/policies/controlplane/components/actuators/concurrency/load-shed-actuator.go b/pkg/policies/controlplane/components/actuators/concurrency/load-shed-actuator.go index e197c6f61d..90f0e7671f 100644 --- a/pkg/policies/controlplane/components/actuators/concurrency/load-shed-actuator.go +++ b/pkg/policies/controlplane/components/actuators/concurrency/load-shed-actuator.go @@ -8,9 +8,9 @@ import ( "go.uber.org/fx" "google.golang.org/protobuf/proto" - configv1 "github.com/fluxninja/aperture/api/gen/proto/go/aperture/common/config/v1" policydecisionsv1 "github.com/fluxninja/aperture/api/gen/proto/go/aperture/policy/decisions/v1" policylangv1 "github.com/fluxninja/aperture/api/gen/proto/go/aperture/policy/language/v1" + wrappersv1 "github.com/fluxninja/aperture/api/gen/proto/go/aperture/policy/wrappers/v1" etcdclient "github.com/fluxninja/aperture/pkg/etcd/client" etcdwriter "github.com/fluxninja/aperture/pkg/etcd/writer" "github.com/fluxninja/aperture/pkg/log" @@ -101,7 +101,7 @@ func (lsa *LoadShedActuator) publishLoadShedFactor(loadShedFactor float64) error lsa.decision.LoadShedFactor = loadShedFactor // Publish decision log.Debug().Float64("loadShedFactor", loadShedFactor).Msg("Publish load shed decision") - wrapper := &configv1.LoadShedDecsisionWrapper{ + wrapper := &wrappersv1.LoadShedDecsisionWrapper{ LoadShedDecision: lsa.decision, ComponentIndex: int64(lsa.componentIndex), PolicyName: lsa.policyReadAPI.GetPolicyName(), diff --git a/pkg/policies/controlplane/components/actuators/concurrency/scheduler.go b/pkg/policies/controlplane/components/actuators/concurrency/scheduler.go index 24c23d2cb4..88a317879f 100644 --- a/pkg/policies/controlplane/components/actuators/concurrency/scheduler.go +++ b/pkg/policies/controlplane/components/actuators/concurrency/scheduler.go @@ -13,9 +13,9 @@ import ( "go.uber.org/multierr" "google.golang.org/protobuf/proto" - configv1 "github.com/fluxninja/aperture/api/gen/proto/go/aperture/common/config/v1" policydecisionsv1 "github.com/fluxninja/aperture/api/gen/proto/go/aperture/policy/decisions/v1" policylangv1 "github.com/fluxninja/aperture/api/gen/proto/go/aperture/policy/language/v1" + wrappersv1 "github.com/fluxninja/aperture/api/gen/proto/go/aperture/policy/wrappers/v1" etcdclient "github.com/fluxninja/aperture/pkg/etcd/client" etcdwriter "github.com/fluxninja/aperture/pkg/etcd/writer" "github.com/fluxninja/aperture/pkg/log" @@ -236,7 +236,7 @@ func (s *Scheduler) publishQueryTokens(tokens *policydecisionsv1.TokensDecision) policyName := s.policyReadAPI.GetPolicyName() policyHash := s.policyReadAPI.GetPolicyHash() - wrapper := &configv1.TokensDecisionWrapper{ + wrapper := &wrappersv1.TokensDecisionWrapper{ TokensDecision: tokens, ComponentIndex: int64(s.componentIndex), PolicyName: policyName, diff --git a/pkg/policies/controlplane/components/actuators/rate/rate-limiter.go b/pkg/policies/controlplane/components/actuators/rate/rate-limiter.go index 3f10b9faa9..e67af12b8f 100644 --- a/pkg/policies/controlplane/components/actuators/rate/rate-limiter.go +++ b/pkg/policies/controlplane/components/actuators/rate/rate-limiter.go @@ -10,9 +10,9 @@ import ( "go.uber.org/multierr" "google.golang.org/protobuf/proto" - configv1 "github.com/fluxninja/aperture/api/gen/proto/go/aperture/common/config/v1" policydecisionsv1 "github.com/fluxninja/aperture/api/gen/proto/go/aperture/policy/decisions/v1" policylangv1 "github.com/fluxninja/aperture/api/gen/proto/go/aperture/policy/language/v1" + wrappersv1 "github.com/fluxninja/aperture/api/gen/proto/go/aperture/policy/wrappers/v1" etcdclient "github.com/fluxninja/aperture/pkg/etcd/client" etcdwriter "github.com/fluxninja/aperture/pkg/etcd/writer" "github.com/fluxninja/aperture/pkg/log" @@ -67,7 +67,7 @@ func NewRateLimiterAndOptions( func (limiterSync *rateLimiterSync) setupSync(etcdClient *etcdclient.Client, lifecycle fx.Lifecycle) error { lifecycle.Append(fx.Hook{ OnStart: func(ctx context.Context) error { - wrapper := &configv1.RateLimiterWrapper{ + wrapper := &wrappersv1.RateLimiterWrapper{ RateLimiter: limiterSync.rateLimiterProto, ComponentIndex: int64(limiterSync.componentIndex), PolicyName: limiterSync.policyReadAPI.GetPolicyName(), @@ -134,7 +134,7 @@ func (limiterSync *rateLimiterSync) publishLimit(limitValue float64) error { limiterSync.decision.Limit = limitValue // Publish decision log.Debug().Float64("limit", limitValue).Msg("publishing rate limiter decision") - wrapper := &configv1.RateLimiterDecisionWrapper{ + wrapper := &wrappersv1.RateLimiterDecisionWrapper{ RateLimiterDecision: limiterSync.decision, ComponentIndex: int64(limiterSync.componentIndex), PolicyName: limiterSync.policyReadAPI.GetPolicyName(), diff --git a/pkg/policies/controlplane/policy-factory.go b/pkg/policies/controlplane/policy-factory.go index 8e1b1f0bb4..fcca449df9 100644 --- a/pkg/policies/controlplane/policy-factory.go +++ b/pkg/policies/controlplane/policy-factory.go @@ -5,7 +5,7 @@ import ( "go.uber.org/fx" - configv1 "github.com/fluxninja/aperture/api/gen/proto/go/aperture/common/config/v1" + wrappersv1 "github.com/fluxninja/aperture/api/gen/proto/go/aperture/policy/wrappers/v1" "github.com/fluxninja/aperture/pkg/config" etcdclient "github.com/fluxninja/aperture/pkg/etcd/client" etcdwatcher "github.com/fluxninja/aperture/pkg/etcd/watcher" @@ -108,7 +108,7 @@ func (factory *policyFactory) provideControllerPolicyFxOptions( unmarshaller config.Unmarshaller, reg status.Registry, ) (fx.Option, error) { - var wrapperMessage configv1.PolicyWrapper + var wrapperMessage wrappersv1.PolicyWrapper err := unmarshaller.Unmarshal(&wrapperMessage) if err != nil || wrapperMessage.Policy == nil { reg.SetStatus(status.NewStatus(nil, err)) diff --git a/pkg/policies/controlplane/policy.go b/pkg/policies/controlplane/policy.go index 8e5be2cf31..26d3dacb5e 100644 --- a/pkg/policies/controlplane/policy.go +++ b/pkg/policies/controlplane/policy.go @@ -11,8 +11,8 @@ import ( "google.golang.org/protobuf/proto" "gopkg.in/yaml.v2" - configv1 "github.com/fluxninja/aperture/api/gen/proto/go/aperture/common/config/v1" policylangv1 "github.com/fluxninja/aperture/api/gen/proto/go/aperture/policy/language/v1" + wrappersv1 "github.com/fluxninja/aperture/api/gen/proto/go/aperture/policy/wrappers/v1" "github.com/fluxninja/aperture/pkg/config" "github.com/fluxninja/aperture/pkg/jobs" "github.com/fluxninja/aperture/pkg/log" @@ -51,7 +51,7 @@ var _ iface.Policy = (*Policy)(nil) // newPolicyOptions creates a new Policy object and returns its Fx options for the per Policy App. func newPolicyOptions( - wrapperMessage *configv1.PolicyWrapper, + wrapperMessage *wrappersv1.PolicyWrapper, ) (fx.Option, error) { // List of options for the policy. policyOptions := []fx.Option{} @@ -98,7 +98,7 @@ func CompilePolicy(policyMessage *policylangv1.Policy) (CompiledCircuit, error) } // compilePolicyWrapper takes policyProto and returns a compiled policy. -func compilePolicyWrapper(wrapperMessage *configv1.PolicyWrapper) (*Policy, CompiledCircuit, fx.Option, error) { +func compilePolicyWrapper(wrapperMessage *wrappersv1.PolicyWrapper) (*Policy, CompiledCircuit, fx.Option, error) { if wrapperMessage == nil { return nil, nil, nil, fmt.Errorf("nil policy wrapper message") } @@ -222,7 +222,7 @@ func (policy *Policy) executeTick(jobCtxt context.Context) (proto.Message, error } // hashAndPolicyWrap wraps a proto message with a config properties wrapper and hashes it. -func hashAndPolicyWrap(policyMessage *policylangv1.Policy, policyName string) (*configv1.PolicyWrapper, error) { +func hashAndPolicyWrap(policyMessage *policylangv1.Policy, policyName string) (*wrappersv1.PolicyWrapper, error) { dat, marshalErr := yaml.Marshal(policyMessage) if marshalErr != nil { log.Error().Err(marshalErr).Msgf("Failed to marshal proto message %+v", policyMessage) @@ -235,7 +235,7 @@ func hashAndPolicyWrap(policyMessage *policylangv1.Policy, policyName string) (* } hash := base64.StdEncoding.EncodeToString(hashBytes[:]) - return &configv1.PolicyWrapper{ + return &wrappersv1.PolicyWrapper{ Policy: policyMessage, PolicyName: policyName, PolicyHash: hash, diff --git a/pkg/policies/controlplane/provider.go b/pkg/policies/controlplane/provider.go index cd0d37b0b0..0c6e3526d5 100644 --- a/pkg/policies/controlplane/provider.go +++ b/pkg/policies/controlplane/provider.go @@ -5,7 +5,6 @@ import ( "path" "github.com/ghodss/yaml" - "github.com/spf13/pflag" "go.uber.org/fx" "go.uber.org/multierr" @@ -36,7 +35,7 @@ import ( var ( policiesDefaultPath = path.Join(config.DefaultAssetsDirectory, "policies") - policiesPathKey = iface.PoliciesRoot + ".policies_path" + policiesConfigKey = iface.PoliciesRoot + ".policies_path" policiesFxTag = "Policies" ) @@ -45,8 +44,7 @@ func Module() fx.Option { return fx.Options( fx.Provide(provideCMFileValidator), // Syncing policies config to etcd - fx.Provide(providePoliciesPathFlag), - filesystemwatcher.Constructor{Name: policiesFxTag, PathKey: policiesPathKey, Path: policiesDefaultPath}.Annotate(), // Create a new watcher + filesystemwatcher.Constructor{Name: policiesFxTag, ConfigKey: policiesConfigKey, Path: policiesDefaultPath}.Annotate(), // Create a new watcher fx.Invoke( fx.Annotate( setupPoliciesNotifier, @@ -59,17 +57,6 @@ func Module() fx.Option { ) } -// providePoliciesPathFlag registers a command line flag builder function. -func providePoliciesPathFlag() config.FlagSetBuilderOut { - return config.FlagSetBuilderOut{Builder: setPoliciesPathFlag} -} - -// setPoliciesPathFlag registers command line flags. -func setPoliciesPathFlag(fs *pflag.FlagSet) error { - fs.String(policiesPathKey, policiesDefaultPath, "path to Policies directory") - return nil -} - // Sync policies config directory with etcd. func setupPoliciesNotifier(w notifiers.Watcher, etcdClient *etcdclient.Client, lifecycle fx.Lifecycle) { wrapPolicy := func(key notifiers.Key, bytes []byte, etype notifiers.EventType) (notifiers.Key, []byte, error) { diff --git a/pkg/policies/controlplane/resources/fluxmeter/flux-meter.go b/pkg/policies/controlplane/resources/fluxmeter/flux-meter.go index e6f576d851..eb997906f5 100644 --- a/pkg/policies/controlplane/resources/fluxmeter/flux-meter.go +++ b/pkg/policies/controlplane/resources/fluxmeter/flux-meter.go @@ -9,8 +9,8 @@ import ( "go.uber.org/fx" "google.golang.org/protobuf/proto" - configv1 "github.com/fluxninja/aperture/api/gen/proto/go/aperture/common/config/v1" policylangv1 "github.com/fluxninja/aperture/api/gen/proto/go/aperture/policy/language/v1" + wrappersv1 "github.com/fluxninja/aperture/api/gen/proto/go/aperture/policy/wrappers/v1" etcdclient "github.com/fluxninja/aperture/pkg/etcd/client" "github.com/fluxninja/aperture/pkg/log" "github.com/fluxninja/aperture/pkg/paths" @@ -58,7 +58,7 @@ func NewFluxMeterOptions( func (configSync *fluxMeterConfigSync) doSync(etcdClient *etcdclient.Client, lifecycle fx.Lifecycle) error { lifecycle.Append(fx.Hook{ OnStart: func(ctx context.Context) error { - wrapper := &configv1.FluxMeterWrapper{ + wrapper := &wrappersv1.FluxMeterWrapper{ FluxmeterName: configSync.fluxmeterName, FluxMeter: configSync.fluxMeterProto, } diff --git a/pkg/policies/dataplane/actuators/concurrency/auto-tokens.go b/pkg/policies/dataplane/actuators/concurrency/auto-tokens.go index bb90bfe8a0..423b55dd4d 100644 --- a/pkg/policies/dataplane/actuators/concurrency/auto-tokens.go +++ b/pkg/policies/dataplane/actuators/concurrency/auto-tokens.go @@ -9,8 +9,8 @@ import ( "go.uber.org/fx" - configv1 "github.com/fluxninja/aperture/api/gen/proto/go/aperture/common/config/v1" policydecisionsv1 "github.com/fluxninja/aperture/api/gen/proto/go/aperture/policy/decisions/v1" + wrappersv1 "github.com/fluxninja/aperture/api/gen/proto/go/aperture/policy/wrappers/v1" "github.com/fluxninja/aperture/pkg/config" etcdclient "github.com/fluxninja/aperture/pkg/etcd/client" etcdwatcher "github.com/fluxninja/aperture/pkg/etcd/watcher" @@ -121,7 +121,7 @@ func (at *autoTokens) tokenUpdateCallback(event notifiers.Event, unmarshaller co return } - var wrapperMessage configv1.TokensDecisionWrapper + var wrapperMessage wrappersv1.TokensDecisionWrapper err := unmarshaller.Unmarshal(&wrapperMessage) if err != nil || wrapperMessage.TokensDecision == nil { log.Error().Err(err).Msg("Failed to unmarshal config wrapper") diff --git a/pkg/policies/dataplane/actuators/concurrency/concurrency-limiter.go b/pkg/policies/dataplane/actuators/concurrency/concurrency-limiter.go index e6e6ac946d..8c49693e93 100644 --- a/pkg/policies/dataplane/actuators/concurrency/concurrency-limiter.go +++ b/pkg/policies/dataplane/actuators/concurrency/concurrency-limiter.go @@ -14,10 +14,10 @@ import ( "go.uber.org/fx" "go.uber.org/multierr" - configv1 "github.com/fluxninja/aperture/api/gen/proto/go/aperture/common/config/v1" selectorv1 "github.com/fluxninja/aperture/api/gen/proto/go/aperture/common/selector/v1" flowcontrolv1 "github.com/fluxninja/aperture/api/gen/proto/go/aperture/flowcontrol/v1" policylangv1 "github.com/fluxninja/aperture/api/gen/proto/go/aperture/policy/language/v1" + wrappersv1 "github.com/fluxninja/aperture/api/gen/proto/go/aperture/policy/wrappers/v1" "github.com/fluxninja/aperture/pkg/agentinfo" "github.com/fluxninja/aperture/pkg/config" etcdclient "github.com/fluxninja/aperture/pkg/etcd/client" @@ -228,7 +228,7 @@ func (conLimiterFactory *concurrencyLimiterFactory) newConcurrencyLimiterOptions unmarshaller config.Unmarshaller, reg status.Registry, ) (fx.Option, error) { - wrapperMessage := &configv1.ConcurrencyLimiterWrapper{} + wrapperMessage := &wrappersv1.ConcurrencyLimiterWrapper{} err := unmarshaller.Unmarshal(wrapperMessage) concurrencyLimiterMessage := wrapperMessage.ConcurrencyLimiter if err != nil || concurrencyLimiterMessage == nil { @@ -425,7 +425,7 @@ func (conLimiter *concurrencyLimiter) GetSelector() *selectorv1.Selector { } // RunLimiter . -func (conLimiter *concurrencyLimiter) RunLimiter(labels selectors.Labels, decision *flowcontrolv1.LimiterDecision) { +func (conLimiter *concurrencyLimiter) RunLimiter(labels selectors.Labels) *flowcontrolv1.LimiterDecision { var matchedWorkloadProto *policylangv1.Scheduler_Workload var matchedWorkloadIndex string // match labels against conLimiter.workloadMultiMatcher @@ -489,13 +489,16 @@ func (conLimiter *concurrencyLimiter) RunLimiter(labels selectors.Labels, decisi if accepted { conLimiter.acceptedConcurrencyCounter.Add(float64(reqContext.Tokens)) } - decision.PolicyName = conLimiter.GetPolicyName() - decision.PolicyHash = conLimiter.GetPolicyHash() - decision.ComponentIndex = conLimiter.GetComponentIndex() - decision.Dropped = !accepted - decision.Details = &flowcontrolv1.LimiterDecision_ConcurrencyLimiter_{ - ConcurrencyLimiter: &flowcontrolv1.LimiterDecision_ConcurrencyLimiter{ - WorkloadIndex: matchedWorkloadIndex, + + return &flowcontrolv1.LimiterDecision{ + PolicyName: conLimiter.GetPolicyName(), + PolicyHash: conLimiter.GetPolicyHash(), + ComponentIndex: conLimiter.GetComponentIndex(), + Dropped: !accepted, + Details: &flowcontrolv1.LimiterDecision_ConcurrencyLimiter_{ + ConcurrencyLimiter: &flowcontrolv1.LimiterDecision_ConcurrencyLimiter{ + WorkloadIndex: matchedWorkloadIndex, + }, }, } } diff --git a/pkg/policies/dataplane/actuators/concurrency/load-shed-actuator.go b/pkg/policies/dataplane/actuators/concurrency/load-shed-actuator.go index f482741cb1..68b11b2d5a 100644 --- a/pkg/policies/dataplane/actuators/concurrency/load-shed-actuator.go +++ b/pkg/policies/dataplane/actuators/concurrency/load-shed-actuator.go @@ -11,7 +11,7 @@ import ( "go.uber.org/fx" "go.uber.org/multierr" - configv1 "github.com/fluxninja/aperture/api/gen/proto/go/aperture/common/config/v1" + wrappersv1 "github.com/fluxninja/aperture/api/gen/proto/go/aperture/policy/wrappers/v1" "github.com/fluxninja/aperture/pkg/config" etcdclient "github.com/fluxninja/aperture/pkg/etcd/client" etcdwatcher "github.com/fluxninja/aperture/pkg/etcd/watcher" @@ -250,7 +250,7 @@ func (lsa *loadShedActuator) decisionUpdateCallback(event notifiers.Event, unmar return } - var wrapperMessage configv1.LoadShedDecsisionWrapper + var wrapperMessage wrappersv1.LoadShedDecsisionWrapper err := unmarshaller.Unmarshal(&wrapperMessage) loadShedDecision := wrapperMessage.LoadShedDecision if err != nil || loadShedDecision == nil { diff --git a/pkg/policies/dataplane/actuators/rate/rate-limiter.go b/pkg/policies/dataplane/actuators/rate/rate-limiter.go index b54e67ac0b..967a59159c 100644 --- a/pkg/policies/dataplane/actuators/rate/rate-limiter.go +++ b/pkg/policies/dataplane/actuators/rate/rate-limiter.go @@ -9,10 +9,10 @@ import ( "go.uber.org/fx" "go.uber.org/multierr" - configv1 "github.com/fluxninja/aperture/api/gen/proto/go/aperture/common/config/v1" selectorv1 "github.com/fluxninja/aperture/api/gen/proto/go/aperture/common/selector/v1" flowcontrolv1 "github.com/fluxninja/aperture/api/gen/proto/go/aperture/flowcontrol/v1" policylangv1 "github.com/fluxninja/aperture/api/gen/proto/go/aperture/policy/language/v1" + wrappersv1 "github.com/fluxninja/aperture/api/gen/proto/go/aperture/policy/wrappers/v1" "github.com/fluxninja/aperture/pkg/agentinfo" "github.com/fluxninja/aperture/pkg/config" "github.com/fluxninja/aperture/pkg/distcache" @@ -156,7 +156,7 @@ func (rateLimiterFactory *rateLimiterFactory) newRateLimiterOptions( unmarshaller config.Unmarshaller, reg status.Registry, ) (fx.Option, error) { - wrapperMessage := &configv1.RateLimiterWrapper{} + wrapperMessage := &wrappersv1.RateLimiterWrapper{} err := unmarshaller.Unmarshal(wrapperMessage) if err != nil || wrapperMessage.RateLimiter == nil { reg.SetStatus(status.NewStatus(nil, err)) @@ -284,7 +284,7 @@ func (rateLimiter *rateLimiter) GetSelector() *selectorv1.Selector { } // RunLimiter runs the limiter. -func (rateLimiter *rateLimiter) RunLimiter(labels selectors.Labels, decision *flowcontrolv1.LimiterDecision) { +func (rateLimiter *rateLimiter) RunLimiter(labels selectors.Labels) *flowcontrolv1.LimiterDecision { reason := flowcontrolv1.LimiterDecision_LIMITER_REASON_UNSPECIFIED label, ok, remaining, current := rateLimiter.TakeN(labels, 1) @@ -293,16 +293,18 @@ func (rateLimiter *rateLimiter) RunLimiter(labels selectors.Labels, decision *fl reason = flowcontrolv1.LimiterDecision_LIMITER_REASON_KEY_NOT_FOUND } - decision.PolicyName = rateLimiter.GetPolicyName() - decision.PolicyHash = rateLimiter.GetPolicyHash() - decision.ComponentIndex = rateLimiter.GetComponentIndex() - decision.Dropped = !ok - decision.Reason = reason - decision.Details = &flowcontrolv1.LimiterDecision_RateLimiter_{ - RateLimiter: &flowcontrolv1.LimiterDecision_RateLimiter{ - Label: label, - Remaining: int64(remaining), - Current: int64(current), + return &flowcontrolv1.LimiterDecision{ + PolicyName: rateLimiter.GetPolicyName(), + PolicyHash: rateLimiter.GetPolicyHash(), + ComponentIndex: rateLimiter.GetComponentIndex(), + Dropped: !ok, + Reason: reason, + Details: &flowcontrolv1.LimiterDecision_RateLimiter_{ + RateLimiter: &flowcontrolv1.LimiterDecision_RateLimiter{ + Label: label, + Remaining: int64(remaining), + Current: int64(current), + }, }, } } @@ -330,7 +332,7 @@ func (rateLimiter *rateLimiter) decisionUpdateCallback(event notifiers.Event, un return } - var wrapperMessage configv1.RateLimiterDecisionWrapper + var wrapperMessage wrappersv1.RateLimiterDecisionWrapper err := unmarshaller.Unmarshal(&wrapperMessage) if err != nil || wrapperMessage.RateLimiterDecision == nil { return diff --git a/pkg/policies/dataplane/engine.go b/pkg/policies/dataplane/engine.go index 908fe99c01..5d060c8fcf 100644 --- a/pkg/policies/dataplane/engine.go +++ b/pkg/policies/dataplane/engine.go @@ -120,6 +120,7 @@ func (e *Engine) ProcessRequest(controlPoint selectors.ControlPoint, serviceIDs func runLimiters(limiters []iface.Limiter, labels selectors.Labels) ([]*flowcontrolv1.LimiterDecision, flowcontrolv1.DecisionType) { var wg sync.WaitGroup var once sync.Once + decisions := make([]*flowcontrolv1.LimiterDecision, len(limiters)) decisionType := flowcontrolv1.DecisionType_DECISION_TYPE_ACCEPTED @@ -127,31 +128,28 @@ func runLimiters(limiters []iface.Limiter, labels selectors.Labels) ([]*flowcont decisionType = flowcontrolv1.DecisionType_DECISION_TYPE_REJECTED } - execLimiter := func(limiter iface.Limiter, decision *flowcontrolv1.LimiterDecision) func() { + execLimiter := func(limiter iface.Limiter, i int) func() { return func() { defer wg.Done() - limiter.RunLimiter(labels, decision) - if decision.Dropped { + decisions[i] = limiter.RunLimiter(labels) + if decisions[i].Dropped { once.Do(setDecisionRejected) } } } - limiterDecisions := make([]*flowcontrolv1.LimiterDecision, len(limiters)) // execute limiters for i, limiter := range limiters { wg.Add(1) - decision := &flowcontrolv1.LimiterDecision{} - limiterDecisions[i] = decision if i == len(limiters)-1 { - execLimiter(limiter, decision)() + execLimiter(limiter, i)() } else { - panichandler.Go(execLimiter(limiter, decision)) + panichandler.Go(execLimiter(limiter, i)) } } wg.Wait() - return limiterDecisions, decisionType + return decisions, decisionType } func returnExtraTokens( diff --git a/pkg/policies/dataplane/iface/limiter.go b/pkg/policies/dataplane/iface/limiter.go index a660476f98..bae84e4cf3 100644 --- a/pkg/policies/dataplane/iface/limiter.go +++ b/pkg/policies/dataplane/iface/limiter.go @@ -27,6 +27,6 @@ func (limiterID LimiterID) String() string { type Limiter interface { GetPolicyName() string GetSelector() *selectorv1.Selector - RunLimiter(labels selectors.Labels, decision *flowcontrolv1.LimiterDecision) + RunLimiter(labels selectors.Labels) *flowcontrolv1.LimiterDecision GetLimiterID() LimiterID } diff --git a/pkg/policies/dataplane/resources/fluxmeter/flux-meter.go b/pkg/policies/dataplane/resources/fluxmeter/flux-meter.go index 8736c11c96..6eaaf5023f 100644 --- a/pkg/policies/dataplane/resources/fluxmeter/flux-meter.go +++ b/pkg/policies/dataplane/resources/fluxmeter/flux-meter.go @@ -8,9 +8,9 @@ import ( "go.uber.org/fx" "go.uber.org/multierr" - configv1 "github.com/fluxninja/aperture/api/gen/proto/go/aperture/common/config/v1" selectorv1 "github.com/fluxninja/aperture/api/gen/proto/go/aperture/common/selector/v1" flowcontrolv1 "github.com/fluxninja/aperture/api/gen/proto/go/aperture/flowcontrol/v1" + wrappersv1 "github.com/fluxninja/aperture/api/gen/proto/go/aperture/policy/wrappers/v1" "github.com/fluxninja/aperture/pkg/agentinfo" "github.com/fluxninja/aperture/pkg/config" etcdclient "github.com/fluxninja/aperture/pkg/etcd/client" @@ -153,7 +153,7 @@ func (fluxMeterFactory *fluxMeterFactory) newFluxMeterOptions( unmarshaller config.Unmarshaller, reg status.Registry, ) (fx.Option, error) { - wrapperMessage := &configv1.FluxMeterWrapper{} + wrapperMessage := &wrappersv1.FluxMeterWrapper{} err := unmarshaller.Unmarshal(wrapperMessage) if err != nil || wrapperMessage.FluxMeter == nil { reg.SetStatus(status.NewStatus(nil, err)) diff --git a/pkg/policies/mocks/mock_limiter.go b/pkg/policies/mocks/mock_limiter.go index 1ccc60b50d..292c3c88e2 100644 --- a/pkg/policies/mocks/mock_limiter.go +++ b/pkg/policies/mocks/mock_limiter.go @@ -80,13 +80,15 @@ func (mr *MockLimiterMockRecorder) GetSelector() *gomock.Call { } // RunLimiter mocks base method. -func (m *MockLimiter) RunLimiter(labels selectors.Labels, decision *flowcontrolv1.LimiterDecision) { +func (m *MockLimiter) RunLimiter(labels selectors.Labels) *flowcontrolv1.LimiterDecision { m.ctrl.T.Helper() - m.ctrl.Call(m, "RunLimiter", labels, decision) + ret := m.ctrl.Call(m, "RunLimiter", labels) + ret0, _ := ret[0].(*flowcontrolv1.LimiterDecision) + return ret0 } // RunLimiter indicates an expected call of RunLimiter. -func (mr *MockLimiterMockRecorder) RunLimiter(labels, decision interface{}) *gomock.Call { +func (mr *MockLimiterMockRecorder) RunLimiter(labels interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RunLimiter", reflect.TypeOf((*MockLimiter)(nil).RunLimiter), labels, decision) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RunLimiter", reflect.TypeOf((*MockLimiter)(nil).RunLimiter), labels) } diff --git a/pkg/profilers/profilers.go b/pkg/profilers/profilers.go index 9afc4d3d46..f050c00bc9 100644 --- a/pkg/profilers/profilers.go +++ b/pkg/profilers/profilers.go @@ -10,8 +10,6 @@ import ( "github.com/fluxninja/lumberjack" "github.com/gorilla/mux" - "github.com/spf13/cast" - "github.com/spf13/pflag" "go.uber.org/fx" "github.com/fluxninja/aperture/pkg/config" @@ -26,29 +24,15 @@ const ( defaultCPUFile = "cpu.prof" ) -var ( - // DefaultPath is the default path that is used to store profiles. - DefaultPath = path.Join(config.DefaultLogDirectory, "profiles") - // DefaultPathFlag is the default path flag for the profiler. - DefaultPathFlag = defaultKey + ".profiles_path" -) - -func (constructor Constructor) setFlags(fs *pflag.FlagSet) error { - fs.String(constructor.PathKey, DefaultPath, "path to performance profiles") - return nil -} - -func (constructor Constructor) provideFlagSetBuilder() config.FlagSetBuilderOut { - return config.FlagSetBuilderOut{Builder: constructor.setFlags} -} +// defaultPath is the default path that is used to store profiles. +var defaultPath = path.Join(config.DefaultLogDirectory, "profiles") // Module is a fx module that provides the profilers. func Module() fx.Option { - constructor := Constructor{Key: defaultKey, PathKey: DefaultPathFlag} + constructor := Constructor{ConfigKey: defaultKey} return fx.Options( fx.Invoke(constructor.setupProfilers), - fx.Provide(constructor.provideFlagSetBuilder), ) } @@ -66,16 +50,15 @@ func Module() fx.Option { type ProfilersConfig struct { // Register routes. Profile types profile, symbol and cmdline will be registered at /debug/pprof/{profile,symbol,cmdline}. RegisterHTTPRoutes bool `json:"register_http_routes" default:"true"` - // Path to save performance profiles. This can be set via command line arguments as well. E.g. default path for aperture-agent is /var/log/aperture/aperture-agent/profiles. - ProfilesPath string `json:"profiles_path"` + // Path to save performance profiles. "default" path is `/var/log/aperture//profiles`. + ProfilesPath string `json:"profiles_path" default:"default"` // Flag to enable cpu profiling on process start and save it to a file. HTTP interface will not work if this is enabled as CPU profile will always be running. CPUProfile bool `json:"cpu_profiler" default:"false"` } // Constructor holds fields to create an instance of profilers. type Constructor struct { - Key string - PathKey string + ConfigKey string DefaultConfig ProfilersConfig } @@ -83,20 +66,21 @@ func (constructor Constructor) setupProfilers(unmarshaller config.Unmarshaller, router *mux.Router, lc fx.Lifecycle, ) error { - profilesPath := cast.ToString(unmarshaller.Get(constructor.PathKey)) - config := constructor.DefaultConfig - if err := unmarshaller.UnmarshalKey(constructor.Key, &config); err != nil { + if err := unmarshaller.UnmarshalKey(constructor.ConfigKey, &config); err != nil { log.Error().Err(err) return err } + if config.ProfilesPath == "default" { + config.ProfilesPath = defaultPath + } var cpuProfileFile *lumberjack.Logger var err error if config.CPUProfile { - filename := path.Join(profilesPath, defaultCPUFile) + filename := path.Join(config.ProfilesPath, defaultCPUFile) log.Debug().Str("filename", filename).Msg("opening cpu profile writer") cpuProfileFile = newProfileWriter(filename) } @@ -109,7 +93,7 @@ func (constructor Constructor) setupProfilers(unmarshaller config.Unmarshaller, } lc.Append(fx.Hook{ - OnStart: func(ctx context.Context) error { + OnStart: func(context.Context) error { log.Info().Interface("config", config).Msg("profiler config") if config.CPUProfile { @@ -122,7 +106,7 @@ func (constructor Constructor) setupProfilers(unmarshaller config.Unmarshaller, return nil }, - OnStop: func(ctx context.Context) error { + OnStop: func(context.Context) error { if config.CPUProfile { log.Debug().Msg("stopping cpu profile") pprof.StopCPUProfile() diff --git a/pkg/prometheus/client.go b/pkg/prometheus/client.go index 58baed3899..37fbc6d2ab 100644 --- a/pkg/prometheus/client.go +++ b/pkg/prometheus/client.go @@ -46,7 +46,7 @@ type PrometheusConfig struct { func Module() fx.Option { return fx.Options( fx.Provide(providePrometheusClient), - commonhttp.ClientConstructor{Name: "prometheus.http-client", Key: httpConfigKey}.Annotate(), + commonhttp.ClientConstructor{Name: "prometheus.http-client", ConfigKey: httpConfigKey}.Annotate(), ) } diff --git a/pkg/watchdog/watchdog.go b/pkg/watchdog/watchdog.go index cda0c0ff29..c55d12989c 100644 --- a/pkg/watchdog/watchdog.go +++ b/pkg/watchdog/watchdog.go @@ -43,14 +43,14 @@ const ( // Module is a fx module that provides annotated Watchdog jobs and triggers Watchdog checks. func Module() fx.Option { return fx.Options( - fx.Invoke(Constructor{Key: watchdogConfigKey}.setupWatchdog), + fx.Invoke(Constructor{ConfigKey: watchdogConfigKey}.setupWatchdog), ) } // Constructor holds fields to set up the Watchdog. type Constructor struct { - // Key for config - Key string + // ConfigKey for config + ConfigKey string // Default config DefaultConfig WatchdogConfig } @@ -76,7 +76,7 @@ type watchdog struct { func (constructor Constructor) setupWatchdog(in WatchdogIn) error { config := constructor.DefaultConfig - if err := in.Unmarshaller.UnmarshalKey(constructor.Key, &config); err != nil { + if err := in.Unmarshaller.UnmarshalKey(constructor.ConfigKey, &config); err != nil { log.Error().Err(err).Msg("Unable to deserialize watchdog policy!") return err } diff --git a/playground/tanka/jsonnetfile.lock.json b/playground/tanka/jsonnetfile.lock.json index 770e52b0a0..9186b116c8 100644 --- a/playground/tanka/jsonnetfile.lock.json +++ b/playground/tanka/jsonnetfile.lock.json @@ -8,8 +8,8 @@ "subdir": "" } }, - "version": "c986ab02105fe80ab7604721c00b036e64ae6fb2", - "sum": "ntOIyy4QRSQwlBwabsAFSztfFHGb2JcdVYuUiHZjdkI=" + "version": "f81b5bbb37a3ae789a87896c4d1e2de3ac94cf63", + "sum": "w2YOBMzLjwii/kf4/xysTYzvT3efqxMqm5WvnRMbjUQ=" }, { "source": { @@ -18,8 +18,8 @@ "subdir": "lib/1.0" } }, - "version": "c986ab02105fe80ab7604721c00b036e64ae6fb2", - "sum": "uaIkLQIC6uxxY5NnZf/tVeGDEGNv7SQHRQpXzWCSAXI=" + "version": "f81b5bbb37a3ae789a87896c4d1e2de3ac94cf63", + "sum": "spRIhQpaIUIEtRnY7SXB6k1EpNtAh7rMdyyrBMGJv/U=" }, { "source": { @@ -28,8 +28,8 @@ "subdir": "libsonnet/1.0" } }, - "version": "84ac1fa9a5231d92ea918d64b201cc00a2fcca19", - "sum": "HrvDOYR6sNNrN3qEzqMgydb+xnfKEEKyG1uBo5aAobw=" + "version": "e5698fd9338940caa846a4da73c38b3951c1d8c4", + "sum": "gujVBgM4VMJlYrNJ76dsarpZGux8/G5upXtD4c35sRs=" }, { "source": { @@ -48,7 +48,7 @@ "subdir": "grafana-builder" } }, - "version": "c132c4afcf17491718539db4c2d94c0ea4346120", + "version": "302be6e9e28d7641089c5d829470446d966d8b2e", "sum": "tDR6yT2GVfw0wTU12iZH+m01HrbIr6g/xN+/8nzNkU0=" }, { @@ -58,7 +58,7 @@ "subdir": "ksonnet-util" } }, - "version": "c132c4afcf17491718539db4c2d94c0ea4346120", + "version": "302be6e9e28d7641089c5d829470446d966d8b2e", "sum": "2++XoPslyz02LRgsxREWxjLgYgiCIqhAtXCyVSvYcoE=" }, { @@ -68,7 +68,7 @@ "subdir": "tanka-util" } }, - "version": "c132c4afcf17491718539db4c2d94c0ea4346120", + "version": "302be6e9e28d7641089c5d829470446d966d8b2e", "sum": "ShSIissXdvCy1izTCDZX6tY7qxCoepE5L+WJ52Hw7ZQ=" }, { diff --git a/plugins/service/aperture-plugin-fluxninja/heartbeats/provide.go b/plugins/service/aperture-plugin-fluxninja/heartbeats/provide.go index 8ad10c74af..a7957fe3b3 100644 --- a/plugins/service/aperture-plugin-fluxninja/heartbeats/provide.go +++ b/plugins/service/aperture-plugin-fluxninja/heartbeats/provide.go @@ -23,8 +23,8 @@ import ( func Module() fx.Option { log.Info().Msg("Loading Heartbeats plugin") return fx.Options( - grpcclient.ClientConstructor{Name: "heartbeats-grpc-client", Key: pluginconfig.PluginConfigKey + ".client.grpc"}.Annotate(), - httpclient.ClientConstructor{Name: "heartbeats-http-client", Key: pluginconfig.PluginConfigKey + ".client.http"}.Annotate(), + grpcclient.ClientConstructor{Name: "heartbeats-grpc-client", ConfigKey: pluginconfig.PluginConfigKey + ".client.grpc"}.Annotate(), + httpclient.ClientConstructor{Name: "heartbeats-http-client", ConfigKey: pluginconfig.PluginConfigKey + ".client.http"}.Annotate(), fx.Provide(Provide), PeersWatcherModule(), jobs.JobGroupConstructor{Name: heartbeatsGroup}.Annotate(), diff --git a/plugins/service/aperture-plugin-sentry/main.go b/plugins/service/aperture-plugin-sentry/main.go index b330efd0ef..6e0d1bb1b2 100644 --- a/plugins/service/aperture-plugin-sentry/main.go +++ b/plugins/service/aperture-plugin-sentry/main.go @@ -33,7 +33,7 @@ type SentryPlugin struct{} func (sp *SentryPlugin) Module() fx.Option { log.Info().Msg("Loading SentryPlugin") return fx.Options( - sentry.SentryWriterConstructor{Key: Plugin}.Annotate(), + sentry.SentryWriterConstructor{ConfigKey: Plugin}.Annotate(), ) } diff --git a/plugins/service/aperture-plugin-sentry/sentry/sentry.go b/plugins/service/aperture-plugin-sentry/sentry/sentry.go index a3feb7d56a..d6b3ec9ddd 100644 --- a/plugins/service/aperture-plugin-sentry/sentry/sentry.go +++ b/plugins/service/aperture-plugin-sentry/sentry/sentry.go @@ -45,7 +45,7 @@ type SentryWriterConstructor struct { // Name of sentry instance Name string // Config key - Key string + ConfigKey string // Default Config DefaultConfig SentryConfig } @@ -71,7 +71,7 @@ func (constructor SentryWriterConstructor) Annotate() fx.Option { func (constructor SentryWriterConstructor) provideSentryWriter(unmarshaller config.Unmarshaller, statusRegistry status.Registry, lifecycle fx.Lifecycle) (io.Writer, error) { config := constructor.DefaultConfig - if err := unmarshaller.UnmarshalKey(constructor.Key, &config); err != nil { + if err := unmarshaller.UnmarshalKey(constructor.ConfigKey, &config); err != nil { log.Panic().Err(err).Msg("Unable to deserialize sentry config") } diff --git a/test/aperture_suite_test.go b/test/aperture_suite_test.go index ca45659d88..9992479715 100644 --- a/test/aperture_suite_test.go +++ b/test/aperture_suite_test.go @@ -143,7 +143,7 @@ var _ = BeforeSuite(func() { flowcontrol.Module, classifier.Module, otelcollector.Module(), - grpc.ClientConstructor{Name: "flowcontrol-grpc-client", Key: "flowcontrol.client.grpc"}.Annotate(), + grpc.ClientConstructor{Name: "flowcontrol-grpc-client", ConfigKey: "flowcontrol.client.grpc"}.Annotate(), jobs.JobGroupConstructor{Name: jobGroupName}.Annotate(), fx.Populate(jgIn), ) diff --git a/tools/load_generator/scenarios/load_test.js b/tools/load_generator/scenarios/load_test.js index 5bdaa71ae7..e02f0a80d5 100644 --- a/tools/load_generator/scenarios/load_test.js +++ b/tools/load_generator/scenarios/load_test.js @@ -1,11 +1,12 @@ import http from "k6/http"; import { check } from "k6"; +import { randomIntBetween } from "https://jslib.k6.io/k6-utils/1.2.0/index.js"; export let vuStages = [ { duration: "1s", target: 5 }, { duration: "2m", target: 5 }, - { duration: "1m", target: 30 }, - { duration: "2m", target: 30 }, + { duration: "1m", target: 25 }, + { duration: "2m", target: 25 }, { duration: "1s", target: 5 }, { duration: "5m", target: 5 }, ]; @@ -39,7 +40,11 @@ export default function () { let res = http.request("POST", url, JSON.stringify(body), { headers: headers, }); - check(res, { + const ret = check(res, { "http status was 200": res.status === 200, }); + if (!ret) { + // sleep for 100ms to 150ms + sleep(randomIntBetween(0.1, 0.15)); + } }