flagger icon indicating copy to clipboard operation
flagger copied to clipboard

Contour add custom header/path support

Open przwojtkow opened this issue 4 years ago • 0 comments

It would be nice to have functionality of adding custom header to each request send by services wiothout modifying the application itself. Currently I am facing the issue where I have 4 pods during A/B testing (FRONT-PRIMARY -> BACK-PRIMARY, FRONT-CANARY -> BACK-CANARY) and have no options to route FRONT-CANARY -> BACK-CANARY. With all available features for Contour I can only have FRONT-CANARY -> BACK-PRIMARY. I've found this kind of functionalities for Istio but no for HttpProxy.

I've tried using webhooks of kyverno to modify autogenerated, -canary httpproxy for FRONT-CANARY but conditions section is the first to execute, so headers are not present at this point of time. I want to add header: 'deploymode: test' for '-canary' service. This header will be checked by BACK-CANARY service using 'match' sections in Canary object.

  routes:
    - conditions:
        - header:
            exact: >-
              test
            name: deploymode
          prefix: /
      retryPolicy:
        count: 3
        perTryTimeout: 5s
      services:
        - name: FRONT-primary
          port: 8081
          requestHeadersPolicy:
            set:
              - name: l5d-dst-override
                value: >-
                  FRONT-primary.NAMESPACE.svc.cluster.local:8081
        - name: FRONT-canary
          port: 8081
          requestHeadersPolicy:
            set:
              - name: l5d-dst-override
                value: >-
                  FRONT-canary.NAMESPACE.svc.cluster.local:8081
              - name: deploymode
                value: >-
                  test
          weight: 100
      timeoutPolicy:
        idle: 5m
        response: 15s

Is there any other option that I've missed? If not, then please consider adding such feature, thanks!

przwojtkow avatar Dec 06 '21 09:12 przwojtkow