fluxcd / flagger

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

Flagger Istio Canary Deployment for dependent Microservices #631

Open saswata1989 opened 4 years ago

saswata1989 commented 4 years ago

Can you please let me how can we can perform Istio Canary deployment with Flagger for dependent micro services. Suppose we have 2 micro services A and B. Microservice A is invoking svc B using an environment variable (whose value is B..svc.cluster.local:8080) in the deployment spec of A. Now if we have canary deployment, how do we make sure any call from A -canary pod goes to B canary Pod and NOT B -primary. And if we dont have any B-canary, any call from A-canary should go to B-primary. Is there a way when flagger creates the canary deployment spec it replaces any environment variable in it with the canary svc url of the downstream microservice. Above applies if we have 5 more dependent downstream microservices.

stefanprodan commented 4 years ago

Chaining canaries can be done with source labels matching. Source labels have been implemented in Flagger v1.0.0 #594.

Service A:

kind: Canary
metadata:
  name: frontend
spec:
  provider: istio
  service:
    gateways:
      - mesh
  analysis:
    stepWeight: 10 
    maxWeight: 100

Service B:

kind: Canary
metadata:
  name: backend
spec:
  provider: istio
  service:
    gateways:
      - mesh
  analysis:
    iterations: 10
    match:
    - sourceLabels:
        app: frontend

When both service A and B are under analysis, traffic is split at service A and the calls from A canary are routed to B canary, while calls from A primary are routed to B primary.

saswata1989 commented 4 years ago

Thanks for the information. what happens if there is no canary for one of the downstream service, will canary route to primary then?

stefanprodan commented 4 years ago

Yes

saswata1989 commented 4 years ago

Can you please let me know how does iteration work and if we can add step weight in that so that during canary deployment we can use the weighted routing with source labels?

stefanprodan commented 4 years ago

The weight shifting happens at ingress (service A), the downstream canaries will receive the amount of traffic set at ingress.

saswata1989 commented 4 years ago

What happens if the Service A does not have a canary? How does the weight shifting happen for the downstream canaries then? In that case can we set stepWeight along with source labels?

daverin commented 1 year ago

Is this functionality possible with AppMesh?

koolay commented 1 year ago

Is it works with nginx? @stefanprodan

sujeeth-alef commented 1 year ago

@stefanprodan is this feature available for linkerd or nginx?

Maksym-Perehinets commented 5 months ago

@stefanprodan Hi, does this also works for canary release with nginx ingress, or it's only supported by Istio?