flagger icon indicating copy to clipboard operation
flagger copied to clipboard

Flagger Istio Canary Deployment for dependent Microservices

Open saswata1989 opened this issue 5 years ago • 10 comments

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.<namespace_name>.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.

saswata1989 avatar Jun 19 '20 21:06 saswata1989

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.

stefanprodan avatar Jun 20 '20 06:06 stefanprodan

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

saswata1989 avatar Jun 20 '20 06:06 saswata1989

Yes

stefanprodan avatar Jun 20 '20 06:06 stefanprodan

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?

saswata1989 avatar Jun 20 '20 06:06 saswata1989

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

stefanprodan avatar Jun 20 '20 06:06 stefanprodan

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?

saswata1989 avatar Jul 02 '20 21:07 saswata1989

Is this functionality possible with AppMesh?

dav3rin avatar May 15 '23 10:05 dav3rin

Is it works with nginx? @stefanprodan

koolay avatar May 30 '23 03:05 koolay

@stefanprodan is this feature available for linkerd or nginx?

sujeeth-alef avatar Aug 03 '23 13:08 sujeeth-alef

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

Maksym-Perehinets avatar Jun 24 '24 15:06 Maksym-Perehinets