Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add classifiers to flowcontrolv1.CheckResponse #310

Merged
merged 2 commits into from
Sep 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions api/aperture/flowcontrol/v1/flowcontrol.proto
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ message CheckResponse {
repeated FluxMeter flux_meters = 4;
// flow label keys that were matched for this request.
repeated string flow_label_keys = 5;
// classifiers that were matched for this request.
repeated Classifier classifiers = 6;
}

// Reason contains fields that give further information about error or rejection.
Expand Down Expand Up @@ -83,3 +85,10 @@ message LimiterDecision {
message FluxMeter {
string flux_meter_name = 1;
}

// Classifier describes details for each Classifier.
message Classifier {
string policy_name = 1;
string policy_hash = 2;
IridiumOxide marked this conversation as resolved.
Show resolved Hide resolved
int64 classifier_index = 3;
}
12 changes: 12 additions & 0 deletions api/aperture/policy/wrappers/v1/policy.proto
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ syntax = "proto3";

package aperture.policy.wrappers.v1;

import "aperture/policy/language/v1/classifier.proto";
import "aperture/policy/language/v1/fluxmeter.proto";
import "aperture/policy/language/v1/policy.proto";

Expand All @@ -21,6 +22,17 @@ message FluxMeterWrapper {
string fluxmeter_name = 4;
}

message ClassifierWrapper {
// Classifier
policy.language.v1.Classifier classifier = 1;
// Name of the Policy.
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 {
// Concurrency Limiter
policy.language.v1.ConcurrencyLimiter concurrency_limiter = 1;
Expand Down
80 changes: 48 additions & 32 deletions api/gen/openapiv2/aperture.swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,17 @@ definitions:
workload:
$ref: '#/definitions/SchedulerWorkload'
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:
type: string
description: Classifier describes details for each Classifier.
apertureflowcontrolv1FluxMeter:
type: object
properties:
Expand Down Expand Up @@ -351,6 +362,37 @@ definitions:
Ratelimiting is done separately on per-label-value basis. Use _label\_key_
to select which label should be used as key.
title: Limits the traffic on a control point to specified rate
policylanguagev1Classifier:
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
policylanguagev1FluxMeter:
type: object
properties:
Expand Down Expand Up @@ -593,6 +635,11 @@ definitions:
v1CheckResponse:
type: object
properties:
classifiers:
type: array
items:
$ref: '#/definitions/apertureflowcontrolv1Classifier'
description: classifiers that were matched for this request.
decision_reason:
$ref: '#/definitions/v1DecisionReason'
description: reason contains information in the case of an error or rejection.
Expand Down Expand Up @@ -650,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:
Expand Down Expand Up @@ -1605,7 +1621,7 @@ definitions:
classifiers:
type: array
items:
$ref: '#/definitions/v1Classifier'
$ref: '#/definitions/policylanguagev1Classifier'
description: |-
Classifiers are installed in the data-plane and are used to label the requests based on payload content.

Expand Down
Loading