mirror of
https://github.com/faas-rs/faasd-in-rust.git
synced 2025-06-09 08:16:47 +00:00
fix(ctrd):移动cni创建逻辑到容器创建过程 (#87)
This commit is contained in:
parent
7cbe9361db
commit
02a0f8777a
@ -67,7 +67,7 @@ async fn deploy(config: &FunctionDeployment) -> Result<(), CustomError> {
|
|||||||
namespace
|
namespace
|
||||||
);
|
);
|
||||||
|
|
||||||
ContainerdManager::new_task(&config.service, &namespace, &config.image)
|
ContainerdManager::new_task(&config.service, &namespace)
|
||||||
.await
|
.await
|
||||||
.map_err(|e| {
|
.map_err(|e| {
|
||||||
CustomError::OtherError(format!(
|
CustomError::OtherError(format!(
|
||||||
|
@ -75,6 +75,7 @@ impl ContainerdManager {
|
|||||||
};
|
};
|
||||||
|
|
||||||
Self::do_create_container(container, ns).await?;
|
Self::do_create_container(container, ns).await?;
|
||||||
|
Self::prepare_cni_network(cid, ns, image_name)?;
|
||||||
|
|
||||||
Ok(())
|
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?;
|
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_create_task(cid, ns, mounts).await?;
|
||||||
Self::do_start_task(cid, ns).await?;
|
Self::do_start_task(cid, ns).await?;
|
||||||
Ok(())
|
Ok(())
|
||||||
|
Loading…
x
Reference in New Issue
Block a user