Skip to content

feat(agent): port-qualified L4 route backends (037 Phase 3) - #897

Merged
bpalermo merged 1 commit into
mainfrom
feat/037-phase3-port-qualified-l4
Sep 22, 2026
Merged

bpalermo merged 1 commit into
mainfrom
feat/037-phase3-port-qualified-l4

Conversation

@bpalermo

Copy link
Copy Markdown
Owner

Proposal 037 Phase 3. Follows #895 (Phase 2 Release B, deployed to talos-main as rev233).

A TCPRoute/TLSRoute backendRef naming a specific raw-TCP port now resolves to that port's cluster.

What changed

common/l4project's ClusterNameFunc takes the backendRef's port. It was documented as "NOT port-qualified" because the TCP floor addressed one port per service and a port had nothing to select. Now that a service can carry several raw-TCP ports, ignoring it would silently send a route for :5432 to whatever the floor forwards to — a misroute with no error anywhere.

A ref with no port yields 0 and the service's default floor cluster: what every route written before this change resolves to.

The alias that makes the namer total

The cache now publishes tcp:<fqdn>:<port> for every TCP port, not only the non-primary ones. The primary's is an alias — same EDS as the floor, and no SNI, because the destination's default inbound chain serves it and a non-empty SNI would route it to a per-port chain that doesn't exist (#306).

Without that alias, a backendRef naming the primary port would resolve to a cluster absent from the snapshot, and tcp_proxy would kill those connections silently — the same Risk 1 shape as a chain without a cluster, reached from the other end. That's the third time this proposal's hazard has been an incomplete increment rather than a wrong line.

UDP deliberately unchanged

The UDP floor already addresses backends by their registered application port (proposal 018 Phase 3b), and 037 is a TCP/HTTP change. The parameter is accepted and dropped so the signature is shared; unifying the two is a later proposal's job.

Negative control

Ignoring backendRef.port — the pre-Phase-3 behaviour — fails the port-qualified case while the no-port case still passes. That split is what matters for the rollout: every existing route is in the second.

bazel build //... clean, 109 tests pass, lint clean.

Not included, and why

The GAMMA projector rejecting an HTTPRoute backendRef.port that resolves to a TCP port (ResolvedRefs=False / UnsupportedProtocol). The proposal lists this as an open question: ProjectHTTPRule also runs in the registrar's config-export controller, where there are no endpoints to classify against, so the projector cannot see the protocol from there.

The agent's cache already declines to build an h2 cluster for a TCP port, so such a route 503s rather than misrouting — loud, but late. Resolving it properly needs the protocol threaded through 026's export path, which is its own change.

🤖 Generated with Claude Code

https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr

A TCPRoute/TLSRoute backendRef naming a specific raw-TCP port now resolves to
that port's cluster.

common/l4project's ClusterNameFunc takes the backendRef's port. It was
documented as "NOT port-qualified" because the TCP floor addressed one port per
service and a port had nothing to select. Now that a service can carry several
raw-TCP ports, ignoring it would silently send a route for :5432 to whatever
the floor forwards to -- a misroute with no error anywhere.

A ref with no port yields 0 and the service's default floor cluster, which is
what every route written before this change resolves to.

The cache now publishes tcp:<fqdn>:<port> for EVERY TCP port, not only the
non-primary ones. The primary's is an ALIAS: same EDS as the floor and NO SNI,
because the destination's default inbound chain serves it and a non-empty SNI
would route it to a per-port chain that does not exist (#306). Without that
alias a backendRef naming the primary port would resolve to a cluster that is
not in the snapshot, and tcp_proxy would kill those connections silently --
the same Risk 1 shape as a chain without a cluster, reached from the other end.

UDP deliberately keeps ignoring the port: the UDP floor already addresses
backends by their registered application port (proposal 018 Phase 3b), and 037
is a TCP/HTTP change. The parameter is accepted and dropped so the signature is
shared; unifying the two is a later proposal's job.

Negative control: ignoring backendRef.port -- the pre-Phase-3 behaviour --
fails the port-qualified case while the no-port case still passes, which is the
split that matters for the rollout: every existing route is in the second.

NOT included: the GAMMA projector rejecting an HTTPRoute backendRef.port that
resolves to a TCP port (ResolvedRefs=False / UnsupportedProtocol). The proposal
lists it as an open question because ProjectHTTPRule also runs in the
registrar's config-export controller, where there are no endpoints to classify
against. The agent's cache already declines to build an h2 cluster for a TCP
port, so such a route 503s rather than misrouting -- loud, but late.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
@bpalermo
bpalermo merged commit 8fb1331 into main Sep 22, 2026
22 checks passed
@bpalermo
bpalermo deleted the feat/037-phase3-port-qualified-l4 branch September 22, 2026 00:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant