Fix local container sidecar routing#6791
Open
iGmainC wants to merge 1 commit into
Open
Conversation
|
All contributors have signed the CLA ✍️ ✅ |
Author
|
I have read the CLA Document and I hereby sign the CLA |
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.
What this fixes
Fixes #6790.
Local container startup could time out when the container egress sidecar was enabled. The failure showed up as repeated readiness-check aborts and, in some cases, a
kj/timer.c++:30timeout before the application container appeared usable from the Worker.Root cause
In local Docker mode, workerd previously used the sidecar's host-published ingress port for several local control and data paths:
/ca/egressconfigurationDockerPort::connect()That host-to-published-port route is not reliable with
proxy-everything's transparent proxying rules. Host-originated traffic to the published sidecar ingress port can be intercepted by the sidecar's TPROXY setup and hang instead of reaching the intended sidecar control endpoint or application port.The application container and the Sandbox server can be healthy, but workerd's local readiness path still times out because it is probing through the affected host-published sidecar route.
Solution
This changes the local Docker implementation to avoid host-originated requests to the sidecar's published ingress port:
/ca/ca.crt/egressby running a small Docker exec inside the sidecar and sending the request to127.0.0.1:39001from inside that containernc 127.0.0.1:<port>inside the sidecar network namespace, where127.0.0.1:<port>reaches the application container because it shares the sidecar network namespaceDocker exec attach streams are multiplexed when TTY is disabled, so the port bridge now wraps the stream and exposes stdout frames as the raw TCP byte stream.
Tests
bazel test //src/workerd/server:container-client-test@bazel build //src/workerd/server:workerd/workspace.