Skip to content

Commit

Permalink
docs: make alt tcp routes an aside
Browse files Browse the repository at this point in the history
  • Loading branch information
shaneutt committed Aug 23, 2021
1 parent 3420bb0 commit c7bb1d6
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions site-src/v1alpha2/guides/tcp.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,6 @@ in order to route them to two separate backend `TCPRoutes`, note that the
{% include 'v1alpha2/basic-tcp.yaml' %}
```

As a note to the above example: while it is possible to use metadata to route
traffic from the `Gateway` to the underlying `TCPRoutes` (see the
`spec.rules[].matches[]extensionRef` field in the [spec][tcproute]) such as is
common for [HTTPRoutes][httproute] the most common use case for making these
routing decisions with `TCPRoutes` is by port.

In the above example we separate the traffic for the two separate backend TCP
[Services][svc] by using the `sectionName` field in the `parentRefs`:

Expand All @@ -49,6 +43,15 @@ In this way each `TCPRoute` "attaches" itself to a different port on the
`Gateway` so that the service `my-foo-service` is taking traffic for port `8080`
from outside the cluster and `my-bar-service` takes the port `8090` traffic.

## Alternatives: TCP Traffic Routing Using Metadata

While in the above examples we mainly focused on routing by port, it is also
possible to use metadata to route traffic from the `Gateway` to the underlying
`TCPRoutes` using `spec.rules[].matches[].extensionRef`.

See the [spec][tcproute] for more details on how to configure alternative logic
for routing TCP traffic beyond just using ports and selecting `listener` names.

[tcproute]:/v1alpha2/v1alpha2/references/spec/#gateway.networking.k8s.io/v1alpha2.TCPRoute
[tcp]:https://datatracker.ietf.org/doc/html/rfc793
[httproute]:/v1alpha2/v1alpha2/references/spec/#gateway.networking.k8s.io/v1alpha2.HTTPRoute
Expand Down

0 comments on commit c7bb1d6

Please sign in to comment.