Repository navigation
test(e2e): kind harness for Gateway API L4 routes — TCPRoute leg (#868) - #879
Merged
Merged
Conversation
Adds e2e/l4routes.sh, the e2e/l4echo test backend, and a hard-gated `l4-routes` job in the nightly e2e workflow. Proposal 018 Phase 3b has had no end-to-end coverage at all: #492 (an explicit backendRef weight:0 normalised to 1, so "drain" meant "equal share") shipped and was found by hand, and no upstream conformance profile can express a Service-parented mesh L4 route. The TCPRoute leg only; TLSRoute and UDPRoute follow as separate PRs. Assertions, all against a real data path (kind + the real chart + the real aether-proxy + the CNI's transparent capture): T1.0 control no TCPRoute -> 20/20 probes reach the FLOOR T1.1 split 75/25 over 200 probes -> a justified band, never `floor` T1.2 drain weight 0 is DRAIN, asserted EXACTLY and in BOTH directions T1.3 all drained every weight 0 -> back to the FLOOR T1.4 delete no TCPRoute again -> back to the FLOOR T1.0/T1.3/T1.4 are permanent built-in negative controls, not setup: the same probe must produce a different NAMED answer in each state, so the suite re-demonstrates its own discriminating power on every run rather than once at review time (the #853 trap). The T1.1 band is derived, not guessed — the sampling maths is in the script next to the numbers. Seen RED by reverting the #492 hunk and rebuilding the agent image: T1.2a went red with "bravo took 1/200 connections at weight 0", and T1.3's state measured alpha=19 bravo=31 of 50 instead of 50 floor — the ~50/50 the original bug report describes. Reverting the revert returns the suite to green. Two preconditions the harness had to discover the hard way, both filed as their own issues and both documented in the script header: * SPIRE must be ON (#877). With --spire-enabled=false captureTCPClusters() publishes no "tcp:" clusters (no node SVID) and the cleartext inbound listener has no TCP floor chain, so an L4 suite copied from uds.sh tests nothing. Paying for SPIRE also buys coverage of the "tcp:" cluster's server SAN pin — the shape of #464. * The registry backend must be etcd (#878). The chart-default kubernetes backend returns nothing for PROTOCOL_TCP by design, so a pod annotated endpoint.aether.io/protocol: tcp is silently classified http and no TCP floor chain exists for a route to replace. No chart change, so no Chart.yaml bump: agent RBAC already covers tcproutes and L4 routing has had no values gate since proposal 031. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
bpalermo
added a commit
that referenced
this pull request
Sep 23, 2026
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
added a commit
that referenced
this pull request
Sep 23, 2026
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
added a commit
that referenced
this pull request
Sep 23, 2026
…#912) 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. Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr Co-authored-by: Claude Opus 5 <[email protected]>
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.
PR2 of #868. Adds the kind e2e harness and the TCPRoute leg only —
test/envoy_validate(PR1), TLSRoute (PR3) and UDPRoute (PR4) are untouched here.
What lands
e2e/l4routes.sh— one kind cluster, the real chart, the realaether-proxy, CNItransparent capture on by default,
up|verify|down,dump_stateon every failure.Modelled on
e2e/uds.sh.e2e/l4echo— the test backend.--mode=tcptoday (reads a line, writes<marker> <line>, closes);--mode=tlsand--mode=udpare implemented behind thesame flag surface so the later legs are a harness change only. Closing after the echo is
the point:
istio/tcp-echo-serverholds the connection open, which is what forced theGateway API Phase 3 — TCP-over-mTLS floor + L4 routes (proposal 018) #460 work to score probes from captured payload after a full timeout.
l4-routesjob in.github/workflows/e2e.yaml— hard by default, soft under theexisting
softinput, added to theonlychoice list and toreport-failure'sneeds:+RESULTS(a job missing from that list fails silently at 04:17 UTC — theNightly e2e (waypoint + replicator) red since the mesh-DNS decoupling — harnesses never wait for aether-mesh-dns #589 failure mode).
//e2e/l4echo:image_loadjoins thebuildjob's target loop andthe
docker savelist.No
charts/change, so noChart.yamlbump: agent RBAC already grantstcproutes, andL4 routing has had no values gate since proposal 031.
The assertions
l4-a75 /l4-b25floor, both backends non-zero, alpha/200 ∈ [0.60, 0.90]l4-a100 /l4-b0bravo == 0andalpha == 200, exactlyl4-a0 /l4-b100alpha == 0,bravo == 200T1.0 / T1.3 / T1.4 are the permanent built-in negative control, not setup. The same
probe, the same client, the same port must produce a different named answer in each
state, so the suite re-proves its own discriminating power on every nightly run instead
of once at review time — the #853 trap, where a gate passed because it could not fail.
The T1.1 band is derived, not guessed, and the maths is in the script beside the
numbers: alpha ~ Binomial(200, 0.75), sd = 6.12 connections = 3.06 points, so
[0.60, 0.90] is ±4.9σ (≈1e-6 flake per run) while still catching a 50/50 implementation
~99.7% of the time and a 100/0 one deterministically.
T1.2 is mirrored on purpose. A one-direction drain assertion passes trivially if the
projector were dropping
l4-bfor an unrelated reason — a bad ReferenceGrant decision, atypo, an unclassified backend with no
tcp:cluster. The mirror makes each backend proveit can be both the only target and the only drained one.
Every assertion seen RED — by reproducing #492, not by a synthetic break
Reverted the #492 hunk locally (
if w == 0 { w = 1 }restored in bothl4RulesToWeightedClustersandl4BackendsToWeightedClusters), rebuilt the agent image,rolled the DaemonSet, re-ran the suite:
The harness reproduces the bug that actually shipped, and the
dump_statethat followsprints the TCPRoute with its
Accepted=Truestatus — i.e. it says "the agent saw thisroute and routed it wrong", not "something failed".
T1.3's state under the same buggy agent, measured directly (the suite had already exited
at T1.2a):
That is the
~50/50the #492 report describes, and it matters for the suite's power:with the bug the weights become 100 and 1, so T1.2a alone misses it ~14% of the time
((100/101)^200 ≈ 0.138 that the drained backend draws nothing in 200 connections), while
T1.3 is deterministic. The two together catch #492 every run. That reasoning is now a
comment in
verify_drain, so nobody later "simplifies" T1.3 away.Reverting the revert, rebuilding and rolling returns the suite to green:
Working tree is clean of the revert; only the three new files and the workflow are in the
diff.
Two deviations from the plan in #868, both forced, both filed
The plan said "SPIRE off, like
uds.sh". That does not work, and the reason is worthrecording rather than working around silently.
SPIRE must be ON — TCP mesh services are silently unroutable when SPIRE is disabled #877. With
--spire-enabled=falsethe mesh has no TCP path ateither end. Source:
captureTCPClusters()returnsnilunless the node SVID is known,and
SetNodeIdentityis only ever called by the SPIRE bridge, which is not wired whenSPIRE is off — so no
tcp:clusters are published at all, while the capturelistener still gets its
cap_tcp_*chain naming a cluster that does not exist.Destination:
NewInboundListener(cleartext=true)emits a single default HCM chain; theinbound TCP floor chain exists only on the mTLS path. An L4 suite copied from
uds.shwould have been a test of nothing.
Silver lining: because SPIRE is on, this harness does exercise the
tcp:cluster'sserver-SAN pin end to end — the shape of fix(xds): TCP-floor SAN pin must use the bare SA name (020 regression) #464, which the plan had explicitly listed as
out of scope.
The registry backend must be etcd — endpoint.aether.io/protocol: tcp is silently downgraded to http on the kubernetes registry backend #878. The chart-default
kubernetesbackendreturns nothing for
PROTOCOL_TCPon purpose(
KubernetesRegistry.ListEndpoints/ListAllEndpoints), so a pod annotatedendpoint.aether.io/protocol: tcpis registered, then invisible: the registrar stampsapp-protocol: httpon the generated mesh Service, the capture reconciler classifies itHTTP, and there is no TCP floor chain for a route to replace. Observed directly:
etcd runs as a plain docker container on kind's network, exactly as the multicluster
harnesses run theirs.
Both are "configured, accepted and silently inert" — the failure mode this repo keeps
paying for — so each is filed as its own issue (#877, #878) rather than buried in a script
comment, and both are explained in the script header so the next reader does not repeat
the afternoon.
Other implementation notes worth a reviewer's eye
Reconciler.SetupWithManagergates each L4 type on a RESTMapper lookup at setup time,at
v1only — a CRD applied later needs an agent restart, and the suite would fail witha perfectly healthy agent that simply never watched the type. The script also asserts
TCPRoute actually serves
v1.parentRefs[].group: ""is explicit.ParentReference.groupdefaults togateway.networking.k8s.ioin the CRD schema andserviceParentsskips any non-emptygroup, so an omitted group silently yields a route attached to nothing.
our own
gateway.aether.io/meshAccepted=Truewith a matchingobservedGeneration(which separates "the agent never saw it" from "it routed wrong"), then polls small
probe batches until the expected state holds before running the measured batch — an
exact assertion must not straddle a config swap. Status alone is deliberately a gate and
not an assertion:
backendsResolvedoes not check that the backend Services exist.kubectl execper batch, not per probe; 200 exec round trips would dominateboth the runtime and the failure modes. Probe payloads are ≥6 bytes because a shorter
first write stalls the capture listener's inspectors (fix(capture): don't close short-first-write TCP conns stalled in the inspectors #466).
bash -nclean, andbazel build --config=lint --@aspect_rules_lint//lint:fail_on_violation //e2e:allpasses. Verified the gate is not vacuous: the first run of it failed on this very file
with
SC2016atprobe_batch, which is now an explained# shellcheck disable.//e2e/l4echo:image_test(container structure test) passes;make gazellerun, nogo mod tidy.Closes nothing on its own — #868 stays open for the TLSRoute and UDPRoute legs.
🤖 Generated with Claude Code
https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr