Repository navigation
feat(agent): build udp: cluster entries for PROTOCOL_UDP services - #935
Merged
Merged
Conversation
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 Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
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.
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
LoadClustersFromRegistrylisted HTTP and TCP only, so a service registered solely underPROTOCOL_UDPproduced no cluster entry.udpClusterForLockeddeliberately refuses to name a cluster the snapshot does not carry — naming one would accept datagrams and drop them in silence — socaptureUDPClustersemitted nothing and the per-podudp_proxylistener 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.tcpgated two behaviours:clustersEndpointsAndVhostsrefreshEntryMTLSLockedBoth 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, and UDP needed no new branch at either.buildUDPClustersLockedis deliberately thinner than its TCP sibling: nosanNamespaces, 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 to name a per-port cluster from.serviceEntryLockedgains a third arm (HTTP → TCP → 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 asPROTOCOL_UDP.Worth a look in review
The
sniassertion in the new test is load-bearing, not cosmetic:captureUDPClustersparsessnito rewrite the load assignment onto the datagram port, and an entry whosesnidoes not parse is skipped — which is exactly the silent-no-listener path this PR exists to close.Test fixture note
The new test's mock switches on protocol explicitly. The existing fixtures in this package predate a third protocol and use the
if TCP … else HTTPshape, so a UDP call lands in their HTTP branch. Harmless there — 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.Verification
bazel test //...— 109/109. Lint clean. Refs #931.Still to come: PR4 (app ports + the health fix — #931's actual fix, which I will validate on talos-main before merging), PR5 (make the silent drop loud), PR6 (e2e).
🤖 Generated with Claude Code
https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr