fix virtual service destination routes when match is set
primary destination is duplicated on both virtual service routes when setting match rules as per the istio a/b testing tutorial:
No weights set on analysis object:
analysis:
interval: 15s
iterations: 2
match:
- headers:
x-header-1:
exact: Test_from_DEVs
The following is generated:
http:
- match:
- headers:
x-header-1:
exact: Test_from_DEVs
route:
- destination:
host: podinfo-primary
weight: 100
- destination:
host: podinfo-canary
weight: 0
- route:
- destination:
host: podinfo-primary
weight: 100
analysis values with weigths:
analysis:
interval: 15s
match:
- headers:
x-header-1:
exact: Test_from_DEVs
maxWeight: 50
stepWeight: 50
threshold: 2
generates:
http:
- match:
- headers:
x-header-1:
exact: Test_from_DEVs
route:
- destination:
host: podinfo-primary
weight: 50
- destination:
host: podinfo-canary
weight: 50
- route:
- destination:
host: podinfo-primary
weight: 50
Logic comes from here and here
this PR makes canary the default destination from the canary route when neither maxWeight or stepWeight are set on the canary
http:
- match:
- headers:
x-header-1:
exact: Test_from_DEVs
route:
- destination:
host: podinfo-primary
weight: 0
- destination:
host: podinfo-canary
weight: 100
- route:
- destination:
host: podinfo-primary
weight: 100
Additionally as per istio docs If there is only one destination in a rule, it will receive all traffic so it probably makes sense to get rid of the weights altogether and only leave one destination on each route?
@stefanprodan / @aryan9600 any chance one of you can take a look at this PR?
.analysis.match and .analysis.stepWeight are not compatible with each other. the former is used for A/B testing while the latter is used for canary releases. if you'd like to combine both A/B testing with canary releases, you can do so by configuring session affinity: https://docs.flagger.app/tutorials/istio-progressive-delivery#session-affinity