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

docs(MADR): MeshTCPRoute proposal #6711

Merged
merged 20 commits into from
May 17, 2023
Merged
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
8ea56b8
docs(MeshTCPRoute): add initial policy MADR
bartsmykla May 9, 2023
8091171
madr(MeshTCPRoute): add goals/non-goals sections
bartsmykla May 10, 2023
8c580df
Merge branch 'master' of github.com:kumahq/kuma into docs/meshtcprout…
bartsmykla May 10, 2023
3be5907
madr(MeshTCPRoute): fix MADR numeration
bartsmykla May 10, 2023
3ff589c
Merge remote-tracking branch 'upstream' into docs/meshtcproute-madr
bartsmykla May 10, 2023
6621866
docs(madrs): add MeshGatewayTCPRoute as non-goal
bartsmykla May 10, 2023
5262b83
Fix small typo: "te" -> "the"
bartsmykla May 11, 2023
2f31cab
docs(madr): make api more consistent with GAPI
bartsmykla May 11, 2023
48692c2
Merge remote-tracking branch 'upstream' into docs/meshtcproute-madr
bartsmykla May 11, 2023
e4621d8
docs: add section of route policies precedence
bartsmykla May 13, 2023
154ffe9
Merge remote-tracking branch 'upstream' into docs/meshtcproute-madr
bartsmykla May 13, 2023
0296a66
docs: add missing work in the precedence header
bartsmykla May 13, 2023
a06c813
docs: change "clashes" section
bartsmykla May 16, 2023
36c4893
Merge remote-tracking branch 'upstream' into docs/meshtcproute-madr
bartsmykla May 16, 2023
8399bf7
Merge remote-tracking branch 'upstream' into docs/meshtcproute-madr
bartsmykla May 16, 2023
0e059cf
Merge remote-tracking branch 'upstream' into docs/meshtcproute-madr
bartsmykla May 17, 2023
85f4e80
docs: update route policies clash section
bartsmykla May 17, 2023
09a1b6d
Update docs/madr/decisions/026-mesh-tcp-route.md
bartsmykla May 17, 2023
113de25
docs: explicitly specify tcp traffic
bartsmykla May 17, 2023
dec4ad8
Merge remote-tracking branch 'upstream' into docs/meshtcproute-madr
bartsmykla May 17, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
147 changes: 147 additions & 0 deletions docs/madr/decisions/026-mesh-tcp-route.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
# `MeshTCPRoute`

* Status: accepted

Technical Story: https://github.com/kumahq/kuma/issues/6343

## Context and Problem Statement

Now that we have the [new policy matching resources](./005-policy-matching.md),
[new traffic route designed](https://github.com/kumahq/kuma/issues/4743), and
[basic api of `MeshHTTPRoute`](https://github.com/kumahq/kuma/issues/5470)
implemented, it's time to introduce `MeshTCPRoute`.

### Goals

Policy should allow to
michaelbeaumont marked this conversation as resolved.
Show resolved Hide resolved
* reroute TCP traffic<sup>1</sup> to different versions of a service or even
completely different service;
* split TCP traffic<sup>1</sup> between services with different tags implementing
A/B testing or canary deployments.

<sup>1</sup> TCP traffic includes HTTP, HTTP2 and GRPC traffic if no overlapping
policy with higher specificity applies

### Non-goals

* TCP traffic mirroring

It would be nice for the policy to allow to mirror TCP traffic. Unfortunately
it seems to be a non-trivial task as according to short research, Envoy
doesn't support this case out of the box. If there will be need for
this feature, it should be implemented in the future iterations.

Ref:
* https://github.com/envoyproxy/envoy/issues/18172

* `MeshGatewayTCPRoute`

According to [Traffic Route MADR](./011-mesh-traffic-route.md), every
bartsmykla marked this conversation as resolved.
Show resolved Hide resolved
protocol-related route policy, should be split into two versions - one for
gateway (i.e. `MeshGatewayTCPRoute`) and one for other resources (i.e.
`MeshTCPRoute`).

In case of `MeshTCPRoute` it doesn't make sense to introduce two types of
this policy as the only difference would be the root `targetRef` which in
gateway's case would point to `MeshGateway`. This MADR addresses only
`MeshTCPRoute` and the first implementation should accept non-MeshGateway
root targetRefs only. If there will be consensus to unify `Mesh(.*)Route`
with `MeshGateway(.*)Route`, we'll be able to just implement support for
this targetRef. If not, we can easily introduce `MeshGatewayTCPRoute`.

## Considered Options

* Create a `MeshTCPRoute` policy

## Decision Outcome

Chosen option: Create a `MeshTCPRoute` policy

### `spec.to[].rules`

At this point there is no plan to introduce address matching capabilities for
`MeshTCPRoute` in foreseeable future. We try to be as close with structures of
our policies to the Gateway API as possible. It means, that even if Gateway API
currently doesn't have plans to support this kind of matching as well (ref.
[Kubernetes Gateway API GEP-735: TCP and UDP addresses matching](https://gateway-api.sigs.k8s.io/geps/gep-735/)),
its structures are ready to potentially support it.

As a result every element of the route destination section of the policy
configuration (`spec.to[]`) contains a `rules` property. This property is a list
of elements, which potentially will allow to specify `match` configuration.

Implementation of the `MeshTCPRoute` which should be a result of this document,
should validate that this list will contain only one element. This is due
to the fact, that without specifying `match`es, it would be nonsensical to
accept more `rules.`

### Multiple routes with different types targeting the same destination

If multiple route policies with different types (`MeshTCPRoute`, `MeshHTTPRoute`
etc.) both target the same destination, only a single route type should
be applied.

This decision is dictated by our attempt to be as close as possible to
lobkovilya marked this conversation as resolved.
Show resolved Hide resolved
the Gateway API, which specifies following:

> Route type specificity is defined in the following order (first one wins):
>
> * GRPCRoute
> * HTTPRoute
> * TLSRoute
> * TCPRoute
>
> ref. [Kubernetes Gateway API GEP-1426: xRoutes Mesh Binding](https://gateway-api.sigs.k8s.io/geps/gep-1426/#route-types)

### Traffic Rerouting

If `matches` succeeds, the request is routed to the specified destinations
(similar like in traffic split, but in this case `weight` property can be
omitted)

The destinations appear as references in `backendRefs`.

```yaml
spec:
bartsmykla marked this conversation as resolved.
Show resolved Hide resolved
targetRef:
kind: Mesh|MeshSubset|MeshService|MeshServiceSubset
to:
- targetRef:
kind: MeshService
name: tcp-backend
rules:
- default:
backendRefs:
- kind: MeshService
name: tcp-other-backend
```

### Traffic Split

If `matches` succeeds, the request is routed to the specified weighted
destinations.

The destinations appear as references in `backendRefs`.

```yaml
spec:
targetRef:
kind: Mesh|MeshSubset|MeshService|MeshServiceSubset
to:
- targetRef:
kind: MeshService
name: tcp-backend
rules:
- default:
backendRefs:
- weight: 90
kind: MeshServiceSubset
name: tcp-backend
tags:
version: v2
- weight: 10
kind: MeshServiceSubset
name: tcp-backend
tags:
version: v2
```