fix(ctrd):移动cni创建逻辑到容器创建过程 (#87)

This commit is contained in:
火花 2025-04-24 20:44:07 +08:00 committed by GitHub
parent 7cbe9361db
commit 02a0f8777a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 3 deletions

View File

@ -67,7 +67,7 @@ async fn deploy(config: &FunctionDeployment) -> Result<(), CustomError> {
namespace
);
ContainerdManager::new_task(&config.service, &namespace, &config.image)
ContainerdManager::new_task(&config.service, &namespace)
.await
.map_err(|e| {
CustomError::OtherError(format!(

View File

@ -75,6 +75,7 @@ impl ContainerdManager {
};
Self::do_create_container(container, ns).await?;
Self::prepare_cni_network(cid, ns, image_name)?;
Ok(())
}
@ -136,9 +137,8 @@ impl ContainerdManager {
}
/// 创建并启动任务
pub async fn new_task(cid: &str, ns: &str, image_name: &str) -> Result<(), ContainerdError> {
pub async fn new_task(cid: &str, ns: &str) -> Result<(), ContainerdError> {
let mounts = Self::get_mounts(cid, ns).await?;
Self::prepare_cni_network(cid, ns, image_name)?;
Self::do_create_task(cid, ns, mounts).await?;
Self::do_start_task(cid, ns).await?;
Ok(())