Repository navigation
feat(registry): carry UDP services through the control plane - #934
Merged
Merged
Conversation
Second of the #931 series. PR #933 added PROTOCOL_UDP to the vocabulary; this makes the control plane actually carry a service registered under it. FIVE ENUMERATORS, FIVE LITERAL SLICES The registry key is (service, protocol), so anything that enumerates services must enumerate protocols. Five call sites each carried their own two-element list, and a protocol missing from one of them does not fail -- it disappears: registrar/internal/server/sync.go never synced to any agent registrar/internal/services/generator.go no mesh VIP, no ClusterIP, no DNS agent/internal/cni/server/ghostsweep.go registrations leak into etcd forever agent/internal/xds/cache/cluster.go (x2) never becomes a cluster All silent, and none is a test failure unless a test happens to cover that protocol. They now share registry.ServedProtocols, and TestServedProtocolsCoversEnum reads the generated Service_Protocol_name rather than a second hand-written list, so it cannot drift the way the thing it guards drifted. It asserts cardinality in both directions: a value REMOVED from the proto also fails, rather than leaving a stale entry that reads as supported. The cluster.go pair is deliberately not in this commit -- see below. CLASSIFICATION IS THREE-VALUED, NOT A FLIPPED BOOL PrimaryIsTCP: !isHTTPAppProtocol(appProto) && !isUDPAppProtocol(appProto) isUDPAppProtocol is NOT the complement of isHTTPAppProtocol. An unrecognised value still classifies as TCP -- that conservative default is existing behaviour and is unchanged -- and only a protocol the mesh knows to be datagram-only is carved out of it. Before the carve-out "udp" fell to isHTTPAppProtocol's default branch and a UDP service's VIP acquired a portless /32 TCP floor chain fronting a tcp: cluster that need not exist. A UDP service is still DELIVERED: it has a routable VIP, so it keeps its mesh Service, its ClusterIP and its mesh-DNS record. It just gets neither chain; its path is the connection-less udp_proxy listener. The generated mesh Service's ports stay ProtocolTCP on purpose. The UDP floor reaches backends at their application port through the pod-local nftables redirect, never through kube-proxy, so a "mesh-udp" ServicePort would advertise a path that does not exist. ONE TEST FIXTURE HAD THE SAME OPEN-SET BUG IT GUARDS AGAINST sync_test.go's mock registry was written as "if TCP do X, otherwise treat it as HTTP", so the new UDP call incremented the HTTP CYCLE COUNTER, made the first cycle look like the second, and failed it -- surfacing as "initial sync did not complete". It now switches on the protocol explicitly. Also corrected a comment that proposal 037 had made stale: a service is no longer "registered under exactly one protocol". NOT IN THIS COMMIT AppPortsFromPod / AppPortProtocols still strip an "=udp" suffix and admit the port as a plain HTTP/1.1 app port. Excluding UDP ports there changes which ports get a per-pod TCP app cluster and an inbound SNI chain, and for a UDP-PRIMARY pod can empty the port set -- which lands on the same line as the health-probe target. Those move together in the next commit rather than leaving an incoherent state between two. Refs #931 Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
bpalermo
added a commit
that referenced
this pull request
Sep 25, 2026
Third of the #931 series. #934 made the control plane carry a UDP service; this makes the node agent build its Envoy cluster. WITHOUT THIS, A UDP-ONLY SERVICE HAS NO DATA PATH AT ALL LoadClustersFromRegistry listed HTTP and TCP only, so a service registered solely under PROTOCOL_UDP produced no cluster entry. udpClusterForLocked deliberately refuses to name a cluster the snapshot does not carry -- naming one would accept datagrams and drop them in silence -- so captureUDPClusters emitted nothing and the per-pod udp_proxy listener was never built. The datagram path did not exist rather than being broken, and nothing said so. THE RENAME IS MOST OF THE CHANGE clusterEntry.tcp gated two behaviours: "emit only the bare-name CLA, no h2 cluster or outbound vhost" (clustersEndpointsAndVhosts) and "skip upstream mTLS injection" (refreshEntryMTLSLocked). Both are already right for UDP, for different reasons -- TCP floor entries skip mTLS because the floor cluster carries its own transport socket, UDP because there is none: the floor is plaintext and mTLS has no DTLS counterpart. So both sites were protocol-agnostic in behaviour and only the NAME claimed otherwise. Renamed to l4Floor; UDP needed no new branch at either. buildUDPClustersLocked is deliberately thinner than its TCP sibling: no sanNamespaces and no per-port entries. Both would be lies. There is no peer identity to pin on a plaintext hop, and a connection-less UDP listener carries no filter chains, so there is nothing to name a per-port cluster from. serviceEntryLocked gains a third arm (HTTP, then TCP, then UDP). The order is a preference, not a priority: a service under several protocols has the same endpoints under each and only one entry owns the bare-name CLA. The UDP arm exists for the service registered ONLY as PROTOCOL_UDP. TEST FIXTURE NOTE The new test's mock switches on the protocol explicitly. The existing fixtures in this package predate a third protocol and use the "if TCP ... else HTTP" shape, so a UDP call lands in their HTTP branch. That is harmless here (the HTTP entry owns the CLA, so the spurious UDP entry carries nil and emits nothing), but it is the same open-set shape that actually broke the registrar syncer test in #934, so new code does not copy it. Refs #931 Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr Co-authored-by: Claude Opus 5 <[email protected]>
This was referenced Sep 26, 2026
bpalermo
added a commit
that referenced
this pull request
Sep 26, 2026
…hole (#943) * docs(038): fold east-west QUIC in as a requirement and reassess the whole The proposal carried QUIC as a "does NOT deliver" appendix, deferred on a security-model objection that upstream has since resolved in the direction that preserves aether's invariant (envoyproxy/envoy #47076, in the pinned snapshot). A capture path that is the foundation for a second, identity-bearing traffic class is a different proposal from one that only fixes plaintext selection, so this restructures rather than appends. WHAT CHANGES Requirements section (R1-R6). Two traffic classes on one path -- plaintext per-service UDP and the QUIC mesh transport -- with the destination port class as the discriminator, so a plaintext datagram can never be offered to a QUIC chain or vice versa. The mesh ports are constants; the service ports come from the registry's PORT_PROTOCOL_UDP (#933/#934), so the CNI rule set is derived from declared facts. Phases 4 and 5 added. Phase 4 is the QUIC transport itself: inbound QUIC on UDP:18008 beside TCP:18008 with require_client_certificate and the SAME validation_context and SDS secrets as the TCP inbound; an HTTP/3 upstream that presents the source's client cert; the east-west gateway on UDP:18009 last. Resumption and early data off, gated, until the pin passes #47219. Phase 5 is TCP capture moving to TPROXY, gated on the 0xae7e mark analysis and on Phase 4 being on in a soak -- not for symmetry, because TCP and QUIC on two capture mechanisms is the split that produced #916. Phase 1 now builds the rule set with a capture-mode parameter (R6) so Phase 5 is a flag flip, and must choose a divert mark disjoint from 0xae7e. Two decisions flagged rather than made (D1 the plaintext dial spelling -- recommendation: the application port, with :18081 kept one release; D2 the divert mark) and four open questions, the sharpest being Q2: whether transport_socket_matches selects a QUIC upstream transport, which decides if Phase 4's outbound is one cluster or one per source. Alternatives gains "a separate port for QUIC" (rejected, R3, pinned by #942) and "QUIC via HBONE/CONNECT-UDP" (rejected on 031's grounds). "Do nothing" is downgraded from legitimate to weaker-now: #931 showed the plaintext path had been silently broken for its whole life. Refs #916 Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr * docs(038): plaintext UDP dials :18082, the L4 spelling shared with raw TCP Folds the one-number-both-transports rule (R3) one level down, which decides D1 and simplifies two phases. A client dials <svc>.<ns>.<mesh-domain>:18082 for a UDP service exactly as it does for a raw-TCP one; only the transport differs. That gives plaintext UDP exactly ONE dialed port, so: - Phase 2 collapses from "one transparent listener per distinct UDP service port" to ONE listener on UDP:18082 per pod, matcher on destination IP. Listener count no longer scales with services or ports. - Phase 1's rule set becomes three literals (18082, 18008, 18009). No declared-port-set plumbing. - Q1 (how the CNI learns the declared UDP port set) is dissolved. - The CNI never needs to know which application ports UDP services bind; UDPLoadAssignment already rewrites the udp: cluster to the app port, which is exactly how tcp: clusters reach a raw-TCP backend from the shared :18082. This is the TCP floor's shape under 037, transport for transport. The 09-23 draft's "distinct UDP port set is small" reasoning is preserved in the text as history; the folded rule makes that set exactly one. :18081/udp stays captured and routed to the plaintext class for one release. ProxyTCPOutboundPort's name and the CNI's "18082 is a TCP spelling" comment go stale under this rule; Phase 1 corrects the comment and may rename the constant. The east-west port gate extends to 18082 in Phase 1 and 18008 in Phase 4. Refs #916 Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr * docs(038): decide D2, restate Q2 against the real mechanism, add the PR plan D2 decided: CaptureDivertFwMark = 0xae71, same 0xae7x family as the passthrough mark so they read as related, a distinct value so neither rule matches the other's traffic, disjoint from kube-proxy's masked marks. Phase 1 pins both. Q2 restated. The first phrasing asked whether transport_socket_matches selects a QUIC upstream transport -- but aether retired that shape in #842. Per-source identity is ONE upstream TLS socket whose custom_tls_certificate_selector (the filter_state_override cert mapper) resolves the client cert per connection from a hashable filter-state key, which also partitions the pool per (host, source identity). So the real questions are Q2a (does QuicUpstreamTransport honour the mapper) and Q2b (does the HTTP/3 pool fold the hashable key). Q2b=no would re-open the #831 leak class on QUIC, which fails open. Asked of the Envoy tree; the plan carries both branches. Plan added: 12 PRs across Phases 1-5 with sizes and gates, every gate named as something that must be seen red. Notable: Phase 2a must extend TestUDPCaptureListenerResolvesAgainstCDS by hand because the #895 chain->CDS gate cannot see a connection-less listener; Phase 4a's envoy_validate gate must FAIL a chain missing the two resumption falses; Phase 4b's //test/mtlspool gains a QUIC arm. Phase 4 must not merge before Phase 3a's selection assertion exists, or the two traffic classes share a path with no e2e proving they stay apart. Refs #916 Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr * docs(038): Q2 answered from source — Phase 4b is one QUIC cluster per source SA Q2a = no, Q2b = yes, established at 13144fb and verified against the file at that commit. Q2a: QuicClientTransportSocketFactory::create rejects a certificate selector at config load (quic_client_transport_socket_factory.cc:93-94, UnimplementedError "Client certificate selector not supported on QUIC"). The client cert is installed once per crypto config via SSL_CTX_set_chain_and_key on the shared QUICHE SSL_CTX (line 80), not per connection, because the QUICHE handshaker needs direct access to the private key. Loud, not silent. Q2b: the HTTP pool key is protocol-agnostic (ClusterEntry::httpConnPool calls transportSocketFactory().hashKey), and QuicClientTransportSocketFactory inherits CommonUpstreamTransportSocketFactory::hashKey, so HTTP/3 pools partition per (host, source identity) exactly as h2 pools do. Net: pooling does not reopen #831, but partitioning alone does not give per-source identity because the presented certificate is the cluster's. So Phase 4b is one QUIC cluster per source ServiceAccount -- the pre-#842 shape, for QUIC only, bounded by local ServiceAccounts rather than mesh services and never touching the TCP clusters. The mtlspool QUIC arm still matters: the pooling guarantee is real even though the cert is per cluster. D3 added: whether to pursue a per-connection selector for QUIC upstream in Envoy. It is an Envoy limitation, not a design constraint, and if landed Phase 4b collapses back to one cluster. Unsized; Bruno's call; the plan does not depend on it. Refs #916 Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr --------- Co-authored-by: Claude Fable 5.1 <[email protected]>
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.
Second of the #931 series. #933 added
PROTOCOL_UDPto the vocabulary; this makes the control plane actually carry a service registered under it.Five enumerators, five literal slices
The registry key is
(service, protocol), so anything that enumerates services must enumerate protocols. Five call sites each carried their own two-element list — and a protocol missing from one of them does not fail, it disappears:registrar/internal/server/sync.goregistrar/internal/services/generator.goagent/internal/cni/server/ghostsweep.goagent/internal/xds/cache/cluster.go(×2)All silent, and none is a test failure unless a test happens to cover that protocol. They now share
registry.ServedProtocols.TestServedProtocolsCoversEnumreads the generatedService_Protocol_namerather than a second hand-written list, so it cannot drift the way the thing it guards drifted. It asserts cardinality both directions — a value removed from the proto also fails, rather than leaving a stale entry that reads as supported.Classification is three-valued, not a flipped bool
isUDPAppProtocolis deliberately not the complement ofisHTTPAppProtocol. An unrecognised value still classifies as TCP — that conservative default is existing behaviour and unchanged — and only a protocol the mesh knows to be datagram-only is carved out. Before this,"udp"fell toisHTTPAppProtocol's default branch and a UDP service's VIP acquired a portless/32TCP floor chain fronting atcp:cluster that need not exist.A UDP service is still delivered: routable VIP, mesh Service, ClusterIP, mesh-DNS record. It just gets neither chain — its path is the connection-less
udp_proxylistener.The generated mesh Service's ports stay
ProtocolTCPon purpose, asserted inTestGenerator_EmitsUDPMeshService. The UDP floor reaches backends at their app port through the pod-local nftables redirect, never kube-proxy, so amesh-udpServicePort would advertise a path that does not exist.One test fixture had the same open-set bug it guards against
sync_test.go's mock registry wasif TCP do X, otherwise treat it as HTTP. The new UDP call therefore incremented the HTTP cycle counter, made the first cycle look like the second, and failed it — surfacing asinitial sync did not complete. It now switches on the protocol explicitly, so the next addition is loud.Not in this PR
AppPortsFromPod/AppPortProtocolsstill strip an=udpsuffix and admit the port as a plain HTTP/1.1 app port. Excluding UDP ports there changes which ports get a per-pod TCP app cluster and an inbound SNI chain, and for a UDP-primary pod can empty the port set — which lands on the same line as the health-probe target. Those move together in the next PR rather than leaving an incoherent state between two.Verification
bazel test //...— 109/109. Lint clean. Refs #931.🤖 Generated with Claude Code
https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr