From 71afeccdf147a587509aaee658c69e480ea184f0 Mon Sep 17 00:00:00 2001 From: Fupan Li Date: Wed, 18 Sep 2024 13:26:34 +0800 Subject: [PATCH] agent: fix the issue of setup sandbox pidns When the sandbox api was enabled, the pasue container wouldn't be created, thus the shared sandbox pidns should be fallbacked to the first container's init process, instead of return any error here. Signed-off-by: Fupan Li --- src/agent/src/rpc.rs | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/src/agent/src/rpc.rs b/src/agent/src/rpc.rs index 9f13af0f04..9edea3cd81 100644 --- a/src/agent/src/rpc.rs +++ b/src/agent/src/rpc.rs @@ -1750,7 +1750,7 @@ fn update_container_namespaces( if !pidns.path.is_empty() { pid_ns.set_path(Some(PathBuf::from(&pidns.path))); } - } else { + } else if !sandbox.containers.is_empty() { return Err(anyhow!(ERR_NO_SANDBOX_PIDNS)); } } @@ -2527,14 +2527,6 @@ mod tests { .unwrap()], ..Default::default() }, - TestData { - namespaces: vec![], - sandbox_pidns_path: None, - use_sandbox_pidns: true, - result: Err(anyhow!(ERR_NO_SANDBOX_PIDNS)), - expected_namespaces: vec![], - ..Default::default() - }, TestData { has_linux_in_spec: false, result: Err(anyhow!(ERR_NO_LINUX_FIELD)),