rollouts-plugin-trafficrouter-gatewayapi icon indicating copy to clipboard operation
rollouts-plugin-trafficrouter-gatewayapi copied to clipboard

Header based routing does not work if original HTTP route has filters on it

Open kostis-codefresh opened this issue 1 year ago • 2 comments

The header based routing example only works if the existing HTTP route has no filters.

This works

apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
  name: my-smart-route
spec:
  parentRefs:
    - name: traefik-gateway
      namespace: default
  rules:
  - matches:
    - path:
        type: PathPrefix
        value: /     
    backendRefs:
     - name: argo-rollouts-stable-service
       kind: Service
       port: 80
     - name: argo-rollouts-canary-service
       kind: Service
       port: 80

This does not work

apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
  name: my-smart-route
spec:
  parentRefs:
    - name: traefik-gateway
      namespace: default
  rules:
  - matches:
    - path:
        type: PathPrefix  
        value: /smart/ 
     filters:
       - type: URLRewrite
         urlRewrite:
           path:
             type: ReplacePrefixMatch
             replacePrefixMatch: / 
    backendRefs:
     - name: argo-rollouts-stable-service
       kind: Service
       port: 80
     - name: argo-rollouts-canary-service
       kind: Service
       port: 80

Full example is here.

When a header based http route is created it should copy all the properties from the original route (including filters)


Message from the maintainers:

Impacted by this bug? Give it a 👍. We prioritize the issues with the most 👍.

kostis-codefresh avatar Oct 07 '24 09:10 kostis-codefresh

@kostis-codefresh were you able to figure out a workaround for this?

shylesh107 avatar Apr 03 '25 18:04 shylesh107

Nope. It is one of the things that I think we should fix anyway

kostis-codefresh avatar Apr 03 '25 21:04 kostis-codefresh

Nope. It is one of the things that I think we should fix anyway

You're doing a nice job, I noticed there's been a PR for that here, will it be merge anytime soon?

eazylaykzy avatar Jul 31 '25 18:07 eazylaykzy

It is still missing e2e tests.

If you could test that PR and let me know if it works for you, it would help me merge it much faster.

Does it work with your own example Rollout?

kostis-codefresh avatar Aug 01 '25 08:08 kostis-codefresh

It is still missing e2e tests.

If you could test that PR and let me know if it works for you, it would help me merge it much faster.

Does it work with your own example Rollout?

@kostis-codefresh I have not be able to test the PR as I'm currently the lone DevOps guy on the team at work, and have been working on other things, but you can share me some pointers, I might just jump on it on a weekend.

eazylaykzy avatar Aug 13 '25 17:08 eazylaykzy

You can use this container image for the plugin https://github.com/argoproj-labs/rollouts-plugin-trafficrouter-gatewayapi/pkgs/container/rollouts-plugin-trafficrouter-gatewayapi/487062609?tag=header-based-routing-filters

It is the same as 0.6.0 plus the contents of the PR

kostis-codefresh avatar Aug 14 '25 13:08 kostis-codefresh

This is now part of 0.8.0

kostis-codefresh avatar Sep 12 '25 14:09 kostis-codefresh