Repository navigation
Description
Split out of #813, which is being closed as an umbrella. This is the only entry on that list that is ordinary test debt rather than "an error branch that has not fired yet".
The gap
L4 routing (proposal 018 Phase 3b) is shipped, default-on and unconditional — the --l4-routes flag was retired in proposal 031, and each route type is now gated only on its Gateway API CRD being installed. The projector is shared with the edge (common/l4project, #783), so a defect there reaches two data paths.
There is:
- no CI e2e for
TCPRoute,TLSRouteorUDPRoute; - no L4 route of any kind on talos-main.
So the only thing standing behind a default-on feature on two code paths is unit tests of the projector.
This is not theoretical for this area. The TCP floor shipped three production bugs that only an e2e found (#461 / #464 / #466), and weight: 0-as-drain was wrong until #492.
Acceptance
A CI e2e (alongside the existing conformance jobs, which are hard-gated) that exercises at minimum:
- TCPRoute, weighted across two backends, asserting the split — including
weight: 0meaning drain, not equal share (fix(l4route): honor weight:0 as drain, don't normalize to 1 #492 was exactly this) - TLSRoute, asserting SNI selects the right backend, and that a different matching SNI selects the other backend (a one-direction assertion passes even if SNI is ignored and chain 0 always wins)
- TLSRoute fall-through, asserting a non-matching SNI reaches the TCP floor — see the correction below
- UDPRoute, asserting only that the
udp_proxylistener carries traffic at all — not that it selects between backends, which is impossible today (see UDPRoute ignores backend weights and collapses multiple services onto one cluster #873) — and noting that UDP rides the mesh in plaintext, since mTLS is a TCP/TLS construct
Each assertion should be seen red once before it is trusted green, and the PR should carry that output: this area has already shipped one gate that could not fail (#853).
Not in scope
The six other items on #813 are error branches that have never fired in production, which is the system working rather than debt. Where one is worth pinning down it belongs in an in-process test — as #805 already did for #804 — not in a tracking checklist.
Correction: the TLSRoute criterion above was wrong as originally written
I first wrote "a non-matching SNI does not fall through to a default". That is not what the code does, and testing for it would have asserted a bug.
BuildCaptureTLSRouteFilterChains (agent/internal/xds/proxy/l4route.go:121-147) gives each SNI chain a match of prefix_ranges: <ClusterIP>/32 plus server_names, and those chains sit alongside the TCP floor chain, which matches the same /32 with no server_names. Envoy selects filter chains by specificity, so:
- SNI matches a rule → the more specific chain (IP +
server_names) wins; - SNI matches nothing → the chain with no
server_namesconstraint wins, i.e. it reaches the TCP floor, deliberately.
The code says so: "these chains are inserted AFTER the per-ClusterIP TCP floor chain (so the ClusterIP match takes precedence for non-TLSRoute traffic)", and the /32 is there so a TLSRoute for service A cannot hijack service B's connections carrying the same SNI — since a client can set any SNI it likes.
So fall-through is the designed behaviour and should be asserted positively: make the TLS parent itself TLS-speaking, and assert a third hostname reaches the floor backend and yields neither of the TLSRoute backends. That is a real assertion rather than the absence of one.
Write the assertion after observing the behaviour, not before. This criterion was written from an assumption about how SNI routing "should" work and was wrong about our own code; the same risk applies to the rest of the list.
UDP scope, per #873: GenerateUDPCaptureListener sets a bare Cluster route specifier taken from the first backend of the first sorted service, so backend weights are discarded and a second UDPRoute-backed service on the node silently has no effect. A "UDPRoute picks the right backend" test would therefore fail by design rather than find a bug. This issue covers delivery only; selection is tracked in #873.
Activity
docs(runbook): record the known-unexercised code paths (#813) (#869)
bpalermo commentedon Sep 20, 2026
Plan
I read the implementation before deciding, and two things I found change the acceptance list.
They are flagged inline rather than buried: the TLSRoute "does not fall through to a default"
criterion describes something different from what the code does, and the UDPRoute criterion as
written is not implementable against the current
udp_proxybuilder.1. Where these belong: a new
e2e/l4routes.shkind harness (nightly, hard-gated), plus three cheap additions to//test/envoy_validateNot the conformance jobs. Upstream gateway-api v1.6.2 has no mesh L4 profile — the profiles
are GATEWAY-HTTP/TLS/GRPC and MESH-HTTP/GRPC. The TCPRoute/TLSRoute/UDPRoute tests that exist
upstream are Gateway-parented (north–south, experimental, no profile), and aether's mesh L4 path
parents routes to a Service, which the upstream suite cannot express.
weight: 0as drain hasno upstream test in any profile, so #492 would still be invisible. And
test/conformance/conformance_test.gois not compiled in this repo at all — it only builds insidea gateway-api checkout (self-replace module), so an aether-specific assertion cannot be added
without forking the suite. Conformance is the wrong shape here, and would still be the wrong shape
if upstream added an L4 mesh profile, because the aether-specific parts (drain, floor fallback)
are not conformance statements.
Not Go integration tests.
tags = ["integration"]targets run testcontainers (etcd inDocker). No pod netns, no nftables REDIRECT, no Envoy. All three assertions are about the kernel
redirect plus Envoy filter-chain selection.
Not
//test/e2e:e2e_test(the per-PR kind job). It applies raw manifests foragent + cni-install + registrar only — no proxy, no controller, no mesh-dns, no chart. It asserts
DaemonSet readiness and CNI behaviour, not the data path. Making it chart-based would be a rewrite
of the per-PR gate to serve one feature.
e2e/uds.shis the right shape and the thing to copy. One kind cluster, helm-install of thereal chart with SPIRE off, real
aether-proxy, CNI capture on by default, a purpose-built testworkload built by Bazel and shipped inside the nightly
aether-imagesartifact,up|verify|downsubcommands,
dump_stateon every failure. It already proves the same class of claim — a deliverypath that cannot work unless the proxy really dialled it.
Wiring, all reuse:
l4-routesin.github/workflows/e2e.yaml,needs: build, hard by default and softunder the existing
softinput; addl4-routesto theonlychoice list and toreport-failure'sneeds:— a job missing from that list fails silently at 04:17 UTC, whichis the Nightly e2e (waypoint + replicator) red since the mesh-DNS decoupling — harnesses never wait for aether-mesh-dns #589 / GH_REPO failure mode this repo has already had twice.
//e2e/l4echo:image_loadto thebuildjob's target loop and the image to itsdocker savelist, exactly as
udsechois handled.(
experimental-install.yaml,GATEWAY_API_VERSION: v1.6.2).Reconciler.SetupWithManager(
agent/internal/l4route/reconciler.go:73) gates each type oncrdcheck.Present(mapper, …)— aRESTMapper lookup at setup time, at
gateway.networking.k8s.io/v1only, with no v1alpha2fallback. A CRD applied after the helm install needs an agent restart.
uds.shalready has thisordering for
EndpointPolicy; copy the pattern and the comment.charts/aether/templates/agent-rbac.yaml:57already grantstcproutes/tlsroutes/udproutes(+ status), and there is no values gate since proposal 031. So noChart.yamlbump.//e2e:e2e_shellisglob(["*.sh"]).Plus a per-PR gate that is cheap and real.
//test/envoy_validateruns the pinned productionEnvoy binary in
--mode validateover aether-built bootstraps, andscripts/ci-impacted-targets.shclassifies it as a unit target, so it runs in the per-PRtestleg. Today
builders.gohas a capture bootstrap with a plain TCP floor and nothing for L4 routes.Three builders to add (§5). It is the only place the
udp_proxylistener can be provenEnvoy-acceptable without the kernel path, it costs seconds, and it gates every PR instead of once
a night.
2. Fixtures
One new test binary
e2e/l4echo— Go, distroless,go_multi_arch_image, thee2e/udsechoBUILD pattern verbatim — with three modes:
--mode=tcp --text=X:9000X <line>, close--mode=tls --text=X:9443X--mode=udp --text=X:9001X <datagram>to the senderWhy our own binary rather than
istio/tcp-echo-server:1.3(what the 2026-07-02 talos validationused): TLS and UDP need a server we control anyway; three third-party images in kind is more
moving parts; and the istio image holds the connection open, which is the loadgen trap
recorded in the #460 notes — success had to be counted from the captured payload rather than
curl's exit code, and every probe cost a full timeout.
l4echoclosing after the echo deletesthat whole class of harness bug.
Classification is load-bearing. An L4 chain only exists for a service the capture reconciler
classifies as non-HTTP: the generated mesh Service must carry
aether.io/app-protocol: tcp, whichcomes from the pod annotation
endpoint.aether.io/protocol: "tcp"(
agent/internal/capture/reconciler.go:120). That applies to the parent (no annotation → nofloor chain to replace → no L4 chain at all) and to every backend (the
tcp:cluster is onlyemitted by
captureTCPClusters()for TCP-classified services, so an unclassified backend leaves adangling weighted-cluster reference). The TLS workloads are TLS at the application layer and still
need
protocol: tcpat the mesh layer.Namespace
aether-test; identity is the ServiceAccount; pods carryaether.io/managed: "true",endpoint.aether.io/protocol: "tcp"(tcp + tls workloads) andendpoint.aether.io/port.No hand-written Services — the registrar generates the mesh VIP Service and deliberately skips
a name a non-aether Service already owns; hand-writing one suppresses the VIP and breaks
resolution (the comment is already at
e2e/uds.sh:197).Workloads — one parent per leg, so the legs are independent and can run in any order:
l4-front— TCPRoute parent; tcp mode, textfloor.l4-a(alpha),l4-b(bravo) — tcp mode, the TCPRoute backends.l4-tls-front— TLSRoute parent; tls mode, texttls-floor. Deliberately TLS-speaking, seeT2.3.
l4-tls-a(tls-alpha),l4-tls-b(tls-bravo) — tls mode, the TLSRoute backends.l4-udp-a(udp-alpha) — udp mode.client— two containers:curlimages/curlandbusybox(fornc -u), annotatedconfig.aether.io/upstreams: l4-front.aether-test,l4-a.aether-test,….That upstreams annotation is not an optimisation: there is no ODCDS for
tcp_proxy. Anundeclared TCP upstream gives a chain that matches and a cluster that is missing.
Convergence signal. The reconciler writes route status under controllerName
gateway.aether.io/mesh(agent/internal/gatewaystatus/status.go:30). Every apply/patch waits on.status.parents[?(@.controllerName=="gateway.aether.io/mesh")].conditions[?(@.type=="Accepted")].status == Truebefore probing, then polls the data path. Far better than a sleep, and it separates "the agent
never saw the route" from "the agent saw it and routed wrong" in the failure output. Note
ResolvedRefsdoes not check backend existence (backendsResolve), so status alone is notsufficient — it is a gate, not an assertion.
Also worth knowing while writing fixtures: an L4
backendRef.portis ignored (thetcp:/udp:cluster's endpoints already carry the port), so do not assert on it.
3. The three tests
T1 — TCPRoute: weighted split, and
weight: 0as drainProbe:
echo probe-$i | curl -s --max-time 5 telnet://l4-front.aether-test.aether.internal:9000,counting reply prefixes. Payloads ≥6 bytes deliberately — a shorter first write is what stalled the
capture listener's inspectors in #466.
floor. Thisis what proves the probe can tell backends apart; without it the rest is unfalsifiable.
l4-split,parentRefs: [{kind: Service, name: l4-front}](group empty/core; a nil
Kindis silently skipped), backendRefsl4-aweight 75 /l4-bweight 25. 200 probes. Assert zero
floor,alpha ≥ 1,bravo ≥ 1, andalpha/200 ∈ [0.60, 0.90]. Written as a sampling assertion on purpose —weighted_clustersis aper-connection random draw; at n=200 the sd on 0.75 is ~3%, so the band is ~5σ and will not
flake, while still failing a 50/50 or a 100/0. That reasoning goes in the script next to the
numbers.
weight: 0is drain, both directions (the fix(l4route): honor weight:0 as drain, don't normalize to 1 #492 assertion). Patch tol4-a: 100, l4-b: 0→bravo == 0andalpha == 200, exactly, not a band — drain isabsolute. Then mirror:
l4-a: 0, l4-b: 100→alpha == 0,bravo == 200. The mirror is notpadding — a single-direction assertion passes trivially if the projector were dropping
l4-bforan unrelated reason.
floor.Pins the behaviour the fix(l4route): honor weight:0 as drain, don't normalize to 1 #492 commit message claims (
buildWeightedTCPProxy→ nil →buildCaptureTCPFloorFilterChain), which nothing checks end to end today.floor. Proves the route, not the fixture, was doingthe work.
T2 — TLSRoute: SNI selects the backend
TLSRoute.Spec.Hostnamesis route-level, not rule-level (agent/internal/l4route/reconciler.go:222)and is copied onto every rule of that route — so two SNI→backend mappings mean two TLSRoute
objects, each with one hostname and one backendRef, both parented to
l4-tls-front.Probe:
curl -sk --max-time 5 --resolve <sni>:9443:$VIP https://<sni>:9443/, where$VIPisl4-tls-front's ClusterIP. The URL hostname is the SNI.a.l4.test→ bodytls-alpha, nevertls-bravo, nevertls-floor. 10/10.b.l4.test→ bodytls-bravo, 10/10. The mirror again — a single-SNI test passesif the implementation ignored SNI and always took the first chain.
prefix_ranges: <ClusterIP>/32plusserver_names, and sit on the same listener as theparent's per-ClusterIP TCP floor chain, which matches the same
prefix_rangeswith noserver_names(agent/internal/xds/proxy/capture.go:106). Envoy selects filter chains byspecificity, not list order, and a chain without
server_namesis a wildcard on SNI — so anon-matching SNI lands on the floor, and there is a default, by design
(
BuildCaptureTCPRouteFilterChainexplicitly falls back tobuildCaptureTCPFloorFilterChain).Making
l4-tls-fronta TLS-speaking workload turns that into a positive, nameable outcomeinstead of "curl failed for some reason":
SNI
c.l4.test→ bodytls-floor, and neithertls-alphanortls-bravo.Two assertions in one: the SNI chains did not claim it, and it went exactly where the design says
it goes. (Had the parent been unclassified it would instead hit
cap_passthrough→passthrough_original_dst, plaintext to the original destination — worth a comment so a futurereader does not "fix" the annotation.)
Still: write T2.3 after observing it once, and put that observation in the PR. If
c.l4.testreachesl4-tls-a, that is a real bug found on day one, which is the outcome worthhoping for.
a.l4.testreturnstls-floor, nottls-alpha.T3 — UDPRoute: honest scope only
The acceptance item as written is partly not implementable, and I would rather say so than write
a test that asserts a feature we do not have.
GenerateUDPCaptureListener(
agent/internal/xds/proxy/l4route.go:175) builds one UDP listener per pod covering allUDPRoute-backed services, and its
RouteSpecifieris a bareClusternaming the first backend ofthe lexicographically first service key. Weights are ignored on the UDP path and
weighted_clustersforudp_proxyis explicitly deferred. So:design, and writing one to match would be authoring a test to match a bug.
"no UDPRoute → no listener → datagrams discarded" semantics.
Port, and this one is a trap: redirect-all is TCP-only (
programCaptureRedirectAllinstallsredirectAllTCPExprs;cni/internal/plugin/capture.go). UDP capture comes solely from thescoped table,
meta l4proto udp · ip daddr <ClusterIP> · udp dport 18081 → :18001, which isalways installed for managed pods. So the UDP probe must target 18081
(
meshconst.ProxyOutboundPort); any other UDP port is never captured.nc -u -w2 l4-udp-a.aether-test.aether.internal 18081withping-1→ no reply.On its own this is a vacuous gate, and the script must say so: the generated mesh Service
exposes 18081/TCP only, so "no reply" is indistinguishable from "nothing is wired at all". It is
evidence only as the first half of a pair.
udp-alphain ≥8 of 10 attempts —UDP is lossy, so a strong majority, and the script says why rather than pretending 10/10 is safe.
any one alone is not.
The plaintext property is asserted structurally in
envoy_validate— theudp:cluster isSTATIC with an inline load assignment rewriting every endpoint to
protocol: UDPat thebackend's application port, with no transport socket (
egress.go:365,UDPLoadAssignmentat
:397, wired atcache/capture.go:456). That is the concrete shape of "no mTLS, no DTLS, andno inbound mesh hop": udp_proxy dials
pod_ip:<app port>directly. A wire-level assertion in theshell harness would be decoration; the harness gets the comment, envoy_validate gets the assertion.
Optional cross-check, not a primary assertion. Envoy admin is bound to
127.0.0.1:9901in theproxy pod and nothing scrapes it, so reading it needs a
kubectl execthe other harnesses do notdo. If it proves easy, the useful ones are
cluster.<ns>/<svc>.upstream_cx_totalper backend(
alt_stat_nameis the namespace-qualified key, so the exported name is<ns>/<svc>, not thetcp:-prefixed cluster name), the per-chaintcp.cap_tcp_*/tcp.cap_tls_*_<i>.downstream_cx_total,udp.capture_udp_<pod>.downstream_sess_rx_datagrams, and the canarylistener.capture_<pod>.no_filter_chain_matchstaying 0. The payload-marker assertions stayprimary — they need no admin access and they survive a hot restart, which raw counters do not.
4. How each assertion gets seen RED
Two mechanisms, and I want both, because #853 was a gate that passed without being able to fail.
(a) Built-in negative controls, re-run every night. Every leg has a state in which the same
probe must produce a different, named outcome: T1.0 and T1.4 (
floor), T1.3 (all-drained →floor), T2.2 (mirror SNI), T2.3 (tls-floor), T2.4 (delete), T3.0/T3.2 (no route). These areassertions, not setup steps. The point is that the suite re-demonstrates its own discriminating
power on every run rather than once at review time — a gate that only ever observes one outcome
cannot distinguish "passing" from "not looking".
(b) A one-time deliberate-break log, pasted into the PR body.
alpha 0.49 outside [0.60,0.90]if w == 0 { w = 1 }in bothl4RulesToWeightedClustersandl4BackendsToWeightedClusters— and rebuild the agent imagebravo = 97, expected 0: the harness reproduces #492alpha/bravo, notfloorServerNamesfrom the chain match inBuildCaptureTLSRouteFilterChainsc.l4.testto thea.l4.testroute's hostnamesc.l4.testreturnstls-alpha, nottls-floorunix.IPPROTO_UDPrule inprogramCaptureRedirect, rebuild cni-installupinstead ofverifyThe #492 row is the load-bearing one. Reproducing a bug that actually shipped is stronger evidence
than any synthetic break: it shows the harness would have caught the thing that got through.
(c) One whole-suite falsification. Run the finished harness once against an agent built with
the L4 reconciler's watches removed. Every assertion must go red. Anything still green is
passing through kube-proxy and is not testing aether.
5.
//test/envoy_validateadditions (PR 1)Three builders in
test/envoy_validate/builders.go:CaptureTCPRouteBootstrapJSON— acap_tcp_*chain withTcpProxy_WeightedClustersover twotcp:clusters. Also assert in Go that a single surviving backend collapses to theTcpProxy_Clusterform (that collapse is what a drain produces, and it is currently only coveredat the unit layer).
CaptureTLSRouteBootstrapJSON— twocap_tls_*_<i>chains withprefix_ranges+server_nameson the same listener as the floor chain. This one has real catching power: Envoy rejects
overlapping/ambiguous filter chains outright, so it pins the coexistence the harness then
exercises at runtime.
CaptureUDPBootstrapJSON— the connection-lesscapture_udp_<pod>listener withudp_proxyasa listener filter and no
filter_chains(l4route.go records that Envoy rejects thealternative: "N filter chain(s) specified for connection-less UDP listener"), plus the STATIC
udp:cluster, with a Go assertion that it carries notransport_socket.6. What I would not build as specified
issue per finding): the single-
primaryCluster-per-pod shape is a real correctness limit thatthe code comment acknowledges as "the minimal viable control-plane shape" and nothing tracks —
two UDPRoute-backed services on one node silently share one cluster.
been exercised anywhere: the nft UDP REDIRECT inside the pod netns under kind's kernel; Envoy's
udp_proxyreceiving on a REDIRECTed socket; and the reply path — conntrack has to un-DNATEnvoy's response from
127.0.0.1:18001back toVIP:18081so the client's connected socketaccepts it, and the listener sets no
use_original_src_ip. The UDP data path was explicitlyparked on 2026-07-02 at the Gateway API Phase 3 — TCP-over-mTLS floor + L4 routes (proposal 018) #460 close-out and never picked up.
Handling: T3 is its own PR, built last. If the reply path does not work in kind, do not fake
it and do not land a skipped test — land the
envoy_validateudp_proxybootstrap as the honestcoverage and file the data-path gap as its own issue. A skipped test that looks like coverage is
worse than a documented gap.
uds.shand both conformance jobs. So it does notcover the
tcp:cluster's SAN pin — exactly the shape of fix(xds): TCP-floor SAN pin must use the bare SA name (020 regression) #464, the 020 SAN regression on the TCPfloor. That belongs in the script header as a stated limit. Covering it needs the waypoint job's
SPIRE setup; it is a separate issue ("run the L4 harness with SPIRE on"), not something to bolt
on here.
fresh connection through the full mesh path (~0.1–0.3s), so 200 probes is ~30–60s per phase; the
job fits the 45-minute budget
udsuses, but every probe needs a hard--max-timeor one slowphase eats the job timeout.
per Envoy generation, so a hot restart mid-run would corrupt any raw-value comparison.
test/conformanceshould not grow an L4 profile, now or when upstream adds one.Two pieces of drift noticed in passing, neither blocking:
wireL4Routes(
agent/internal/cmd/root.go:806) still comments "UDPRoute is control-plane only until the CNI UDPredirect lands" — it landed; and proposal 018 line 331 still describes Phase 3b as behind
--l4-routes.7. Estimate — four PRs
//test/envoy_validateL4 bootstraps — ~½ day. No infra; gates every PR immediately andde-risks the config shapes the harness then drives. Lands first because it is the cheapest thing
that is real.
e2e/l4echo+e2e/l4routes.sh+ e2e.yaml wiring + the TCPRoute leg (T1.0–T1.4) — ~1–2days. The bulk: new image target,
buildjob list,onlyinput,report-failureneeds, thestatus-based convergence wait,
await_prefix,dump_state. Carries the fix(l4route): honor weight:0 as drain, don't normalize to 1 #492 revert-redevidence.
make gazelleafter adding the binary.recording the observation.
dead end in kind does not hold up T1/T2.
test(envoy-validate): gate the three L4 listener shapes on every PR (#…
test(e2e): kind harness for Gateway API L4 routes — TCPRoute leg (#868)…
feat(agent): deliver every mesh Service to the capture listener (037 …
test(e2e): TLSRoute and UDPRoute legs for the L4 route harness (#868)
test(e2e): TLSRoute and UDPRoute legs for the L4 route harness (#868)
test(e2e): TLSRoute and UDPRoute legs for the L4 route harness (#868) (…