fluxcd / flagger

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

Canary analysis restart again and again when using Gateway API #1712

Open mingjie-li opened 21 hours ago

mingjie-li commented 21 hours ago

Describe the bug

When iterating over a map in Go, the order of elements is not guaranteed and may vary between iterations. In the context of the Gateway API provider, the four following maps:

canary.Spec.Service.Headers.Request.Add
canary.Spec.Service.Headers.Request.Set
canary.Spec.Service.Headers.Response.Add
canary.Spec.Service.Headers.Response.Set

are transformed into four slices, where the order becomes significant when comparing using go-cmp.

If sessionAffinity or Mirror is used, the comparison of these slices will be ignored. However, in other cases, any differences in the slices will lead the Flagger operator to believe that the HttpRoute has changed, triggering unnecessary canary analysis restarts."

To Reproduce

run canary analysis with gateway api without sessionAffinity or Mirror

Expected behavior

canary analysis run only once

Additional context

mingjie-li commented 19 hours ago

PR here -> https://github.com/fluxcd/flagger/pull/1713