Repository navigation
test(e2e): TLSRoute and UDPRoute legs for the L4 route harness (#868) - #912
Merged
Merged
Conversation
The kind L4 harness has covered TCPRoute since #879. This adds the two remaining legs, which is the rest of #868's acceptance. TLSRoute (T2.0-T2.4). The parent and both backends now speak TLS, so #868's corrected fall-through criterion can be asserted POSITIVELY: a third, unmatched SNI must reach the FLOOR backend by name, not merely fail to reach A or B (an absence is also satisfied by a dropped connection). SNI selection is asserted in both directions, because a one-way assertion stays green if the SNI chains are ignored entirely and chain 0 always wins. The probes dial a port NO filter chain claims, and that is load-bearing. BuildCaptureTLSRouteFilterChains matches ClusterIP/32 + server_names with no destination_port; proposal 037 then gave every TCP-primary service destination_port-qualified floor chains for :18082 and its own primary port. Envoy resolves destination_port first and consults the portless bucket only when no chain claims the exact port, so a TLS dial to either of those ports lands on the floor and the SNI chains are never considered. Dialing an unclaimed port leaves exactly the portless candidates -- the SNI chains and 037's any-port shim -- which is what makes T2.1/T2.2 and T2.3 a real comparison. Two consequences are stated in the header rather than left to be rediscovered: TLSRoute is reachable today only through a shim 037 Phase 4 proposes to remove, and port-qualifying the SNI chains would move this dial port. UDPRoute (T3.0-T3.2). Delivery only, per #868's scope note: the per-pod udp_proxy carries a bare single-cluster RouteSpecifier, so asserting backend selection would fail by design rather than find a bug (#873). The 100/0 shape T3.1 uses is the one shape both implementations must agree on -- today's path takes backends[0] and a weight-honouring one must DRAIN the weight-0 backend (#492) -- so the assertion survives #873's fix unchanged. The mirror is deliberately absent: it IS the #873 case. UDP rides the mesh in plaintext and the header says so; a passing T3 is not evidence of an authenticated UDP path. Every leg keeps the suite's negative controls, so each probe re-proves its own discriminating power on every run rather than once at review time (#853): three `floor` states for TCP, three for TLS, and two `unanswered` states for UDP. A missing CRD is a hard failure here rather than a clean skip. `up` installs all three and now gates on all three being served at v1; a leg that skips itself green cannot fail, which is the defect this suite exists to avoid. NOT EXECUTED AGAINST A CLUSTER. bash -n and the shellcheck gate are green, the rendered manifests were validated against the gateway-api v1.6.2 CRD schemas offline, and the chain-selection reasoning above is read from the generators -- but no run has happened. The UDP data path in particular has never been exercised anywhere (parked 2026-07-02), so T3 is the leg most likely to be red first. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
bpalermo
force-pushed
the
feat/868-l4-route-e2e
branch
from
September 23, 2026 10:20
a9c7c88 to
e7724b0
Compare
bpalermo
enabled auto-merge (squash)
September 23, 2026 10:39
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.
Closes #868.
The kind L4 harness has covered TCPRoute since #879. This adds the TLSRoute and UDPRoute legs, which is the rest of #868's acceptance list.
What runs now
alpha.l4tls.test→l4tls-abravo.l4tls.test→l4tls-bnomatch.l4tls.test→ the FLOOR, while the other two still reach their own backendsl4udp-a, none by the weight-0 backendThis has not been run — not on kind, not on talos-main. The parent session owns cluster access and will run it there. Everything that was verified is listed under "Evidence" below; I am not claiming a green run I did not have.
The UDP leg in particular has never been exercised anywhere: the UDP data path was parked on 2026-07-02 and has only ever been touched as control-plane config since. If the first real run shows the reply path does not survive kind, the honest outcome is to file that as its own issue and cut T3 back to what
//test/envoy_validatealready gates (#876) — not to mark it skipped. A skipped test that looks like coverage is worse than a documented gap.Why the TLS probes dial a port nothing binds
This is the one non-obvious design decision, and it is load-bearing.
BuildCaptureTLSRouteFilterChainsmatchesprefix_ranges: <ClusterIP>/32+server_namesand nodestination_port. Proposal 037 then gave every TCP-primary servicedestination_port-qualified floor chains (:18082and the service's own primary port) plus a portless any-port shim. Envoy resolvesdestination_portfirst and consults the portless bucket only when no chain claims the exact port — so a TLS dial to the primary port, or to:18082, lands on the port-qualified floor chain and the SNI chains are never considered.So T2 dials
8443, which no chain claims. The surviving candidates are then exactly the portless ones: the SNI chains and 037's any-port shim. That is what makes "same client, same port, three SNIs, three different answers" a real comparison.Two consequences are written into the script header rather than left to be rediscovered, and are filed as #911: TLSRoute is reachable today only through a shim that 037 Phase 4 proposes to remove (and TLSRoute traffic increments the very counter Phase 4's removal is gated on); and if the SNI chains are ever port-qualified, T2's dial port has to move with them — at which point this suite goes red and says so, which is the point.
UDP: delivery only, and why that is not a cop-out
#868's own scope note rules UDP selection out: the per-pod
udp_proxycarries a bare single-clusterRouteSpecifier, so a "UDPRoute picks the right backend" test would fail by design rather than find a bug. That is #873, being fixed in parallel; this PR touches neithercommon/l4project/noragent/internal/l4route/.T3.1 still asserts a weight, because there is exactly one weight shape both implementations must agree on:
common/l4projectpreserves backendRef order and keepsweight: 0entries rather than dropping them, and the UDP path takesbackends[0].l4udp-ais listed first, so it wins.weight: 0means DRAIN (fix(l4route): honor weight:0 as drain, don't normalize to 1 #492), sol4udp-astill takes everything.A single
udpbravotherefore fails under both, and the assertion survives #873's fix unchanged. The mirror (0/100) is deliberately absent: that one is the #873 case, and adding it would mean landing a test that must stay red until an unrelated PR merges.UDP rides the mesh in plaintext — mTLS is a TCP/TLS construct, there is no DTLS, and the
udp:clusters carry no transport socket at all. Nothing here expects or asserts mTLS on that leg, and the header states that a passing T3 is not evidence of an authenticated UDP path.Sample counts, and why they separate the cases
The TCP leg's 200-probe band (#879) is unchanged; its sampling maths is in the script.
TLS is not sampled statistically at all. Filter-chain selection is deterministic — a match, not a load-balancing draw — so each phase asserts exhaustively: 20/20 for that SNI's marker and zero of anything else. One stray answer is a defect, not noise. The collapse bug this is meant to catch (SNI ignored, chain 0 always wins) shows up as
tlsalphaanswering thebravoprobe, i.e. on the first sample; 200 probes would buy nothing but runtime.UDP: 40 datagrams, also exhaustive (40
udpalpha, 0udpbravo, 0NOREPLY, 0 other) — again not a per-datagram draw under either implementation. 40 rather than 10 because the interesting non-deterministic failure here is a lossy path:nc -u -w 1makes each probe cost about a second, and a path dropping 5% of datagrams slips past a 10-sample run about 60% of the time but past a 40-sample run only about 13% of the time. 40 fits comfortably in the job's 60-minute budget.Evidence
The shellcheck gate covers the new file (the #853 check)
e2e/l4routes.shis in//e2e:e2e_shell. Proof that the gate can actually fail on these lines — canary inserted at line 1057, inside the newverify_tls_control:Canary removed, file byte-identical to before it was inserted:
bash -n e2e/l4routes.shclean.bazel run //:format.checkreports no finding on this file.Manifests validated offline against the real CRDs
The heredocs were rendered with
kcstubbed out, parsed as YAML, and checked against the gateway-api v1.6.2 experimental schemas:tlsroutes,udproutesandtcproutesall serve v1 withstorage: true— which the agent'scrdcheckrequires (it is v1-only, with no v1alpha2 fallback), and whichinstall_gwapi_crdsnow gates on for all three rather than only TCPRoute.TLSRoute.specrequireshostnames, andspec.rulescarriesmaxItems: 1— which is why two TLSRoute objects are needed rather than one route with two rules. UDPRoute has the samemaxItems: 1.Must have port for Service referenceCEL rule onbackendRefs; every backendRef here setsport.Hostnamepattern.parentRefssetsgroup: ""explicitly — the CRD default isgateway.networking.k8s.io, and the reconciler skips any parentRef whose group is non-empty.Falsifiability: what observed value makes each assertion fail
require_crd TLSRoutetlsroutesCRD absent or not served at v1 — hard die, not a skip (see below)l4tls-fronthas no registrar-generated mesh Service → empty ClusterIPtlsalpha/tlsbravo(SNI routing with no route applied) orNOREPLY(the TLS floor is not carrying traffic, or the handshake never completed)tlsfloor(the SNI chain lost the match — the port-shadowing case, #911),tlsbravo(wrong backend), orNOREPLYtlsalpha/tlsbravo(a chain matched a name it does not carry) orNOREPLY(the connection was dropped instead of falling through)tlsflooronalpha/bravo— i.e. both routes had silently stopped matching, which would otherwise read as a passing fall-throughtlsfloorafter both routes are deleted (chains outlived their routes)NOREPLY— the CNI's nftables UDP REDIRECT,udp_proxy's receive on the redirected socket, or conntrack un-DNATing the reply. The die message names all three and points at theUDPRoute input discardedlog line first, because a discarded backend is a different failure from a broken data pathnone == 0bravo == 0other == 0udpflooror an unknown marker — there is no UDP floor today, so observing one is itself a findingThe weak one, stated rather than hidden: T3.0's
NOREPLYhas two possible causes the probe cannot separate — redirect-to-nothing (the documented behaviour: "no UDPRoute = no listener = datagrams discarded"), or no redirect at all plus a mesh Service with no UDP port. It can still fail, so it is kept, but T3.1 does not rest on it.No assertion in the new legs is unfalsifiable: there is no
|| trueon a check, and nothing is gated behind an env var that CI does not set.Deliberate deviation: a missing CRD fails here, it does not skip
A missing Gateway API CRD normally deserves a clean skip. Not in this harness:
upinstalls all three CRDs itself, so their absence means a broken environment, and a leg that skips itself green in a suite whose whole job is catching silent L4 regressions is precisely the #853 defect.install_gwapi_crdsnow gates on all three beingEstablishedand served at v1, andrequire_crddies with a message telling you to runupfirst.Fixture changes
All
l4echoworkloads (including the pre-existing TCP ones) now carryrunAsNonRoot+seccompProfile: RuntimeDefaultat pod level andallowPrivilegeEscalation: false,readOnlyRootFilesystem: true,capabilities: drop [ALL]at container level. The image is already distroless/static running as uid 65532 (asserted by//e2e/l4echo's container test) and writes nothing to disk — the TLS cert is minted in memory at start-up — so this states what was already true rather than changing it.The client declares all nine services in
config.aether.io/upstreams. That is not an optimisation for L4:tcp_proxyandudp_proxyhave no ODCDS cold path, so an undeclared upstream produces a chain that matches and a cluster that does not exist, which looks exactly like a routing bug.Nightly wiring
The
l4-routesjob already exists and already feedsreport-failure, whose missingGH_REPO(#868's sibling finding) was fixed earlier — so nothing added here can fail silently. Changed: the verify step's name, and the diagnostics now capturetlsroutes/udproutes, the TLS and UDP parents' logs, and a grep of the agent log forUDPRoute input discarded, so a discarded backend (#873/#874) is distinguishable from a broken data path at triage time.🤖 Generated with Claude Code
https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr