solo-io / gloo

The Feature-rich, Kubernetes-native, Next-Generation API Gateway Built on Envoy
https://docs.solo.io/
Apache License 2.0
4.09k stars 441 forks source link

Add flag to order routes in envoy based on the "best" path matcher #8171

Open bdecoste opened 1 year ago

bdecoste commented 1 year ago

Version

1.13.x

Is your feature request related to a problem? Please describe.

I do not want to have to manage the ordering of paths in the VirtualServices.

Describe the solution you'd like

I would like to have Gloo create envoy config that has the paths ordered in order of most specific match to least specific path

Describe alternatives you've considered

Manage route ordering in the VSs

Additional Context

No response

SantoDE commented 1 year ago

Story In large teams, multiple members might be working on the same VirtualService. In that case, Gloo Edge should have a way to specify the best patch matcher which is not depending on the order of matchers inside the actual object.

- apiVersion: gateway.solo.io/v1
  kind: VirtualService
  metadata:
    labels:
      app: gloo
      gloo-tier: udc-ordering
    name: order.api.dev.crndev.chick-fil-a.com
    namespace: gloo-system
  spec:
    virtualHost:
      domains:
      - api.example.com
      routes:
      - matchers:
        - prefix: /
        delegateAction:
          ref:
            name: api1
            namespace: gloo-system
      - matchers:
        - prefix: /app/
        delegateAction:
          ref:
            name: api2
            namespace: gloo-system

All requests would be matched by / regardless of the following. It should start matching from the most concrete to the less concrete and not the other way around.

Since this might be a breaking change, we might wanna hide it behind a flag.

nfuden commented 1 year ago

How are users adding these routes? Through a gitops crd update? The docs impact of having this flag is large as it means that you cant for example stage future routes by placing them in a space where they cant get routed to.

Question for a follow up user story: We have two team members one who manages compliance and one who is an app dev member. The app dev team member adds a specific route for their special service. For compliance a second user adds a catch all on a less specific portion of the route. We may give them the false sense / and or no way to prevent the first users route. Alternatively if the compliance route is created first how do we make the app dev user understand that they are subverting an existing route?

Long story short if we need to do something like this does it make sense to have the routes jumbled at rest or can we have something that sorts as part of a glooctl add route flag?

SantoDE commented 1 year ago

Yeah, they are doing it via Yaml Changes (GitOps). I don't fully get your concern about route placing?

As much as I would love a glooctl command here, I don't think it fits the user needs

nfuden commented 1 year ago

We currently perform the following on delegated route tables https://github.com/solo-io/gloo/blob/dcp-cp1/projects/gloo/pkg/utils/sort_routes.go#L21 how does that differ from "best"

github-actions[bot] commented 4 months ago

This issue has been marked as stale because of no activity in the last 180 days. It will be closed in the next 180 days unless it is tagged "no stalebot" or other activity occurs.