Skip to content

fix(proxy): drop aether-tcp ALPN — TCP floor reuses the HTTP transport path - #304

Merged
bpalermo merged 1 commit into
mainfrom
fix/tcp-floor-drop-alpn
Jun 24, 2026
Merged

bpalermo merged 1 commit into
mainfrom
fix/tcp-floor-drop-alpn

Conversation

@bpalermo

Copy link
Copy Markdown
Owner

The bespoke aether-tcp ALPN forced a duplicated TCP transport-socket stack where all three earlier fixes (#298/#299/#301) lived, yet upstream_cx_total=0 persisted. Collapse onto the standard h2 ALPN: egress TCP socket sends no ALPN, inbound no-SNI HCM matches [h2], TCP floor becomes the default chain. Reuses the validated HTTP per-source mTLS path; removes the duplicated TCP stack + AetherTCPALPN. Validate: echo-tcp → 200.

…sport path

The bespoke "aether-tcp" ALPN forced a duplicated TCP-specific transport-socket
stack (UpstreamTCPTransportSocket, the :tcp matches/OnNoMatch) parallel to the proven
HTTP one — and all three earlier floor fixes (#298/#299/#301) lived in that copy,
yet the upstream mTLS still never connected (upstream_cx_total=0).

Collapse the demux onto the standard h2 ALPN instead:
- Egress: UpstreamTCPTransportSocket now advertises NO ALPN (HTTP keeps "h2"); it
  otherwise reuses the same per-source matcher/matches machinery that already works.
- Inbound :15008: the no-SNI HCM chain matches application_protocols:["h2"]; per-port
  HCM chains keep their port SNI; the TCP floor becomes the listener's DEFAULT chain
  (no match). Envoy precedence (server_names > application_protocols > default) routes
  h2+SNI → per-port, h2 → default-HCM, no-ALPN mTLS → the floor — no bespoke token.
- Removed the AetherTCPALPN constant.

This deletes the duplicated TCP transport stack that harbored the per-source-cert
selection bug, so the floor rides the validated HTTP per-source mTLS path. Validate
on talos: echo-tcp.aether.internal:18081 (HTTP over the mTLS TCP floor) -> 200.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Claude-Session: https://claude.ai/code/session_01N7oY7W8oDXrqDzFgoZh25S
@bpalermo
bpalermo merged commit 8df3f8b into main Jun 24, 2026
9 checks passed
@bpalermo
bpalermo deleted the fix/tcp-floor-drop-alpn branch June 24, 2026 21:54
bpalermo added a commit that referenced this pull request Jun 24, 2026
…or blocker) (#305)

Definitive root cause of the TCP-floor passthrough resetting (curl 000), after the
transport-socket fixes turned out to be red herrings: the tcp:<svc> EDS endpoints
were eds_health_status=UNHEALTHY, and NewTCPServiceCluster's HealthyPanicThreshold=0
gives an all-unhealthy cluster ZERO traffic (upstream_cx_none_healthy). The mTLS
never failed — the LB just had no healthy host.

Why unhealthy: aether's delegated liveness is HTTP — the agent promotes an EDS-mode
endpoint to HEALTHY only when appHealth(HealthProbeClusterName) (an HTTP probe) passes.
That can't happen for a TCP service (raw mTLS passthrough, no HTTP health surface),
so its endpoints stay UNHEALTHY forever.

Fix: the liveness loop treats protocol==PROTOCOL_TCP pods as healthy (skips the HTTP
app-health probe). A protocol-aware TCP-connect liveness is a follow-up. Also fixed a
stale ingress.go comment from #304 (the inbound floor is now the default chain, not
ALPN "aether-tcp").

Validate on talos: echo-tcp.aether.internal:18081 (HTTP over the mTLS TCP floor) -> 200.


Claude-Session: https://claude.ai/code/session_01N7oY7W8oDXrqDzFgoZh25S

Co-authored-by: Claude Opus 4.8 <[email protected]>
bpalermo added a commit that referenced this pull request Jun 24, 2026
…d HCM → 503) (#306)

With the endpoints healthy (#305) and the floor connecting (upstream_cx_total>0),
echo-tcp still 503'd: the inbound HCM was handling the connection
(listener.inbound.http.inbound.downstream_rq_5xx), not the TCP floor.

Cause: captureTCPClusters passed httpEntry.sni (the destination port, e.g. "8080")
to the TCP floor cluster's transport socket. So the egress floor connection presented
SNI="8080", and the destination inbound's per-port HCM chain (server_names:["8080"])
out-ranks the inbound TCP floor's default chain (Envoy precedence: server_names >
application_protocols > default). The connection landed on the HCM, which can't parse
the raw TCP stream → 503.

Fix: pass an empty SNI for the TCP floor cluster. With no SNI, the no-ALPN floor
connection (post #304) matches no per-port chain and no "h2" chain, so it falls to the
inbound default TCP floor chain (tcp_proxy → app loopback) — the actual passthrough.

This is the last piece of the floor data path (with #305 + #304). Validate on talos:
echo-tcp.aether.internal:18081 (HTTP over the mTLS TCP floor) -> 200.


Claude-Session: https://claude.ai/code/session_01N7oY7W8oDXrqDzFgoZh25S

Co-authored-by: Claude Opus 4.8 <[email protected]>
bpalermo added a commit that referenced this pull request Jul 2, 2026
…ped (#460) (#463)

The 'in progress / not yet shipped' list was fully stale: the TCP-over-mTLS floor
(#295/#304), Phase 3b L4 routes (#296), VirtualHost retirement (#292), MCS phase 1,
and conformance (both profiles hard-gated) have all landed. Documents the tcp
protocol-declaration chain (endpoint.aether.io/protocol -> PROTOCOL_TCP ->
aether.io/app-protocol -> /32 floor chain) and the destination-IP-beats-ALPN
filter-chain-match gotcha.


Claude-Session: https://claude.ai/code/session_01N7oY7W8oDXrqDzFgoZh25S

Co-authored-by: Claude Opus 4.8 <[email protected]>
bpalermo added a commit that referenced this pull request Sep 21, 2026
* docs(proposal): multi-protocol ports on one mesh service (037)

A mesh workload is classified HTTP or TCP for the whole pod, and by
extension the whole service: "A service is HTTP or TCP, never both, so the
two sets never share a name" (cache/cluster.go:202). A pod serving an HTTP
API on :8080 and a raw-TCP protocol on :9000 cannot say so, and the mesh
Service is generated per ServiceAccount, so splitting is not an option the
user has.

Draft only -- no code changes, nothing accepted.

The constraint is not the map key. The TCP floor's mesh hop carries no SNI
and no ALPN (deliberately -- #304, #306), so the destination has exactly one
default floor chain and it forwards to the pod's primary port. Fixing the
c.clusters collision alone yields "HTTP ports plus one TCP port", not
multi-TCP-port.

Proposes the per-port model -- a port has a protocol, a service has ports --
by extending the existing endpoint.aether.io/ports suffix grammar with
"=tcp", keeping endpoint.aether.io/protocol as the per-port default so every
current manifest keeps its meaning. Capture chains gain destination_port,
which Envoy evaluates ahead of prefix_ranges and which resolves the
"/32 outranks the HCM catch-all" conflict that forces the invariant today.

Phased so the fix that does not need any of it ships first: Phase 0 is #878
alone (podToEndpoint honours protocol, and populates Ports -- the kubernetes
backend has never carried 005's per-port EDS membership either), on the
existing invariant.

Each risk states what would make its gate fail, with negative controls, and
the two process gates are labelled as such rather than dressed as data-plane
ones (#853).

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr

* docs(proposal): 037 — dedicated TCP mesh port + scheme-typed resolution

Revision from the PR #881 review. The first draft resolved the bare name to
"the primary port, in the primary's protocol", which re-introduced the
asymmetry the proposal exists to remove.

- Add ProxyTCPOutboundPort = 18082 beside 18081 (free tree-wide; the only
  hits are an arbitrary test argument in l4route_test.go). 18081 is HTTP,
  18082 is TCP, for every service.
- A portless URL resolves by its scheme's default port: http:// is 80 and
  HTTP by definition, https:// is 443 and TCP iff the app registered it.
  Raw TCP names its port because it has no scheme. HTTP demuxes on the
  authority header; TCP demuxes on the 5-tuple - that distinction is now
  the justification for the scheme, not a wart.
- http://svc/ needs NO new config: the HCM chain has no destination-port
  criterion and RDS matches the portless authority today. Documented
  intent only. A destination_port:80 chain is listed as rejected.
- http:// to a service with no HTTP port: 421 direct_response vhost with
  x-aether-error, replacing today's unnamed cluster_not_found 503.
- https:// to a mesh service: option (a) refuse deterministically via a
  name-only 443 Service port (kube-proxy REJECT); (b) terminating app TLS
  at the capture listener is scoped out as its own proposal.
- The portless /32 floor chain and its special cases collapse into one
  uniform destination_port chain; :18082 works under scoped capture (CNI
  rule extended), per-app-port TCP still needs redirect-all (two tiers).
- Generated mesh Services expose 18081, 18082 and name-only 80/443, and
  the generator must converge Spec.Ports (it converges annotations only
  today; the MCS clusterset VIP create is create-only).
- New Risk 9: registrar advertises :18082 before a node's agent can serve
  it -> ECONNREFUSED within one RTT, gated by a negative-control e2e.
- "Require a port from every caller" recorded under Alternatives.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr

* docs(proposal): accept 037 and record Phase 0 as shipped

Phase 0 landed as #888: the kubernetes backend honours
endpoint.aether.io/protocol and populates Ports. Two deviations from the
proposal text, both found in the writing, are recorded in place:

  - the shared parser landed as a leaf package //registry/endpointmeta rather
    than a registry.PortProtocols helper, because //registry/internal/k8s
    importing its parent interface package is the wrong direction;
  - the health-check-mode parser was deliberately NOT shared -- the two
    backends disagree on the UNSET case (EDS vs UNSPECIFIED) and unifying them
    would have silently flipped the CNI registration path.

Also records that only e2e/uds.sh runs on the chart-default kubernetes
backend; every other suite, l4routes.sh included, forces etcd, which is #878's
complaint in harness form.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr

---------

Co-authored-by: Claude Opus 5 <[email protected]>
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