-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bridge networking #229
bridge networking #229
Conversation
buildkit has bridge networking already! This reverts commit ce3fd7a.
This introduces some maintenance burden: I'll have to build and push a This burden could be alleviated if and when Footnotes
|
Side note: it probably makes more sense to run services via the frontend gateway container flow. Running services using Following that change we could submit a PR upstream to have |
Hm, backpedaling a bit, it's pretty nice that using |
Switched to a new method for discovering the container IP. It's a bit more complicated but way more portable. The previous approach required the shim to call back to the host which didn't work reliably in tests and wouldn't work with a remote buildkit server. The new approach moves the container IP discovery server into the shim and runs it in a separate |
this was obviously broken! we would check if the cache already existed and return it, but then create the cache and start writing to it. now we'll create a temporary file and then rename it over the cache instead. this should fix all the really weird errors hitting bass-loop whenever hooks kick off concurrently.
Currently thunks runs in the same network namespace as the host. Bass was never designed for running untrusted thunks, so this isn't necessarily a bad thing1, but it has a major downside when it comes to running services: they're all competing for the same ports.
This PR configures CNI for Buildkit such that each thunk will run in its own network namespace using a bridge network to reach the host and other thunk addresses. Thunks can listen on whatever port they want without worrying about conflicts. Thunk addr values will now resolve to their target thunk's hostname instead of
127.0.0.1
, and this hostname will be mapped to the target container's IP via/etc/hosts
2I originally thought this wouldn't be possible until moby/buildkit#28 lands but it turns out Buildkit already has CNI support, it's just not configured in the
moby/buildkit
image. I've built a separatebasslang/buildkit
image instead which is justmoby/buildkit
with Bass's CNI config.The trickiest part here was getting the container IP back from Buildkit.
The current approach is to run a tiny stupid TCP server on the runtime host and have the container shim connect to it through the gateway and pipe its hostname over the socket. This doesn't feel incredible from a security standpoint but I've done my best to narrow any theoretical attack vector. Still a WIP.I think I landed on something pretty decent for this; see #229 (comment) for more details.Footnotes
I kind of like simplicity of it, more akin to Procfiles than Docker Compose ↩
Admittedly there isn't much point doing this because if the container IP changes the LLB will be different either way, but I like the 𝒶𝑒𝓈𝓉𝒽𝑒𝓉𝒾𝒸 ↩