Add Gateway API UDPRoute support for datagram forwarding - #131
Merged
Conversation
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.
Adds Gateway API
UDPRoute: forward a whole UDP listener port to backends. The datagram twin of the TCPRoute shipped in #130.Design
A near-exact copy of TCPRoute, differing only where UDP does:
Protocol::Udpentrypoints,listener_serves_udp(protocolUDP), and resolution againstproxy.udplisteners instead ofproxy.tcp. Same watcher / apply / delete / re-resolve shape, same catch-all-per-rule model, same static-port requirement (the Gateway'sUDPlistener port must match aproxy.udpentry). Reusestls_entrypoint_defaults, theParentReftrait, and the shared status machinery. TheReferenceGrantfilter now recognisesUDPRoutealongside the other three kinds.Verified on a real cluster
Built into an image and run on kind end to end: the k8s suite (
tests/e2e/k8s/05-udproute.sh) installs the UDPRoute CRD, stands up a socat UDP echo backend, and asserts the datagram port is forwarded (k8s-udproute-okcomes back). 46/46 in the k8s suite, 128/128 on the Docker suite (no regression), plus 6 new unit tests.Review
Codex confirmed it's a faithful copy — distinct
k8s-gateway-udp/id prefix (no collision with tcp/tls/http), backends/weight/ReferenceGrant handling faithful to TCP, no protocol-string crossover, correctSCOPE_SUBSCRIBERS = 4, clean factory wiring.The one point it raised is the pre-existing ReferenceGrant kind-blindness carried over from #130: grants are keyed by
(from_ns, to_ns)without the route kind, so a grant for one kind admits another in the same namespace. Documented onallows_backend_ref(now mentioning UDPRoute too) and left for the dedicated Gateway API hardening pass, not widened into this PR.