-
Notifications
You must be signed in to change notification settings - Fork 25
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
Feature Request: Allow inclusive-or HTTP match conditions #123
Comments
I don't believe the above is actually valid YAML? The match:
headers:
matchAny:
- regex: .*blue.*
name: blue
- regex: .*green.*
name: green
prefix: / or, alternately, I suppose you could do an alternator regex expression? routes:
- http:
action:
weightedTargets:
- virtualNodeName: podinfo-canary
weight: 100
match:
headers:
- match:
regex: .*(blue|green).*
name: blue-or-green |
The alternator doesn't work for my use case, for example I want to route Safari users or clients with an insider cookie to the canary: With Istio this looks like this (it does an match:
- headers:
cookie:
regex: "^(.*?;)?(type=insider)(;.*)?$"
- headers:
user-agent:
regex: "(?=.*Safari)(?!.*Chrome).*$" I am trying to achieve the same thing with App Mesh but I don't see how it's possible since match accepts a single headers condition: match:
headers:
- match:
regex: ^(.*?;)?(type=insider)(;.*)?$
name: cookie
- match:
regex: (?=.*Safari)(?!.*Chrome).*$
name: user-agent |
@jaypipes I'll reword the issue and make it a feature request. |
Thanks @stefanprodan. I've gone ahead and transferred this issue to aws/app-mesh-roadmap since this is a general App Mesh feature request. In the future can you open feature requests here in this repository? Thanks again 👍 |
Right now header matching is pretty much 1:1 with Envoy's API: https://www.envoyproxy.io/docs/envoy/latest/api-v2/api/v2/route/route.proto.html?highlight=strip%20headers#envoy-api-field-route-routematch-headers It doesn't support any sort of inclusive-or matching right now. Perhaps we could expose some API to express inclusive-or matches at the route-level:
which could just be a short-hand for multiple identical routes. This is just me spit-balling. We'd need to think carefully about the ergonomics of this. |
@lavignes I think making the match an array of conditions would solve the issue without introducing operators like E.g. target macOS users with a routes:
- http:
action:
weightedTargets:
- virtualNodeName: podinfo-canary
weight: 100
match:
- prefix: /
headers:
- name: user-agent
match:
regex: ".*Macintosh.*"
- name: cookie
match:
regex: "^(.*?;)?(canary=enabled)(;.*)?$"
- prefix: /
headers:
- name: x-canary
match:
exact: "enabled" The above configuration would result in two Envoy routes. |
@stefanprodan Unfortunately, |
If I had to make such a change without breaking backwards compatibility in App Mesh CRD, I would create a type that accepts both an object or an array of objects e.g. openAPIV3Schema:
properties:
spec:
properties:
match:
description: A HTTP match condition or array of conditions
anyOf:
- type: object
properties:
prefix:
description: URL prefix
type: string
- type: array
properties:
items:
type: object
properties:
prefix:
description: URL prefix
type: string I think this could easily be handled in the Virtual Service CRD, the App Mesh Kubernetes controller could take an array of conditions and create a route for each one in the App Mesh API. |
Given that this is generally useful, I feel App Mesh API should support this directly. |
OR condition would be also very useful for Cloud Map tags matching. Support for this would enable to use App Mesh in the following scenario: We are running shared integration environment, and we want to let developers test microservices they're developing. By specifying I'm currently spiking App Mesh with Cloud Map and ECS and ran into issue - and I'm not sure if my use case is best fit for this platform. What I'm trying to achieve is to route traffic to nodes with specified tags (attributes in Cloud Map), and define fallback nodes that will receive traffic if nothing was matched: For service with:
I'm getting Instead, I would like to see VirtualNode_2 to reply when there are no healthy services in VirtualNode_1. |
Allow inclusive-or HTTP match conditions. e.g. route Safari users or users with an
insider
cookie to the canary:The text was updated successfully, but these errors were encountered: