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

New TrafficRoute design #4743

Closed
lahabana opened this issue Aug 2, 2022 · 2 comments · Fixed by #5337
Closed

New TrafficRoute design #4743

lahabana opened this issue Aug 2, 2022 · 2 comments · Fixed by #5337
Assignees
Labels
kind/design Design doc or related kind/feature New feature triage/accepted The issue was reviewed and is complete enough to start working on it

Comments

@lahabana lahabana added triage/accepted The issue was reviewed and is complete enough to start working on it kind/feature New feature kind/design Design doc or related labels Aug 2, 2022
@lahabana
Copy link
Contributor Author

lahabana commented Aug 3, 2022

We could go with something very similar to GatewayAPI routes because it handles well filters, destinations, split and mirrors.
If that's a the case we'd have different policies per protocol (probably fine).

https://gateway-api.sigs.k8s.io/references/spec/#gateway.networking.k8s.io/v1alpha2.HTTPRoute

Some open questions:

  • How do you set LoadBalancer config in the route (a filter would be weird)? Maybe that's something for gatewayAPI improvement?
  • Same question with LocalityAwareLB.

@michaelbeaumont
Copy link
Contributor

michaelbeaumont commented Nov 14, 2022

This is a summary of the current status and open questions.

  • MeshTrafficRoute refers to a new, targetRef-based TrafficRoute.

MeshTrafficRoute

We can imagine an evolution of TrafficRoute using targetRef:

spec:
  targetRef: ... # from where requests are coming
  to:
    - targetRef: ... # to where requests are going
  default: ...

Routes are implemented in the client-side config so we would use spec.targetRef for the request source plus spec.to, as opposed to spec.from/spec.targetRef.

MeshGatewayRoute

Conceptually, a MeshGateway proxy is a service like any other that sits at the edge of our mesh.

The use cases for routing and modifying requests coming from MeshGateways to services and services to services are presumably the same, so we can certainly come up with a spec that covers both and MeshTrafficRoute could eventually subsume MeshGatewayRoute.

We can target a MeshGateway using a MeshTrafficRoute:

spec:
  targetRef:
    kind: MeshService
    name: # the configured kuma.io/service of the MeshGateway
    # or 
    kind: MeshGateway
    name: edge-gateway  
  to:
    - targetRef: ...
  default: ...

Gateway API's HTTPRoute

The Gamma initiative is the working group looking at Gateway API for mesh use cases. If we want to support using upstream HTTPRoute for mesh communication we should try to be conformant with the Gamma spec.

Request/response modification

All request/response modification via HTTPRoute is done with HTTPRoute.spec.rules[].filters.

HTTPRoute includes some common filters like header and path modification.

Any Kuma-specific filter can be configured by setting HTTPRouteFilterType to ExtensionRef and pointing extensionRef to a Kuma resource. This would allow us to support any arbitrary modifications using Gateway API.

parentRef/service targeting

Gamma proposes using an HTTPRoute parentRef of Service to configure routing for requests sent to that Service.

Unfortunately this presents a fundamental incompatibility at the moment with how we would implement MeshTrafficRoute as a targetRef policy. The incompatibility is that there's no way to specify a reference from which Kuma service a request should come for an HTTPRoute. I.e., HTTPRoute is not as powerful as MeshTrafficRoute in terms of targeting the source of a request.

There is currently an open PR for using the Namespace of the HTTPRoute for this purpose. Still, it wouldn't be as powerful as a targetRef-based policy.

Other config

HTTPRoute provides only matches, filters and backendRefs. There is also backendRefs.filters for backend-specific filtering.

There is no other extension point for HTTPRoute than filters so any additional configuration, such as load balancer options must appear under filters.

The name filters is perhaps confusing for something like load balancing configuration but with ExtensionRef it is powerful, flexible and extensible enough to support any arbitrary routing configuration. It doesn't really assume anything about the referenced resource.

It would allow us to apply load balancing for the entire route, for a subset of requests with matches as well as for a subset of backendRefs. For example, to use round robin for all requests.

spec:
  ...
  rules:
    - matches: []
      filters:
        - type: ExtensionRef
          extensionRef:
            group: kuma.io/v1alpha1
            kind: RouteConfig
            name: load-balancer-common
            # potential inlined load-balancer-common:
            # spec:
            #   loadBalancer: RoundRobin
      backendRefs: []

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/design Design doc or related kind/feature New feature triage/accepted The issue was reviewed and is complete enough to start working on it
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants