Skip to content

Document aggregation keyer rules#110

Draft
jessicayuen wants to merge 1 commit intoenvoyproxy:mainfrom
jessicayuen:docs
Draft

Document aggregation keyer rules#110
jessicayuen wants to merge 1 commit intoenvoyproxy:mainfrom
jessicayuen:docs

Conversation

@jessicayuen
Copy link
Copy Markdown
Member

Signed-off-by: Jess Yuen jyuen@lyft.com

Signed-off-by: Jess Yuen <jyuen@lyft.com>
```
This example specifies that if the DiscoveryRequest type matches LDS or CDS, to generate the first
fragment from the DiscoveryRequest node ID field by performing a regex replace operation using the
pattern: `"^(.*)-*$"`, and replacing it with the first regex group match `"$1"`. More concretely,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: should be "^-(.)-*$"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you also define field here? does that correspond to "$1"?

Copy link
Copy Markdown
Contributor

@eapolinario eapolinario left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's shaping up to be a really nice introduction to aggregation rules.

). A rule defines how to generate a fragment from an xDS [DiscoveryRequest](https://www.envoyproxy.io/docs/envoy/latest/api-v2/api/v2/discovery.proto#discoveryrequest)
. The first matching rule applies, and the rest are ignored.

A rule is formed from a `match` and a `result`. `match` takes a DiscoveryRequest and matches on
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we enclose DiscoveryRequest in backticks? Or maybe link it to the envoy docs (like we're doing in line 39)?

- "type.googleapis.com/envoy.api.v2.Cluster"
result:
request_node_fragment:
field: 1
Copy link
Copy Markdown
Contributor

@eapolinario eapolinario Jul 22, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should clarify what those fields are about. They map to the enum values defined in https://github.com/envoyproxy/xds-relay/blob/master/api/protos/aggregation/v1/aggregation.proto#L35-L41. edit: I saw that we specify the possible values in a section below.

As an aside: now that I read it again, we should find a way to use intelligible names instead of the enum values. Not in this PR obviously. Also, why didn't we name this field type? :-)


#### Match Predicates
xds-relay current support a limited set of match predicates for rules. More will be added in the
future on a as needed basis. Refer to the [API protos](https://github.com/envoyproxy/xds-relay/blob/master/api/protos/aggregation/v1/aggregation.proto)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo: "on an as-needed..."

for the source of truth.

##### `request_type_match`
- Match on the string value of the xDS request type URL.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why use lists in the description?


* [Contributing guide](CONTRIBUTING.md)

## Design
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this supposed to be a TODO?


At a high level, an aggregation rule is formed from `fragments`, `rules`, `match`, and `result`s.

#### Fragments
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why straight to heading level 4?

field: 0
exact_match: "canary"
```

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how about the other types of matches?

for the source of truth.

##### Actions
- Actions can be either a `regex_action` or `exact`. Exact uses the result predicate as is, and
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about we don't use lists? It is a different style than the first sections of this document.

#### Rules
Each `fragment` can have multiple `rule`s ([example](https://github.com/envoyproxy/xds-relay/blob/c83a956952c3e9762a08420ffc1c6bda5e0fff04/integration/testdata/keyer_configuration_e2e.yaml#L28-L52)
). A rule defines how to generate a fragment from an xDS [DiscoveryRequest](https://www.envoyproxy.io/docs/envoy/latest/api-v2/api/v2/discovery.proto#discoveryrequest)
. The first matching rule applies, and the rest are ignored.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is true, i.e. we can have multiple matches in a list of rules. The mapper currently matches fragments for all rules, not only the first one (as this comment implies).

differ greatly between clusters. For example, a service application scaled across 100 hosts will
likely require the same data plane configurations across all hosts.

At a high level, an aggregation rule is formed from `fragments`, `rules`, `match`, and `result`s.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should give a better description of how each one of these 4 components interact. For example, aggregations rules are composed of fragments, and a single fragment is composed of a list of rules where and each rule is composed of a pair composed of a match predicate and a result predicate.

Do you think it's too much to try to specify this using EBNF? It might be, I'm just wondering if having that could alleviate the problem of being total in this document.

@jessicayuen jessicayuen marked this pull request as draft January 4, 2021 19:29
Base automatically changed from master to main January 16, 2021 21:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants