Repository navigation
feat(agent): name the cause when HTTP meets a TCP-only service (037 diagnostics) - #899
Merged
Merged
Conversation
…iagnostics) Two diagnostics that replace errors describing the proxy's confusion with ones describing the caller's mistake. 421 for `http://<svc>/` when <svc> serves no HTTP port. The cache emitted the ordinary cap_http vhost for every in-scope service including TCP-only ones, pointing at an h2 cluster it never builds for them, so the caller got a 503 with cluster_not_found: deterministic, but indistinguishable from a cluster that vanished mid-reload, and it never reached ODCDS so even the coordinator's 404 did not occur. Such a service now gets a direct_response vhost — 421, the status defined as "cannot produce a response for this combination of scheme and authority", with x-aether-error: no-http-port and a body naming the TCP spellings to use instead. No application behind the mesh emits 421, so it cannot be mistaken for an app's own error, and it is immediate rather than waiting out a 2s ODCDS lookup that was never going to succeed. Whether a service has an HTTP port is read from the CACHE — it has one exactly when the HTTP pass built it a default entry — not from the app-protocol annotation. That is the same fact the vhost would point at, so the two cannot disagree, which is what #878 was. cap_tcp_blackhole for scoped capture. The CNI redirects :18082 unconditionally there (it cannot know which VIPs have TCP ports) and the scoped HCM chain is a catch-all with no match criteria, so raw TCP to :18082 on a service with no TCP port would hit the HCM and get a fabricated `HTTP/1.1 400` — the #460 shape. A last chain matching destination_port alone (less specific than every "/32 + port" chain, so it only catches what none of them claimed) sends it to a static endpoint-less cluster: immediate close, counted in cluster.blackhole.upstream_cx_none_healthy. Not emitted under redirect-all, where passthrough -> kube-proxy REJECT is already attributable. The blackhole cluster is emitted BEFORE the #877 identity gate, because its chain is likewise ungated: it carries no transport socket and terminates connections rather than forwarding them, so it needs no SVID — and gating the cluster alone would leave the chain naming something absent. That last point was caught by the chain-to-CDS gate from #895, not by review: adding the chain without the cluster failed immediately with "filter chain cap_tcp_blackhole names cluster blackhole, which is not in the snapshot". Third occurrence of that hazard in this proposal, first one a gate caught before I did. Negative controls: suppressing the 421 vhost fails the TCP-only case while the HTTP case still passes — a 421 for a service that DOES serve HTTP would be an outage, not a diagnostic. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
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.
The two remaining Phase 2 diagnostics. Both replace an error describing the proxy's confusion with one describing the caller's mistake.
421 for
http://<svc>/when the service serves no HTTP portThe cache emitted the ordinary
cap_httpvhost for every in-scope service including TCP-only ones, pointing at an h2 cluster it never builds for them. The caller got a 503 withcluster_not_found— deterministic, but indistinguishable from a cluster that vanished mid-reload, and it never reached ODCDS so even the coordinator's 404 didn't occur.Such a service now gets a
direct_responsevhost:421 is the status defined as "the server is not able to produce a response for the combination of scheme and authority" — precisely this case. No application behind the mesh emits it, so it can't be confused with an app's own 404/503, and it's immediate rather than waiting out a 2s ODCDS lookup that was never going to succeed.
Whether a service has an HTTP port is read from the cache — it has one exactly when the HTTP pass built it a default entry — not from the
app-protocolannotation. That's the same fact the vhost would point at, so the two can't disagree. Which is what #878 was.cap_tcp_blackholefor scoped captureThe CNI redirects
:18082unconditionally in scoped mode (it can't know which VIPs have TCP ports), and the scoped HCM chain is a catch-all with no match criteria. So raw TCP to:18082on a service with no TCP port would hit the HCM and receive a fabricatedHTTP/1.1 400— the #460 shape.A last chain matching
destination_portalone — less specific than every/32 + portchain, so it only catches what none of them claimed — sends it to a static, endpoint-less cluster: immediate close, counted incluster.blackhole.upstream_cx_none_healthy.Not emitted under redirect-all, where passthrough → kube-proxy REJECT is already attributable.
The gate caught me again
The blackhole cluster is emitted before the #877 identity gate, because its chain is likewise ungated — it carries no transport socket and terminates connections rather than forwarding them, so it needs no SVID. Gating the cluster alone would leave the chain naming something absent.
I didn't notice that; the chain-to-CDS gate from #895 did, immediately:
Third occurrence of that hazard in this proposal, and the first one a gate caught before I did.
Negative controls
Suppressing the 421 vhost fails the TCP-only case while the HTTP case still passes — a 421 for a service that does serve HTTP would be an outage, not a diagnostic.
bazel build //...clean, 109 tests pass, lint clean.🤖 Generated with Claude Code
https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr