Repository navigation
feat(agent): make the TCP capture listener transparent (038, ahead of the CNI change) - #946
Merged
Merged
Conversation
… the CNI change)
PR 2 of the TPROXY plan. Adds `transparent: true` to the per-pod TCP capture
listener and nothing else. Lands BEFORE the CNI rules change, on purpose.
WHY FIRST. nft `tproxy` assigns a packet only to a socket that has
IP_TRANSPARENT; to any other socket it is a no-op and the packet finds nothing.
So the CNI's divert rules (PR 3) without this listener would break all captured
TCP. Under today's REDIRECT the option is harmless: original_dst still tries
SO_ORIGINAL_DST first (Envoy utility.cc:361-376) and the conntrack NAT entry is
there. Flipping `transparent` also makes Envoy treat the socket options as
incompatible, so it creates new per-worker sockets and drains the old listener
for every pod -- with both socket sets briefly in one SO_REUSEPORT group. That
restart must bake under REDIRECT, not coincide with the rule switch.
WHAT IT DOES NOT DO. use_original_dst and the original_dst listener filter stay,
first in the filter list. On a diverted flow SO_ORIGINAL_DST still succeeds (the
flow is tracked, just not NATed -- e2e/spike/tproxy-phase0b.py T1 measured
10.250.0.7:8080) and original_dst is what sets localAddressRestored(), which
the ORIGINAL_DST passthrough cluster requires. A future "transparent makes
original_dst redundant" would silently break the passthrough.
GATES, each seen red before commit:
- capture_test.go pins transparent beside use_original_dst ("transparent set
(038)" on a false probe).
- test/envoy_validate TestCaptureTCPListenerIsTransparentAndKeepsOriginalDst
asserts the PAIR on the fixture stock Envoy validates. Its first draft had
the wrong package name, so gazelle left it out of the target and the probe
passed vacuously -- fixed, and the red state re-proven ("tproxy will not
assign to a non-transparent socket").
- //charts/aether:aether_proxy_net_admin_test pins the NET_ADMIN grant against
the packaged chart (red on NET_ADMIN -> NET_RAW). IP_TRANSPARENT is checked
as CAP_NET_ADMIN in the userns owning the pod netns, and Envoy's
supportsIpTransparent() probe runs once in the host netns; both fail
SILENTLY without it.
Refs #916
Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
charts/aether/BUILD.bazel gained a helm_template_test; the chart-version-bump gate requires a Chart.yaml bump for any charts/ change. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
…lermo/aether into feat/tproxy-pr2-transparent-listener
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.
PR 2 of the TPROXY plan. Adds
transparent: trueto the per-pod TCP capture listener and nothing else — and lands before the CNI rules change, on purpose. Refs #916.Why first
nft
tproxyassigns a packet only to a socket that hasIP_TRANSPARENT; to any other socket it is a no-op and the packet finds nothing. So the CNI's divert rules (PR 3) without this listener would break all captured TCP.Under today's REDIRECT the option is harmless —
original_dststill triesSO_ORIGINAL_DSTfirst (utility.cc:361-376) and the conntrack NAT entry is there. Flippingtransparentalso makes Envoy treat the socket options as incompatible, so it creates new per-worker sockets and drains the old listener for every pod, with both socket sets briefly in oneSO_REUSEPORTgroup. That restart bakes under REDIRECT rather than coinciding with the rule switch.What it deliberately does not do
use_original_dstand theoriginal_dstfilter stay, first in the list. On a diverted flowSO_ORIGINAL_DSTstill succeeds — the flow is tracked, just not NATed; the Phase 0b spike measured10.250.0.7:8080— andoriginal_dstis what setslocalAddressRestored(), which theORIGINAL_DSTpassthrough cluster requires. A future "transparent makes original_dst redundant" would silently break the passthrough. Theenvoy_validatetest asserts the two as a pair for that reason.Gates, each seen red before commit
capture_test.gopinstransparentbesideuse_original_dsttransparent set (038)on afalseprobeTestCaptureTCPListenerIsTransparentAndKeepsOriginalDst(envoy_validate)tproxy will not assign to a non-transparent socket//charts/aether:aether_proxy_net_admin_testNET_ADMIN → NET_RAWWorth noting: the envoy_validate test's first draft had the wrong package name (
envoyvalidatevsenvoy_validate), so gazelle left it out of the target and the first probe passed vacuously. Caught because the unit pin went red while this one stayed green — fixed, re-proven.The chart gate exists because
IP_TRANSPARENTis checked asCAP_NET_ADMINin the userns owning the pod netns, and Envoy'ssupportsIpTransparent()probe runs once in the host netns; both fail silently without the grant.Verification
bazel test //...all pass, lint clean, three gates red-then-green.🤖 Generated with Claude Code
https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr