Gateway API Session Affinity (Consistent-Hash Load Balancing)
Is your proposed feature related to a problem?
There is no way to route requests that share an application-supplied key (an HTTP header, cookie, query parameter, or path segment) to the same backend Pod. One example, where this is useful is actor based systems with entity sharding. First request allocates actor to the pod and all future requests with same key (e.g. query parameter) should land on same pod, otherwise potentially expensive and slow actor reallocation can take place.
Describe the feature you'd like
This proposal adds session affinity as defined by GEP-1619 (hash-based, "weak" affinity, as distinct from the cookie-encoded session persistence delivered by CFP-47089), implemented with Envoy's consistent-hash load balancers (Maglev, ring hash).
Notify relevant community channels
No response
(Optional) Describe your proposed solution
- User-facing configuration. Two annotations on the backend Service
(the Service named in
backendRefs; the GAMMA backend facet), which maps 1:1 onto the Envoy cluster Cilium generates.service.cilium.io/lb-l7-algorithm(existing): documented valuesmaglevandring_hashadded.service.cilium.io/lb-l7-hash-policy(new): the hash key.
- Internal model.
model.Backendgains aLoadBalancingattribute (algorithm and hash policy), populated during ingestion likeAppProtocolandTLS. - Envoy translation. Both on the cluster: algorithm →
lb_policy(plus Maglev / ring-hash config); hash key →HttpProtocolOptions.hash_policy(Envoy 1.37+), which Envoy consults before any route-level policy. Routes are unchanged. One cluster mutator serves the Gateway API / GAMMA translator and the Proxy Load Balancing reconciler.
CFP document: https://github.com/cilium/design-cfps/pull/107
Source: cilium/cilium