Skip to content

fix: prevent filter corruption and reconcile loop in Gateway API session affinity - #1990

Open
okarin1511 wants to merge 1 commit into
fluxcd:mainfrom
okarin1511:fix/gateway-api-session-affinity
Open

okarin1511 wants to merge 1 commit into
fluxcd:mainfrom
okarin1511:fix/gateway-api-session-affinity

Conversation

@okarin1511

Copy link
Copy Markdown

Fixes #1989

Summary

Two bugs in Gateway API session affinity:

  1. Filter slice corruption: Shallow copy of HTTPRouteRule shares the Filters slice backing array with the source. append in the canaryWeight == 0 branch can corrupt the weighted route rule's filters when spare capacity exists. Fixed by explicitly copying the Filters slice after the struct copy.

  2. v1beta1 infinite reconcile loop: The v1beta1 reconcile diff only ignores the canary cookie route rule, not the primary cookie route. When PrimaryCookieName is set, the primary sticky route causes a diff on every cycle, triggering unnecessary updates. Fixed by matching the v1 implementation which ignores both cookie routes.

Test plan

  • All existing router package tests pass
  • The Filters slice copy prevents the data corruption scenario
  • The v1beta1 reconcile diff now mirrors the v1 implementation

…ion affinity

Two bugs in the Gateway API session affinity implementation:

1. Shallow copy of HTTPRouteRule shares the Filters slice backing
   array. When append is called in the canaryWeight == 0 branch,
   it can corrupt the weighted route rule's filters if spare
   capacity exists. Fix by copying the Filters slice explicitly.

2. The v1beta1 reconcile diff only ignores the canary cookie route
   rule but not the primary cookie route rule. This causes an
   unnecessary update on every reconcile cycle when PrimaryCookieName
   is set. Fix by matching the v1 implementation which correctly
   ignores both canary and primary cookie routes.

Signed-off-by: Aseem Khandekar <69676297+okarin1511@users.noreply.github.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Gateway API session affinity: filter slice corruption and v1beta1 infinite reconcile loop

1 participant