Repository navigation
feat(registry): add UDP as a third mesh protocol (vocabulary only) - #933
Merged
Merged
Conversation
A UDP-only workload has no way to describe itself to aether. The endpoint.aether.io/protocol annotation accepts exactly "http" and "tcp", so a pod serving datagrams has to register as "tcp" -- which is what e2e/l4routes.sh has done all along, with a comment explaining the lie. That lie is the root of #931. Registering as TCP makes aether build the pod's liveness probe as a bare tcp_health_check against its application port; a TCP connect to a UDP port can never succeed, so the endpoint is marked UNHEALTHY forever, the verdict is cloned into the plaintext udp: cluster, and HealthyPanicThreshold: 0 turns "no healthy hosts" into a silent drop of every datagram. No log, no NACK, no stat. This commit adds the vocabulary only: Service.Protocol PROTOCOL_UDP = 3 PortProtocol PORT_PROTOCOL_UDP = 3 annotation value "udp" ports suffix "=udp" Nothing consumes it yet -- the consumers land in the following commits -- so a pod that opts in today is registered under a key no reader enumerates. Ship the registrar before the agents regardless. The two enums are bridged by a raw numeric cast in endpointmeta.go, so they are added in lockstep; TestPortProtocolMatchesServiceProtocol already asserted equal cardinality and would have caught a one-sided change on its own. One existing test changes meaning rather than breaking. cni_test.go used "udp" as its example of an UNRECOGNISED annotation value -- it had pinned, as a passing assertion, exactly the gap #931 turned out to be. The assertion is worth keeping ("an unrecognised annotation yields no registry keys at all"), so it now runs against "sctp", which the vocabulary really does not contain, and "udp" gains a positive case beside it. 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
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 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.
First of five for #931: the UDP floor blackholes every UDP-only backend.
Why
A UDP-only workload has no way to describe itself.
endpoint.aether.io/protocolaccepts exactly"http"and"tcp", so a pod serving datagrams registers as"tcp"— which is whate2e/l4routes.sh:492-505has done all along, with a comment explaining why.That is the root of #931. Registering as TCP makes aether build the pod's liveness probe as a bare
tcp_health_checkagainst its application port. A TCP connect to a UDP port never succeeds, so:Silently: no log, no NACK, and no stat —
downstream_sess_rx_datagramsread 1 after four datagrams reached the socket, because udp_proxy counts only once a session exists and a session needs a host.What this PR does
Vocabulary only.
Service.ProtocolPROTOCOL_UDP = 3PortProtocolPORT_PROTOCOL_UDP = 3"udp"portssuffix"=udp"Nothing consumes it yet, so a pod that opts in today is registered under a key no reader enumerates. The consumers land in PRs 2–5. Ship the registrar before the agents regardless.
The two enums are bridged by a raw numeric cast in
endpointmeta.go:238-244, so they move in lockstep.TestPortProtocolMatchesServiceProtocolalready asserted equal cardinality and would have caught a one-sided addition on its own; the explicit UDP pair is added beside it.One test changes meaning rather than breaking
registry/cni_test.goused"udp"as its example of an unrecognised annotation value — it had pinned, as a passing assertion, exactly the gap #931 turned out to be. The assertion is worth keeping, so it now runs against"sctp", which the vocabulary really does not contain, and"udp"gains a positive case.Notes for review
9001=tcp,9001=udpis legitimate in principle — TCP and UDP are separate socket families and the registry key is(service, protocol), not(service, port).PortProtocolsreturns amap[uint32]PortProtocolso it is last-suffix-wins. Pinned as a known limit rather than left undiscovered; not worth widening the map until something needs it.meshServicePortsstill hardcodescorev1.ProtocolTCP. Deliberate — the UDP floor reaches backends at their app port via the pod-local redirect, not kube-proxy. Amesh-udpServicePort is proposal 038's business.Verification
bazel test //...— 109/109 pass.--config=lint --@aspect_rules_lint//lint:fail_on_violation //...clean.Refs #931. Out of scope and unchanged: per-service selection (#916 / 038 Phase 2), weighted UDP splits (#873), DTLS.
🤖 Generated with Claude Code
https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr