Add Gateway API TLSRoute support for TLS passthrough - #126
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
TLSRoutesupport, routing TLS connections to backends by the SNI in the ClientHello without decrypting. Builds on thesnifield and Sōzu wiring from #125. Closes theGateway API: TLSRouteboard item.Design
The listener port must be pre-declared. A Gateway TLS listener on port
8443is served only if aproxy.tcpentry already binds it. Sōzune binds TCP ports at startup and never opens one from a Gateway alone — the same rule the Docker path follows, kept so startup state stays predictable. A route on an undeclared port is tracked but unserved, and reactivates on the next reload once the listener is declared.Passthrough only.
tls.mode: Terminatemeans the Gateway decrypts, which is what HTTPS entrypoints are for, so such a listener is ignored here.No new dependency, no new watcher scaffolding. The
gateway-apicrate we already use ships theTLSRoutetypes (experimental module). TheparentRefacceptance rules — shared with HTTPRoute — were generalised over a smallParentReftrait rather than duplicated.TLSRouteisv1alpha2/experimental, so the watcher probes for the CRD and exits quietly when absent.Verified on a real cluster
This was built into an image and run on kind end to end, not just unit-tested. That is how the two infra bugs surfaced: the ClusterRole was missing
tlsroutes(watcher silently stopped), and the CRD probe reported a 403 as a missing CRD (an operator with incomplete RBAC would chase the wrong thing). Both fixed; the probe now distinguishes 404 / 403 / other. The k8s suite (tests/e2e/k8s/03-tlsroute.sh) drives a self-signed backend through passthrough and asserts the cert the client sees is the backend's.Bugs caught in review, all fixed
A Codex review of the diff found four correctness bugs:
:8443listener could be installed on:443and stranded off:8443. Now grouped per port, each listener serving only the names its ownhostnameadmits — which also lifts the single-port limitation.k8s-gateway-tls-{ns}-{name}leta-b/canda/b-ccollide, one route evicting the other from shared storage. Separator changed to/, which cannot occur in a Kubernetes name.validate_sniis now extracted into the model and shared with the Docker-label path; an invalid name is dropped with a warning, the route's other names still serve.notify_onewith two subscribers left the other waiting out its 2s tick — a regression from adding the second watcher. Now posts one permit per watcher.The TLSRoute CRD
Vendored on its own (
tlsroute-crd-v1.2.0.yaml, 45 KB) rather than swapping in the full 834 KB experimental bundle, which would also pull TCPRoute/UDPRoute/BackendTLSPolicy that Sōzune does not serve.