Repository navigation
feat(datapath): Serve one service address from several producers - #1093
Merged
Merged
Conversation
A node-local private service route redirects a consumer to exactly one producer interface, so the datapath cannot deliver one service address from several producers on the same node. A new route mode, LocalSet, reads its producers from service_producer_set_table under the route's own key: up to 16 members, each fenced by its attachment identity token, and the subset that takes new flows. usid_egress pins each TCP flow, keyed by its forward tuple on the consumer interface, to the member that took its first packet in the LRU service_flow_table, and keeps it there while that member stays in the set, so a member that only stops taking new flows keeps its connections. A new TCP flow takes an eligible member by its FNV-1a hash and a UDP datagram takes one at random, so the requests of one socket spread too. Replies, and the reclaim of a colliding reverse row, accept any member of the route's set. A route with no set, no eligible member, or a member whose interface was replaced fails closed. Every existing struct and map keeps its layout, so loading this datapath recreates no pinned map and revokes no service authorization. The router's service route programmer counts the new map among the ones it watches and treats its absence as a datapath that predates LocalSet routes, so a router can run ahead of the CNI or behind it. Nothing writes LocalSet routes yet. Related to #1086 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 25, 2026
galactic-cni's credential-refresh container creates the datapath's maps and its memory cgroup pays for them, under a 128Mi limit (#808). An LRU map is always preallocated, so the 131072-entry service_flow_table added 18Mi: the maps grew from 58Mi to 76Mi on a 12-CPU node, leaving the container needing 116Mi of its 128Mi, and the figure grows with CPU count. The table now holds 32768 pins, which brings the maps to 63Mi and the container's need to 103Mi. A pin covers only a TCP flow to a Spread endpoint, and a flow whose pin is evicted takes the producer its hash picks, which is the same one while the endpoint's producer set is unchanged. The galactic-cni README's memory figure, which still said 35Mi, now gives the measured size. Related to #1086 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
privateip
force-pushed
the
fix/issue-1086-datapath
branch
from
October 25, 2026 15:28
f0b718a to
bd9ae8a
Compare
3 tasks
privateip
marked this pull request as ready for review
October 25, 2026 15:47
Contributor
Author
|
Two independent reviews ran on this PR, and the second pass returned merge from both on head bd9ae8a, with nothing left above a nit.
CI is green on this head, including the root kernel and end-to-end jobs. This is the middle of stack #1096, which merges as a whole with |
ecv
approved these changes
Oct 25, 2026
ecv
left a comment
Contributor
There was a problem hiding this comment.
Approve.
The datapath half is sound: a LocalSet route fails closed (drop) when the producer set, an eligible member or a member's interface identity is missing, and Single routes take the unchanged mode 1 path. Nothing deploys on merge, and the new maps are only written by the router in #1094.
usid.cservice_select_producer: a TCP pin is honoured only while its producer is still a member with a matching identity, so a draining producer keeps its connections and replies, and a removed one loses only its own flows. The covering test (TestUsidServiceEgress_LocalSetPinsTCPFlows) exercises drain, removal and replies.service_install_reverseand the reply path now accept any set member (draining included) throughservice_local_route_has_producer, so replies from a draining producer still pass. This is the right widening and stays bound to the consumer token.table.goOpenPinned: a missingservice_producer_set_tableis tolerated andRegisterProducerSet/RegisterLocalSetRouterefuse, so an older datapath keeps serving every Single route.mapSetIDstreats the map appearing as a map-set change, which reopens handles correctly.- Cleanup:
SweepPolicyandClearnow remove producer sets that are not in the snapshot, so a Spread to Single switch or a deleted endpoint leaves no set behind. Staleservice_flow_tablerows are harmless (consulted only for LocalSet routes) and age out by LRU or the flow timeout. service_flow_tableadds about 28Mi of preallocated eBPF memory to the galactic-cni cgroup (the README now says about 63Mi on 12 CPUs, growing with CPU count); the existing memory-limit test guards it, but the margin on large nodes is worth watching at rollout.
Follow-ups:
- A TCP pin lost to LRU eviction (32768 flows per node) or the idle timeout rehashes with
hash % eligible, so the connection can land on a different producer and reset. Same when the eligible count changed since the pin was made. Consider a larger table or a consistent-hash/rendezvous pick so hash stability survives set changes. - UDP picks a random producer per packet, so multi-packet UDP exchanges (QUIC, DTLS) are split across producers. Fine for DNS-style request/reply; document it for Spread users.
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
A node-local private service route sends each consumer to exactly one producer interface.
The datapath now also accepts a route whose producers live in a separate set: each TCP connection stays with the producer that took its first packet, each UDP request picks an eligible producer at random, and replies are accepted from any producer in the set.
Existing maps keep their layout, so loading this datapath recreates no pinned map and revokes no service access. Nothing writes these routes until the next layer.
Test plan
Second of three, on the API in #1092. Next is the router in #1094.
Fixes #1086
🤖 Generated with Claude Code