From 06308fbf969862f870e821349576362acb94defd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Rop=C3=A9?= Date: Tue, 7 Nov 2023 16:45:59 +0100 Subject: [PATCH] agent: fix annotation to allow cri-o support of CoCo pullimage in guest MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The pullimage handler behaves differently for the sandbox and container, and it uses the annotations to differentiate between the two. The annotation name used by crio for container-type being different than the containerd one, we need to check both. Fixes: #8399 Signed-off-by: Julien Ropé --- src/agent/src/image_rpc.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/agent/src/image_rpc.rs b/src/agent/src/image_rpc.rs index a3d7664874..963ca2a0b6 100644 --- a/src/agent/src/image_rpc.rs +++ b/src/agent/src/image_rpc.rs @@ -207,7 +207,16 @@ impl ImageService { ) -> Result { info!(sl(), "image metadata: {:?}", image_metadata); Self::set_proxy_env_vars(); - if image_metadata["io.kubernetes.cri.container-type"] == "sandbox" { + let is_sandbox = if let Some(value) = image_metadata.get("io.kubernetes.cri.container-type") + { + value == "sandbox" + } else if let Some(value) = image_metadata.get("io.kubernetes.cri-o.ContainerType") { + value == "sandbox" + } else { + false + }; + + if is_sandbox { let mount_path = Self::unpack_pause_image(cid, "pause")?; self.add_image(String::from(image), String::from(cid)).await; return Ok(mount_path);