From 0874711b4d2ebd585336535e636bbf7724ce3c48 Mon Sep 17 00:00:00 2001 From: Filip Chmielewski Date: Tue, 6 Sep 2022 06:33:44 +0200 Subject: [PATCH] Add classifier index to classifier ID --- .../config/v1/config_properties_wrapper.proto | 2 + api/aperture/flowcontrol/v1/flowcontrol.proto | 1 + api/gen/openapiv2/aperture.swagger.yaml | 45 ++--- .../config/v1/config_properties_wrapper.pb.go | 182 ++++++++++-------- .../v1/config_properties_wrapper.pb.json.go | 2 +- .../config_properties_wrapper_deepcopy.gen.go | 21 ++ .../aperture/flowcontrol/v1/flowcontrol.pb.go | 79 ++++---- .../flowcontrol/v1/flowcontrol.pb.json.go | 2 +- .../v1/flowcontrol_deepcopy.gen.go | 21 ++ docs/gen/policies/gen.yaml | 68 +++---- docs/gen/policies/policy.md | 88 ++++----- libsonnet/1.0/_gen/v1/gen.libsonnet | 2 +- ...t => policylanguagev1classifier.libsonnet} | 0 pkg/metrics/schema.go | 2 + pkg/otelcollector/consts.go | 2 + .../metricsprocessor/processor.go | 12 ++ .../resources/classifier/classifier.go | 7 +- pkg/policies/dataplane/engine.go | 5 +- pkg/policies/dataplane/iface/classifier.go | 13 +- .../resources/classifier/classifier.go | 6 +- .../dataplane/resources/classifier/provide.go | 2 +- 21 files changed, 317 insertions(+), 245 deletions(-) rename libsonnet/1.0/_gen/v1/{classifier.libsonnet => policylanguagev1classifier.libsonnet} (100%) diff --git a/api/aperture/common/config/v1/config_properties_wrapper.proto b/api/aperture/common/config/v1/config_properties_wrapper.proto index 0aef2e5b42..06c7ff77f9 100644 --- a/api/aperture/common/config/v1/config_properties_wrapper.proto +++ b/api/aperture/common/config/v1/config_properties_wrapper.proto @@ -30,6 +30,8 @@ message ClassifierWrapper { string policy_name = 2; // Hash of the entire Policy spec. string policy_hash = 3; + // Index of the classifier within Policy. + int64 classifier_index = 4; } message ConcurrencyLimiterWrapper { diff --git a/api/aperture/flowcontrol/v1/flowcontrol.proto b/api/aperture/flowcontrol/v1/flowcontrol.proto index bb6e2ec340..5cd272fb61 100644 --- a/api/aperture/flowcontrol/v1/flowcontrol.proto +++ b/api/aperture/flowcontrol/v1/flowcontrol.proto @@ -90,4 +90,5 @@ message FluxMeter { message Classifier { string policy_name = 1; string policy_hash = 2; + int64 classifier_index = 3; } diff --git a/api/gen/openapiv2/aperture.swagger.yaml b/api/gen/openapiv2/aperture.swagger.yaml index 89eb87cd6a..16da8a74b8 100644 --- a/api/gen/openapiv2/aperture.swagger.yaml +++ b/api/gen/openapiv2/aperture.swagger.yaml @@ -262,10 +262,13 @@ definitions: [flow labels](/concepts/flow-control/label/label.md). workload: $ref: '#/definitions/SchedulerWorkload' - description: Workload associated with requests matching the label matcher. + description: Workload associated with flows matching the label matcher. apertureflowcontrolv1Classifier: type: object properties: + classifier_index: + type: string + format: int64 policy_hash: type: string policy_name: @@ -366,11 +369,18 @@ definitions: type: object additionalProperties: $ref: '#/definitions/v1Rule' - description: A map of {key, value} pairs mapping from flow label names to rules that define how to extract and propagate them. + description: |- + A map of {key, value} pairs mapping from + [flow label](/concepts/flow-control/label/label.md) keys to rules that define + how to extract and propagate flow labels with that key. selector: $ref: '#/definitions/v1Selector' description: Defines where to apply the flow classification rule. description: |- + :::info + See also [Classifier overview](/concepts/flow-control/label/classifier.md). + ::: + Example: ```yaml selector: @@ -687,37 +697,6 @@ definitions: docs on how exactly it handles invalid inputs. ::: title: Circuit is defined as a dataflow graph of inter-connected components - v1Classifier: - type: object - properties: - rules: - type: object - additionalProperties: - $ref: '#/definitions/v1Rule' - description: |- - A map of {key, value} pairs mapping from - [flow label](/concepts/flow-control/label/label.md) keys to rules that define - how to extract and propagate flow labels with that key. - selector: - $ref: '#/definitions/v1Selector' - description: Defines where to apply the flow classification rule. - description: |- - :::info - See also [Classifier overview](/concepts/flow-control/label/classifier.md). - ::: - - Example: - ```yaml - selector: - service: service1.default.svc.cluster.local - control_point: - traffic: ingress - rules: - user: - extractor: - from: request.http.headers.user - ``` - title: Set of classification rules sharing a common selector v1Component: type: object properties: 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 index f4350b5f9c..ef44603d69 100644 --- 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 @@ -156,6 +156,8 @@ type ClassifierWrapper struct { 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"` + // Index of the classifier within Policy. + ClassifierIndex int64 `protobuf:"varint,4,opt,name=classifier_index,json=classifierIndex,proto3" json:"classifier_index,omitempty"` } func (x *ClassifierWrapper) Reset() { @@ -211,6 +213,13 @@ func (x *ClassifierWrapper) GetPolicyHash() string { return "" } +func (x *ClassifierWrapper) GetClassifierIndex() int64 { + if x != nil { + return x.ClassifierIndex + } + return 0 +} + type ConcurrencyLimiterWrapper struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -622,7 +631,7 @@ var file_aperture_common_config_v1_config_properties_wrapper_proto_rawDesc = []b 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, 0x9e, 0x01, + 0x66, 0x6c, 0x75, 0x78, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x22, 0xc9, 0x01, 0x0a, 0x11, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x69, 0x66, 0x69, 0x65, 0x72, 0x57, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x12, 0x47, 0x0a, 0x0a, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x69, 0x66, 0x69, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x61, 0x70, 0x65, 0x72, 0x74, 0x75, @@ -632,96 +641,99 @@ var file_aperture_common_config_v1_config_properties_wrapper_proto_rawDesc = []b 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, 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, + 0x28, 0x09, 0x52, 0x0a, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x48, 0x61, 0x73, 0x68, 0x12, 0x29, + 0x0a, 0x10, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x69, 0x66, 0x69, 0x65, 0x72, 0x5f, 0x69, 0x6e, 0x64, + 0x65, 0x78, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0f, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x69, + 0x66, 0x69, 0x65, 0x72, 0x49, 0x6e, 0x64, 0x65, 0x78, 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, 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, + 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 ( diff --git a/api/gen/proto/go/aperture/common/config/v1/config_properties_wrapper.pb.json.go b/api/gen/proto/go/aperture/common/config/v1/config_properties_wrapper.pb.json.go index be3a44b24e..79f119edf6 100644 --- a/api/gen/proto/go/aperture/common/config/v1/config_properties_wrapper.pb.json.go +++ b/api/gen/proto/go/aperture/common/config/v1/config_properties_wrapper.pb.json.go @@ -43,7 +43,7 @@ func (msg *FluxMeterWrapper) UnmarshalJSON(b []byte) error { func (msg *ClassifierWrapper) MarshalJSON() ([]byte, error) { return protojson.MarshalOptions{ UseEnumNumbers: false, - EmitUnpopulated: true, + EmitUnpopulated: false, UseProtoNames: true, }.Marshal(msg) } diff --git a/api/gen/proto/go/aperture/common/config/v1/config_properties_wrapper_deepcopy.gen.go b/api/gen/proto/go/aperture/common/config/v1/config_properties_wrapper_deepcopy.gen.go index 63d041793c..143dd6fcef 100644 --- a/api/gen/proto/go/aperture/common/config/v1/config_properties_wrapper_deepcopy.gen.go +++ b/api/gen/proto/go/aperture/common/config/v1/config_properties_wrapper_deepcopy.gen.go @@ -47,6 +47,27 @@ func (in *FluxMeterWrapper) DeepCopyInterface() interface{} { return in.DeepCopy() } +// DeepCopyInto supports using ClassifierWrapper within kubernetes types, where deepcopy-gen is used. +func (in *ClassifierWrapper) DeepCopyInto(out *ClassifierWrapper) { + p := proto.Clone(in).(*ClassifierWrapper) + *out = *p +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClassifierWrapper. Required by controller-gen. +func (in *ClassifierWrapper) DeepCopy() *ClassifierWrapper { + if in == nil { + return nil + } + out := new(ClassifierWrapper) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInterface is an autogenerated deepcopy function, copying the receiver, creating a new ClassifierWrapper. Required by controller-gen. +func (in *ClassifierWrapper) DeepCopyInterface() interface{} { + return in.DeepCopy() +} + // DeepCopyInto supports using ConcurrencyLimiterWrapper within kubernetes types, where deepcopy-gen is used. func (in *ConcurrencyLimiterWrapper) DeepCopyInto(out *ConcurrencyLimiterWrapper) { p := proto.Clone(in).(*ConcurrencyLimiterWrapper) diff --git a/api/gen/proto/go/aperture/flowcontrol/v1/flowcontrol.pb.go b/api/gen/proto/go/aperture/flowcontrol/v1/flowcontrol.pb.go index 15814fdfd8..87c790ce02 100644 --- a/api/gen/proto/go/aperture/flowcontrol/v1/flowcontrol.pb.go +++ b/api/gen/proto/go/aperture/flowcontrol/v1/flowcontrol.pb.go @@ -588,8 +588,9 @@ type Classifier struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - PolicyName string `protobuf:"bytes,1,opt,name=policy_name,json=policyName,proto3" json:"policy_name,omitempty"` - PolicyHash string `protobuf:"bytes,2,opt,name=policy_hash,json=policyHash,proto3" json:"policy_hash,omitempty"` + PolicyName string `protobuf:"bytes,1,opt,name=policy_name,json=policyName,proto3" json:"policy_name,omitempty"` + PolicyHash string `protobuf:"bytes,2,opt,name=policy_hash,json=policyHash,proto3" json:"policy_hash,omitempty"` + ClassifierIndex int64 `protobuf:"varint,3,opt,name=classifier_index,json=classifierIndex,proto3" json:"classifier_index,omitempty"` } func (x *Classifier) Reset() { @@ -638,6 +639,13 @@ func (x *Classifier) GetPolicyHash() string { return "" } +func (x *Classifier) GetClassifierIndex() int64 { + if x != nil { + return x.ClassifierIndex + } + return 0 +} + type LimiterDecision_RateLimiter struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -862,42 +870,45 @@ var file_aperture_flowcontrol_v1_flowcontrol_proto_rawDesc = []byte{ 0x74, 0x61, 0x69, 0x6c, 0x73, 0x22, 0x33, 0x0a, 0x09, 0x46, 0x6c, 0x75, 0x78, 0x4d, 0x65, 0x74, 0x65, 0x72, 0x12, 0x26, 0x0a, 0x0f, 0x66, 0x6c, 0x75, 0x78, 0x5f, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x66, 0x6c, 0x75, - 0x78, 0x4d, 0x65, 0x74, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x22, 0x4e, 0x0a, 0x0a, 0x43, 0x6c, + 0x78, 0x4d, 0x65, 0x74, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x22, 0x79, 0x0a, 0x0a, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x69, 0x66, 0x69, 0x65, 0x72, 0x12, 0x1f, 0x0a, 0x0b, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 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, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, - 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x48, 0x61, 0x73, 0x68, 0x2a, 0x65, 0x0a, 0x0c, 0x44, 0x65, - 0x63, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1d, 0x0a, 0x19, 0x44, 0x45, - 0x43, 0x49, 0x53, 0x49, 0x4f, 0x4e, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, - 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x1a, 0x0a, 0x16, 0x44, 0x45, 0x43, - 0x49, 0x53, 0x49, 0x4f, 0x4e, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x41, 0x43, 0x43, 0x45, 0x50, - 0x54, 0x45, 0x44, 0x10, 0x01, 0x12, 0x1a, 0x0a, 0x16, 0x44, 0x45, 0x43, 0x49, 0x53, 0x49, 0x4f, - 0x4e, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x52, 0x45, 0x4a, 0x45, 0x43, 0x54, 0x45, 0x44, 0x10, - 0x02, 0x32, 0x6e, 0x0a, 0x12, 0x46, 0x6c, 0x6f, 0x77, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, - 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x58, 0x0a, 0x05, 0x43, 0x68, 0x65, 0x63, 0x6b, - 0x12, 0x25, 0x2e, 0x61, 0x70, 0x65, 0x72, 0x74, 0x75, 0x72, 0x65, 0x2e, 0x66, 0x6c, 0x6f, 0x77, - 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x26, 0x2e, 0x61, 0x70, 0x65, 0x72, 0x74, 0x75, - 0x72, 0x65, 0x2e, 0x66, 0x6c, 0x6f, 0x77, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x2e, 0x76, - 0x31, 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, - 0x00, 0x42, 0x83, 0x02, 0x0a, 0x1b, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x70, 0x65, 0x72, 0x74, 0x75, - 0x72, 0x65, 0x2e, 0x66, 0x6c, 0x6f, 0x77, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x2e, 0x76, - 0x31, 0x42, 0x10, 0x46, 0x6c, 0x6f, 0x77, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x50, 0x72, - 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x54, 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, 0x66, - 0x6c, 0x6f, 0x77, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x2f, 0x76, 0x31, 0x3b, 0x66, 0x6c, - 0x6f, 0x77, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x41, 0x46, - 0x58, 0xaa, 0x02, 0x17, 0x41, 0x70, 0x65, 0x72, 0x74, 0x75, 0x72, 0x65, 0x2e, 0x46, 0x6c, 0x6f, - 0x77, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x17, 0x41, 0x70, - 0x65, 0x72, 0x74, 0x75, 0x72, 0x65, 0x5c, 0x46, 0x6c, 0x6f, 0x77, 0x63, 0x6f, 0x6e, 0x74, 0x72, - 0x6f, 0x6c, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x23, 0x41, 0x70, 0x65, 0x72, 0x74, 0x75, 0x72, 0x65, - 0x5c, 0x46, 0x6c, 0x6f, 0x77, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x5c, 0x56, 0x31, 0x5c, - 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x19, 0x41, 0x70, - 0x65, 0x72, 0x74, 0x75, 0x72, 0x65, 0x3a, 0x3a, 0x46, 0x6c, 0x6f, 0x77, 0x63, 0x6f, 0x6e, 0x74, - 0x72, 0x6f, 0x6c, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x48, 0x61, 0x73, 0x68, 0x12, 0x29, 0x0a, 0x10, 0x63, 0x6c, + 0x61, 0x73, 0x73, 0x69, 0x66, 0x69, 0x65, 0x72, 0x5f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x03, 0x52, 0x0f, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x69, 0x66, 0x69, 0x65, 0x72, + 0x49, 0x6e, 0x64, 0x65, 0x78, 0x2a, 0x65, 0x0a, 0x0c, 0x44, 0x65, 0x63, 0x69, 0x73, 0x69, 0x6f, + 0x6e, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1d, 0x0a, 0x19, 0x44, 0x45, 0x43, 0x49, 0x53, 0x49, 0x4f, + 0x4e, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, + 0x45, 0x44, 0x10, 0x00, 0x12, 0x1a, 0x0a, 0x16, 0x44, 0x45, 0x43, 0x49, 0x53, 0x49, 0x4f, 0x4e, + 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x41, 0x43, 0x43, 0x45, 0x50, 0x54, 0x45, 0x44, 0x10, 0x01, + 0x12, 0x1a, 0x0a, 0x16, 0x44, 0x45, 0x43, 0x49, 0x53, 0x49, 0x4f, 0x4e, 0x5f, 0x54, 0x59, 0x50, + 0x45, 0x5f, 0x52, 0x45, 0x4a, 0x45, 0x43, 0x54, 0x45, 0x44, 0x10, 0x02, 0x32, 0x6e, 0x0a, 0x12, + 0x46, 0x6c, 0x6f, 0x77, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x53, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x12, 0x58, 0x0a, 0x05, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x12, 0x25, 0x2e, 0x61, 0x70, + 0x65, 0x72, 0x74, 0x75, 0x72, 0x65, 0x2e, 0x66, 0x6c, 0x6f, 0x77, 0x63, 0x6f, 0x6e, 0x74, 0x72, + 0x6f, 0x6c, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x26, 0x2e, 0x61, 0x70, 0x65, 0x72, 0x74, 0x75, 0x72, 0x65, 0x2e, 0x66, 0x6c, + 0x6f, 0x77, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x68, 0x65, + 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x83, 0x02, 0x0a, + 0x1b, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x70, 0x65, 0x72, 0x74, 0x75, 0x72, 0x65, 0x2e, 0x66, 0x6c, + 0x6f, 0x77, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x2e, 0x76, 0x31, 0x42, 0x10, 0x46, 0x6c, + 0x6f, 0x77, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, + 0x5a, 0x54, 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, 0x66, 0x6c, 0x6f, 0x77, 0x63, 0x6f, + 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x2f, 0x76, 0x31, 0x3b, 0x66, 0x6c, 0x6f, 0x77, 0x63, 0x6f, 0x6e, + 0x74, 0x72, 0x6f, 0x6c, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x41, 0x46, 0x58, 0xaa, 0x02, 0x17, 0x41, + 0x70, 0x65, 0x72, 0x74, 0x75, 0x72, 0x65, 0x2e, 0x46, 0x6c, 0x6f, 0x77, 0x63, 0x6f, 0x6e, 0x74, + 0x72, 0x6f, 0x6c, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x17, 0x41, 0x70, 0x65, 0x72, 0x74, 0x75, 0x72, + 0x65, 0x5c, 0x46, 0x6c, 0x6f, 0x77, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x5c, 0x56, 0x31, + 0xe2, 0x02, 0x23, 0x41, 0x70, 0x65, 0x72, 0x74, 0x75, 0x72, 0x65, 0x5c, 0x46, 0x6c, 0x6f, 0x77, + 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, + 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x19, 0x41, 0x70, 0x65, 0x72, 0x74, 0x75, 0x72, + 0x65, 0x3a, 0x3a, 0x46, 0x6c, 0x6f, 0x77, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x3a, 0x3a, + 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/api/gen/proto/go/aperture/flowcontrol/v1/flowcontrol.pb.json.go b/api/gen/proto/go/aperture/flowcontrol/v1/flowcontrol.pb.json.go index a667de33de..0ccd24cbda 100644 --- a/api/gen/proto/go/aperture/flowcontrol/v1/flowcontrol.pb.json.go +++ b/api/gen/proto/go/aperture/flowcontrol/v1/flowcontrol.pb.json.go @@ -123,7 +123,7 @@ func (msg *FluxMeter) UnmarshalJSON(b []byte) error { func (msg *Classifier) MarshalJSON() ([]byte, error) { return protojson.MarshalOptions{ UseEnumNumbers: false, - EmitUnpopulated: true, + EmitUnpopulated: false, UseProtoNames: true, }.Marshal(msg) } diff --git a/api/gen/proto/go/aperture/flowcontrol/v1/flowcontrol_deepcopy.gen.go b/api/gen/proto/go/aperture/flowcontrol/v1/flowcontrol_deepcopy.gen.go index fde019d580..3b637ed052 100644 --- a/api/gen/proto/go/aperture/flowcontrol/v1/flowcontrol_deepcopy.gen.go +++ b/api/gen/proto/go/aperture/flowcontrol/v1/flowcontrol_deepcopy.gen.go @@ -151,3 +151,24 @@ func (in *FluxMeter) DeepCopy() *FluxMeter { func (in *FluxMeter) DeepCopyInterface() interface{} { return in.DeepCopy() } + +// DeepCopyInto supports using Classifier within kubernetes types, where deepcopy-gen is used. +func (in *Classifier) DeepCopyInto(out *Classifier) { + p := proto.Clone(in).(*Classifier) + *out = *p +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Classifier. Required by controller-gen. +func (in *Classifier) DeepCopy() *Classifier { + if in == nil { + return nil + } + out := new(Classifier) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInterface is an autogenerated deepcopy function, copying the receiver, creating a new Classifier. Required by controller-gen. +func (in *Classifier) DeepCopyInterface() interface{} { + return in.DeepCopy() +} diff --git a/docs/gen/policies/gen.yaml b/docs/gen/policies/gen.yaml index e8a3da8ebd..92e9f3dbfb 100644 --- a/docs/gen/policies/gen.yaml +++ b/docs/gen/policies/gen.yaml @@ -207,6 +207,39 @@ definitions: x-go-validate: required x-order: 5 $ref: '#/definitions/v1Selector' + policylanguagev1Classifier: + description: |- + :::info + See also [Classifier overview](/concepts/flow-control/label/classifier.md). + ::: + + Example: + ```yaml + selector: + service: service1.default.svc.cluster.local + control_point: + traffic: ingress + rules: + user: + extractor: + from: request.http.headers.user + ``` + type: object + title: Set of classification rules sharing a common selector + properties: + rules: + description: |- + A map of {key, value} pairs mapping from + [flow label](/concepts/flow-control/label/label.md) keys to rules that define + how to extract and propagate flow labels with that key. + type: object + additionalProperties: + $ref: '#/definitions/v1Rule' + x-order: 0 + selector: + description: Defines where to apply the flow classification rule. + x-order: 1 + $ref: '#/definitions/v1Selector' policylanguagev1FluxMeter: description: |- FluxMeter gathers metrics for the traffic that matches its selector. @@ -341,39 +374,6 @@ definitions: type: string x-go-default: 0.5s x-order: 1 - v1Classifier: - description: |- - :::info - See also [Classifier overview](/concepts/flow-control/label/classifier.md). - ::: - - Example: - ```yaml - selector: - service: service1.default.svc.cluster.local - control_point: - traffic: ingress - rules: - user: - extractor: - from: request.http.headers.user - ``` - type: object - title: Set of classification rules sharing a common selector - properties: - rules: - description: |- - A map of {key, value} pairs mapping from - [flow label](/concepts/flow-control/label/label.md) keys to rules that define - how to extract and propagate flow labels with that key. - type: object - additionalProperties: - $ref: '#/definitions/v1Rule' - x-order: 0 - selector: - description: Defines where to apply the flow classification rule. - x-order: 1 - $ref: '#/definitions/v1Selector' v1Component: description: |- Signals flow into the components via input ports and results are emitted on output ports. @@ -1263,7 +1263,7 @@ definitions: The flow labels created by Classifiers can be matched by FluxMeters to create metrics for control purposes. type: array items: - $ref: '#/definitions/v1Classifier' + $ref: '#/definitions/policylanguagev1Classifier' x-order: 0 flux_meters: description: |- diff --git a/docs/gen/policies/policy.md b/docs/gen/policies/policy.md index cb0b764ef6..e9e35fbb90 100644 --- a/docs/gen/policies/policy.md +++ b/docs/gen/policies/policy.md @@ -18,6 +18,7 @@ - [SchedulerWorkloadAndLabelMatcher](#scheduler-workload-and-label-matcher) - [languagev1ConcurrencyLimiter](#languagev1-concurrency-limiter) – Concurrency Limiter is an actuator component that regulates flows in order to provide active service protection - [languagev1RateLimiter](#languagev1-rate-limiter) – Limits the traffic on a control point to specified rate +- [policylanguagev1Classifier](#policylanguagev1-classifier) – Set of classification rules sharing a common selector - [policylanguagev1FluxMeter](#policylanguagev1-flux-meter) – FluxMeter gathers metrics for the traffic that matches its selector. Example of… @@ -27,7 +28,6 @@ Example of… - [v1ArithmeticCombinatorIns](#v1-arithmetic-combinator-ins) – Inputs for the Arithmetic Combinator component. - [v1ArithmeticCombinatorOuts](#v1-arithmetic-combinator-outs) – Outputs for the Arithmetic Combinator component. - [v1Circuit](#v1-circuit) – Circuit is defined as a dataflow graph of inter-connected components -- [v1Classifier](#v1-classifier) – Set of classification rules sharing a common selector - [v1Component](#v1-component) – Computational block that form the circuit - [v1Constant](#v1-constant) – Component that emits a constant value as an output signal - [v1ConstantOuts](#v1-constant-outs) – Outputs for the Constant component. @@ -354,6 +354,48 @@ TODO make it possible for this field to be optional – to achieve global rateli +### policylanguagev1Classifier + +Set of classification rules sharing a common selector + +:::info +See also [Classifier overview](/concepts/flow-control/label/classifier.md). +::: + +Example: + +```yaml +selector: + service: service1.default.svc.cluster.local + control_point: + traffic: ingress +rules: + user: + extractor: + from: request.http.headers.user +``` + +#### Properties + +
+
rules
+
+ +(map of [V1Rule](#v1-rule)) A map of {key, value} pairs mapping from +[flow label](/concepts/flow-control/label/label.md) keys to rules that define +how to extract and propagate flow labels with that key. + +
+
+
+
selector
+
+ +([V1Selector](#v1-selector)) Defines where to apply the flow classification rule. + +
+
+ ### policylanguagev1FluxMeter FluxMeter gathers metrics for the traffic that matches its selector. @@ -538,48 +580,6 @@ This interval is typically aligned with how often the corrective action (actuati -### v1Classifier - -Set of classification rules sharing a common selector - -:::info -See also [Classifier overview](/concepts/flow-control/label/classifier.md). -::: - -Example: - -```yaml -selector: - service: service1.default.svc.cluster.local - control_point: - traffic: ingress -rules: - user: - extractor: - from: request.http.headers.user -``` - -#### Properties - -
-
rules
-
- -(map of [V1Rule](#v1-rule)) A map of {key, value} pairs mapping from -[flow label](/concepts/flow-control/label/label.md) keys to rules that define -how to extract and propagate flow labels with that key. - -
-
-
-
selector
-
- -([V1Selector](#v1-selector)) Defines where to apply the flow classification rule. - -
-
- ### v1Component Computational block that form the circuit @@ -1894,7 +1894,7 @@ Resources are typically FluxMeters, Classifiers, etc. that can be used to create
classifiers
-([[]V1Classifier](#v1-classifier)) Classifiers are installed in the data-plane and are used to label the requests based on payload content. +([[]Policylanguagev1Classifier](#policylanguagev1-classifier)) Classifiers are installed in the data-plane and are used to label the requests based on payload content. The flow labels created by Classifiers can be matched by FluxMeters to create metrics for control purposes. diff --git a/libsonnet/1.0/_gen/v1/gen.libsonnet b/libsonnet/1.0/_gen/v1/gen.libsonnet index 2fc0e93d49..326df5f0cb 100644 --- a/libsonnet/1.0/_gen/v1/gen.libsonnet +++ b/libsonnet/1.0/_gen/v1/gen.libsonnet @@ -7,13 +7,13 @@ SchedulerWorkloadAndLabelMatcher: import 'schedulerworkloadandlabelmatcher.libsonnet', languagev1ConcurrencyLimiter: import 'languagev1concurrencylimiter.libsonnet', languagev1RateLimiter: import 'languagev1ratelimiter.libsonnet', + policylanguagev1Classifier: import 'policylanguagev1classifier.libsonnet', policylanguagev1FluxMeter: import 'policylanguagev1fluxmeter.libsonnet', AddressExtractor: import 'addressextractor.libsonnet', ArithmeticCombinator: import 'arithmeticcombinator.libsonnet', ArithmeticCombinatorIns: import 'arithmeticcombinatorins.libsonnet', ArithmeticCombinatorOuts: import 'arithmeticcombinatorouts.libsonnet', Circuit: import 'circuit.libsonnet', - Classifier: import 'classifier.libsonnet', Component: import 'component.libsonnet', Constant: import 'constant.libsonnet', ConstantOuts: import 'constantouts.libsonnet', diff --git a/libsonnet/1.0/_gen/v1/classifier.libsonnet b/libsonnet/1.0/_gen/v1/policylanguagev1classifier.libsonnet similarity index 100% rename from libsonnet/1.0/_gen/v1/classifier.libsonnet rename to libsonnet/1.0/_gen/v1/policylanguagev1classifier.libsonnet diff --git a/pkg/metrics/schema.go b/pkg/metrics/schema.go index fa1f0b6344..ceb6a9801a 100644 --- a/pkg/metrics/schema.go +++ b/pkg/metrics/schema.go @@ -60,6 +60,8 @@ const ( SignalNameLabel = "signal_name" // FluxMeterNameLabel - specifying flux meter's name. FluxMeterNameLabel = "flux_meter_name" + // ClassifierIndexLabel - prometheus label specifying clasiffier index. + ClassifierIndexLabel = "classifier_index" // StatusCodeLabel - http status code. StatusCodeLabel = "status_code" // FeatureStatusLabel - feature status. diff --git a/pkg/otelcollector/consts.go b/pkg/otelcollector/consts.go index 68c104c17e..6a7fb2a0fa 100644 --- a/pkg/otelcollector/consts.go +++ b/pkg/otelcollector/consts.go @@ -67,6 +67,8 @@ const ( FluxMetersLabel = "flux_meters" // FlowLabelKeysLabel describes keys of flow labels matched to the traffic. FlowLabelKeysLabel = "flow_label_keys" + // ClassifiersLabel describes classifiers matched to the traffic. + ClassifiersLabel = "classifiers" // HostAddressLabel describes host address of the request. HostAddressLabel = "net.host.address" // PeerAddressLabel describes peer address of the request. diff --git a/pkg/otelcollector/metricsprocessor/processor.go b/pkg/otelcollector/metricsprocessor/processor.go index 36b9760c71..ae92d81e82 100644 --- a/pkg/otelcollector/metricsprocessor/processor.go +++ b/pkg/otelcollector/metricsprocessor/processor.go @@ -143,6 +143,8 @@ func (p *metricsProcessor) addAuthzResponseBasedLabels(attributes pcommon.Map, a // * `concurrency_limiters` // * `dropping_concurrency_limiters` // * `flux_meters`. +// * `flow_label_keys`. +// * `classifiers`. func (p *metricsProcessor) addCheckResponseBasedLabels(attributes pcommon.Map, checkResponse *flowcontrolv1.CheckResponse) { labels := map[string]pcommon.Value{ otelcollector.RateLimitersLabel: pcommon.NewValueSlice(), @@ -151,6 +153,7 @@ func (p *metricsProcessor) addCheckResponseBasedLabels(attributes pcommon.Map, c otelcollector.DroppingConcurrencyLimitersLabel: pcommon.NewValueSlice(), otelcollector.FluxMetersLabel: pcommon.NewValueSlice(), otelcollector.FlowLabelKeysLabel: pcommon.NewValueSlice(), + otelcollector.ClassifiersLabel: pcommon.NewValueSlice(), otelcollector.DecisionTypeLabel: pcommon.NewValueString(checkResponse.DecisionType.String()), otelcollector.DecisionRejectReasonLabel: pcommon.NewValueString(""), otelcollector.DecisionErrorReasonLabel: pcommon.NewValueString(""), @@ -198,6 +201,15 @@ func (p *metricsProcessor) addCheckResponseBasedLabels(attributes pcommon.Map, c labels[otelcollector.FlowLabelKeysLabel].SliceVal().AppendEmpty().SetStringVal(flowLabelKey) } + for _, classifier := range checkResponse.Classifiers { + rawValue := []string{ + fmt.Sprintf("%s:%v", metrics.PolicyNameLabel, classifier.PolicyName), + fmt.Sprintf("%s:%v", metrics.ClassifierIndexLabel, classifier.ClassifierIndex), + } + value := strings.Join(rawValue, ",") + labels[otelcollector.ClassifiersLabel].SliceVal().AppendEmpty().SetStringVal(value) + } + for key, value := range labels { attributes.Insert(key, value) } diff --git a/pkg/policies/controlplane/resources/classifier/classifier.go b/pkg/policies/controlplane/resources/classifier/classifier.go index 5c695028c9..8d7ecd292b 100644 --- a/pkg/policies/controlplane/resources/classifier/classifier.go +++ b/pkg/policies/controlplane/resources/classifier/classifier.go @@ -57,9 +57,10 @@ func (configSync *classifierConfigSync) doSync(etcdClient *etcdclient.Client, li lifecycle.Append(fx.Hook{ OnStart: func(ctx context.Context) error { wrapper := &configv1.ClassifierWrapper{ - PolicyName: configSync.policyBaseAPI.GetPolicyName(), - PolicyHash: configSync.policyBaseAPI.GetPolicyHash(), - Classifier: configSync.classifierProto, + PolicyName: configSync.policyBaseAPI.GetPolicyName(), + PolicyHash: configSync.policyBaseAPI.GetPolicyHash(), + ClassifierIndex: configSync.classifierIndex, + Classifier: configSync.classifierProto, } dat, err := proto.Marshal(wrapper) if err != nil { diff --git a/pkg/policies/dataplane/engine.go b/pkg/policies/dataplane/engine.go index 0cdbd32599..b544fe0055 100644 --- a/pkg/policies/dataplane/engine.go +++ b/pkg/policies/dataplane/engine.go @@ -81,8 +81,9 @@ func (e *Engine) ProcessRequest(controlPoint selectors.ControlPoint, serviceIDs classifierProtos := make([]*flowcontrolv1.Classifier, len(classifiers)) for i, classifier := range classifiers { classifierProtos[i] = &flowcontrolv1.Classifier{ - PolicyName: classifier.GetClassifierID().PolicyName, - PolicyHash: classifier.GetClassifierID().PolicyHash, + PolicyName: classifier.GetClassifierID().PolicyName, + PolicyHash: classifier.GetClassifierID().PolicyHash, + ClassifierIndex: classifier.GetClassifierID().ClassifierIndex, } } response.Classifiers = classifierProtos diff --git a/pkg/policies/dataplane/iface/classifier.go b/pkg/policies/dataplane/iface/classifier.go index 2aa82423db..2a19bb24b8 100644 --- a/pkg/policies/dataplane/iface/classifier.go +++ b/pkg/policies/dataplane/iface/classifier.go @@ -1,16 +1,21 @@ package iface -import selectorv1 "github.com/fluxninja/aperture/api/gen/proto/go/aperture/common/selector/v1" +import ( + "fmt" + + selectorv1 "github.com/fluxninja/aperture/api/gen/proto/go/aperture/common/selector/v1" +) // ClassifierID is the ID of the Classifier. type ClassifierID struct { - PolicyName string - PolicyHash string + PolicyName string + PolicyHash string + ClassifierIndex int64 } // String function returns the ClassifierID as a string. func (cID ClassifierID) String() string { - return "policy_name-" + cID.PolicyName + "-policy_hash-" + cID.PolicyHash + return fmt.Sprintf("policy_name-%s-policy_hash-%s-%d", cID.PolicyName, cID.PolicyHash, cID.ClassifierIndex) } // Classifier interface. diff --git a/pkg/policies/dataplane/resources/classifier/classifier.go b/pkg/policies/dataplane/resources/classifier/classifier.go index ab78fc0a89..d18bb870ae 100644 --- a/pkg/policies/dataplane/resources/classifier/classifier.go +++ b/pkg/policies/dataplane/resources/classifier/classifier.go @@ -72,6 +72,7 @@ type Classifier struct { classifierProto *classificationv1.Classifier policyName string policyHash string + classifierIndex int64 } type rulesetID = uint64 @@ -281,8 +282,9 @@ func (c *Classifier) GetSelector() *selectorv1.Selector { // GetClassifierID returns ClassifierID object that should uniquely identify classifier. func (c *Classifier) GetClassifierID() iface.ClassifierID { return iface.ClassifierID{ - PolicyName: c.policyName, - PolicyHash: c.policyHash, + PolicyName: c.policyName, + PolicyHash: c.policyHash, + ClassifierIndex: c.classifierIndex, } } diff --git a/pkg/policies/dataplane/resources/classifier/provide.go b/pkg/policies/dataplane/resources/classifier/provide.go index 76011083ef..79abe96c4f 100644 --- a/pkg/policies/dataplane/resources/classifier/provide.go +++ b/pkg/policies/dataplane/resources/classifier/provide.go @@ -126,7 +126,7 @@ func invokeMiniApp( classifier.classifierProto = rs classifier.policyName = wrapperMessage.PolicyName classifier.policyHash = wrapperMessage.PolicyHash - + classifier.classifierIndex = wrapperMessage.ClassifierIndex lc.Append( fx.Hook{ OnStart: func(startCtx context.Context) error {