fluxcd / flagger

Progressive delivery Kubernetes operator (Canary, A/B Testing and Blue/Green deployments)
https://docs.flagger.app
Apache License 2.0
4.85k stars 725 forks source link

Add response header on a per destination basis #840

Open ConnorGraham opened 3 years ago

ConnorGraham commented 3 years ago

I'm trying to define add a http response header to a request only when it is routed through my -canary service.

I'm using Istio.

I found I can add this to my Canary object

headers:
  response:
    add:
      x-is-canary: "true"

but this adds it to all the routes of my VirtualService

  http:
    - headers:
        response:
          add:
            x-is-canary: 'true'
      match:
        - headers:
            canarymvp:
              regex: custom
      route:
        - destination:
            host: canarymvp-primary
          weight: 0
        - destination:
            host: canarymvp-canary
          weight: 100
    - headers:
        response:
          add:
            x-is-canary: 'true'
      route:
        - destination:
            host: canarymvp-primary
          weight: 0

I want this header to only exist on requests going to my canarymvp-canary Service

- destination:
        host: canarymvp-canary
   headers:
        response:
          add:
            x-is-canary: 'true'
ldemailly commented 2 years ago

👍 any solution? (can the canary vs primary legs of the VS flagger creates be customized, something like

a service-primary: and a service-secondary: section that can be customized in canary.yaml

I guess the alternative is delegation?)