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

Allow for header based matching on the same path #1

Open
jonathan-whitaker opened this issue Jun 23, 2022 · 2 comments
Open

Allow for header based matching on the same path #1

jonathan-whitaker opened this issue Jun 23, 2022 · 2 comments

Comments

@jonathan-whitaker
Copy link

jonathan-whitaker commented Jun 23, 2022

In order to support matching based on headers or query params for the same path I had to change line 148 of
https://github.com/monimesl/istio-virtualservice-merger/blob/main/api/v1alpha1/virtualservicemerge_types.go

from:
targetRoutes = append(targetRoutes, pRoute)
to:
targetRoutes = append([]*v1alpha3.HTTPRoute{pRoute}, targetRoutes...)

This is because istio selects the first matching entry and since we have default services for the path and are matching headers for feature environments I needed the header matches to be listed first.

Not sure if you want this change as a PR but for now I've built my own image with the change and it is working for us.

@alphashaw
Copy link
Contributor

alphashaw commented Jun 27, 2022

Hello @jonathan-whitaker. We have been in your shoe.

I agree that the default implementation will have issues if a more generalized route is at then top of the list since istio chooses a route by doing sequential match testing.
However, since it's a list, I think appending new routes to the end seems more natural.

I have a proposal for us to have priority routes:
Can we have an optional -number suffix to the route name define in the patch that the operator can use to sort the VS route slice after adding new ones before updating?

@romanlum
Copy link

Any news here?
Is header matching with default route working?

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

No branches or pull requests

3 participants