Fix sandbox hostname resolution for sub-containers#728
Merged
Conversation
Sub-containers in a sandbox were getting auto-generated hostnames from containerd that didn't match anything in /etc/hosts or DNS. This caused processes like Erlang's EPMD (used by RabbitMQ) to fail immediately on startup because they couldn't resolve their own hostname. Three changes to align hostname handling with how Kubernetes pods work: 1. Set an explicit hostname on the pause container via oci.WithHostname so it gets a deterministic name derived from the sandbox ID rather than a random containerd container ID. 2. Share the UTS namespace from the pause container to sub-containers so they all see the same hostname (matching the existing pattern for network, IPC, and time namespaces). 3. Use the same hostname string in /etc/hosts so hostname resolution succeeds for processes that look themselves up.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
✅ Files skipped from review due to trivial changes (1)
📝 WalkthroughWalkthroughA helper Comment |
The saga path calls BuildSpec which already includes the hostname and UTS namespace changes, so no separate saga file changes are needed.
evanphx
approved these changes
Apr 3, 2026
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.
Sub-containers in a sandbox were getting auto-generated hostnames from containerd that didn't match anything in
/etc/hostsor DNS. This went unnoticed because none of the existing addon processes (valkey, postgres, mysql) resolve their own hostname at startup. Erlang's EPMD does, and it dies immediately if it can't, which surfaced this during RabbitMQ addon work.The sandbox architecture already shares network, IPC, and time namespaces between the pause container and sub-containers, but UTS (the namespace that holds the hostname) was missing. This meant each sub-container got a random containerd-generated hostname like
250a27c3c755while/etc/hostsmapped a different name to127.0.0.1.The fix aligns with how Kubernetes pods handle this: set an explicit hostname on the pause container, share the UTS namespace to sub-containers, and make sure
/etc/hostsagrees.Test plan
epmd_errorafter ~6 seconds)