Bind HTTPRoutes to specific Gateway listeners#123
Merged
Conversation
…nd listener hostname
5f7fc83 to
c39a3f4
Compare
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
The Gateway provider treated every
Gatewayas an opaque(namespace, name)and never read itsspec.listeners[]. So a route'sparentRef.sectionName/parentRef.portwas ignored (a route bound to the whole Gateway regardless), and a listener'shostnamedidn't narrow what the route served. This wires listener selection and hostname narrowing through the scope.This is the provider-only half of "listener-driven port binding" — the genuinely useful, self-contained part. Actually serving traffic on each listener's own
port(multiple live HTTP ports from one Gateway) needs dynamic Sōzu HTTP-listener creation, which doesn't exist yet; that is left as a separate, larger change (noted in the docs).What changed
ScopeState.gatewaysgoes fromHashSet<(ns,name)>toHashMap<(ns,name), Vec<ListenerInfo>>, keeping each listener'sname,port, andhostname.upsert_gatewaynow also notifies when an accepted Gateway's listener set changes (not just on in/out-of-scope flips), so a listener edit re-resolves dependent routes.parentRef.sectionName/parentRef.port—accepts_parent_refresolves these against the Gateway's listeners:sectionNamemust equal a listenername,portmust equal a listenerport, and when both are set the same listener must satisfy both. An unsetsectionName/portstill binds to the whole Gateway (unchanged behaviour). A ref naming a listener the Gateway doesn't have is refused (route out of scope → 404).hostnameonly serves route hostnames that match it (exact, or a shared suffix for a single leading*.wildcard). A route with no hostnames inherits the listener's. When no bound listener admits any of the route's hostnames, the route resolves to nothing on that Gateway.Tests
02-gateway.sh+gateway-manifests.yaml): a route withsectionName: http(an existing listener) is served (200); a route withsectionName: ghost(no such listener) is refused (404). Verified end-to-end on kind against a local image build: 35 passed, 0 failed.cargo fmt --check,clippyclean; full unit suite 697 passed.Docs
Kubernetes provider docs:
sectionName/portand listener-hostname narrowing moved from "not supported" to the honoured-features list, with the remaining multi-port-binding gap called out explicitly.