lifecycle: clear HOST_ADDRESS/LOCAL_ADDRESS/HOST_BRIDGE — start script's --network-veth was forcing private netns
This commit is contained in:
parent
59de7fa3c5
commit
07a5d3a778
1 changed files with 15 additions and 1 deletions
|
|
@ -341,13 +341,27 @@ fn set_nspawn_flags(container: &str, agent_dir: &Path) -> Result<()> {
|
||||||
.lines()
|
.lines()
|
||||||
.filter(|line| {
|
.filter(|line| {
|
||||||
let trimmed = line.trim_start();
|
let trimmed = line.trim_start();
|
||||||
|
// Strip any network-namespace knobs nixos-container's create
|
||||||
|
// might have populated. The start script adds `--network-veth`
|
||||||
|
// whenever HOST_ADDRESS / LOCAL_ADDRESS (or their IPv6 cousins)
|
||||||
|
// are non-empty — and veth implies a private netns, hiding our
|
||||||
|
// web-UI port from the host. Force host netns.
|
||||||
!trimmed.starts_with("EXTRA_NSPAWN_FLAGS=")
|
!trimmed.starts_with("EXTRA_NSPAWN_FLAGS=")
|
||||||
&& !trimmed.starts_with("PRIVATE_NETWORK=")
|
&& !trimmed.starts_with("PRIVATE_NETWORK=")
|
||||||
|
&& !trimmed.starts_with("HOST_ADDRESS=")
|
||||||
|
&& !trimmed.starts_with("LOCAL_ADDRESS=")
|
||||||
|
&& !trimmed.starts_with("HOST_ADDRESS6=")
|
||||||
|
&& !trimmed.starts_with("LOCAL_ADDRESS6=")
|
||||||
|
&& !trimmed.starts_with("HOST_BRIDGE=")
|
||||||
})
|
})
|
||||||
.map(str::to_owned)
|
.map(str::to_owned)
|
||||||
.collect();
|
.collect();
|
||||||
// Share host netns so per-agent web UI ports are reachable directly.
|
|
||||||
lines.push("PRIVATE_NETWORK=0".to_owned());
|
lines.push("PRIVATE_NETWORK=0".to_owned());
|
||||||
|
lines.push("HOST_ADDRESS=".to_owned());
|
||||||
|
lines.push("LOCAL_ADDRESS=".to_owned());
|
||||||
|
lines.push("HOST_ADDRESS6=".to_owned());
|
||||||
|
lines.push("LOCAL_ADDRESS6=".to_owned());
|
||||||
|
lines.push("HOST_BRIDGE=".to_owned());
|
||||||
lines.push(bind_flag);
|
lines.push(bind_flag);
|
||||||
let mut content = lines.join("\n");
|
let mut content = lines.join("\n");
|
||||||
content.push('\n');
|
content.push('\n');
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue