Skip to content

Commit

Permalink
Merge pull request #155 from mxpv/cleanup
Browse files Browse the repository at this point in the history
Remove sync code from runc shim
  • Loading branch information
mxpv authored Aug 8, 2023
2 parents 8831fc1 + f1d2500 commit ad83804
Show file tree
Hide file tree
Showing 17 changed files with 26 additions and 2,148 deletions.
15 changes: 0 additions & 15 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -140,18 +140,3 @@ jobs:
TESTFLAGS_RACE: "-race"
run: sudo -E PATH=$PATH make integration
working-directory: src/github.com/containerd/containerd

- name: Install async shim
run: |
cargo build --release --all-features --bin containerd-shim-runc-v2-rs
sudo install -D ./target/release/containerd-shim-runc-v2-rs /usr/local/bin/
- name: Integration for async shim
env:
GOPROXY: direct
TEST_RUNTIME: "io.containerd.runc.v2-rs"
TESTFLAGS_PARALLEL: 1
EXTRA_TESTFLAGS: "-no-criu -test.skip='(TestContainerPTY|TestContainerExecLargeOutputWithTTY|TestTaskUpdate|TestTaskResize)'"
TESTFLAGS_RACE: "-race"
run: sudo -E PATH=$PATH make integration
working-directory: src/github.com/containerd/containerd
19 changes: 10 additions & 9 deletions crates/runc-shim/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
[package]
name = "containerd-runc-shim"
version = "0.1.1"
authors = ["Shaobao Feng <[email protected]>", "Tianyang Zhang <[email protected]>", "The containerd Authors"]
authors = [
"Shaobao Feng <[email protected]>",
"Tianyang Zhang <[email protected]>",
"The containerd Authors",
]
keywords = ["containerd", "shim", "containers"]
description = "Rust implementation of containerd's runc v2 shim runtime"

Expand All @@ -19,9 +23,6 @@ name = "containerd-shim-runc-v2-rs"
path = "src/main.rs"
doc = false

[features]
async = ["containerd-shim/async", "runc/async", "tokio", "futures", "async-trait"]

[dependencies]
log = "0.4"
nix = "0.26"
Expand All @@ -34,9 +35,9 @@ crossbeam = "0.8.1"
uuid = { version = "1.0.0", features = ["v4"] }

# Async dependencies
async-trait = { workspace = true, optional = true }
tokio = { workspace = true, features = ["full"], optional = true }
futures = { workspace = true, optional = true }
async-trait = { workspace = true }
tokio = { workspace = true, features = ["full"] }
futures = { workspace = true }

containerd-shim = { path = "../shim", version = "0.4.0" }
runc = { path = "../runc", version = "0.2.0" }
containerd-shim = { path = "../shim", version = "0.4.0", features = ["async"] }
runc = { path = "../runc", version = "0.2.0", features = ["async"] }
File renamed without changes.
File renamed without changes.
24 changes: 10 additions & 14 deletions crates/runc-shim/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,20 @@
limitations under the License.
*/

#[cfg(feature = "async")]
mod asynchronous;
use containerd_shim::asynchronous::run;

mod common;
mod console;
mod container;
mod io;
#[cfg(not(feature = "async"))]
mod synchronous;
mod processes;
mod runc;
mod service;
mod task;

#[cfg(not(feature = "async"))]
fn main() {
containerd_shim::run::<synchronous::Service>("io.containerd.runc.v2-rs", None)
}
use service::Service;

#[cfg(feature = "async")]
#[tokio::main]
async fn main() {
containerd_shim::asynchronous::run::<crate::asynchronous::Service>(
"io.containerd.runc.v2-rs",
None,
)
.await;
run::<Service>("io.containerd.runc.v2-rs", None).await;
}
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -718,7 +718,7 @@ mod tests {
use runc::error::Error::CommandFailed;
use tokio::fs::remove_dir_all;

use crate::{asynchronous::runc::runtime_error, common::LOG_JSON_FILE};
use crate::{common::LOG_JSON_FILE, runc::runtime_error};

#[tokio::test]
async fn test_runtime_error() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,20 +37,13 @@ use log::{debug, error, warn};
use tokio::sync::mpsc::{channel, Receiver, Sender};

use crate::{
asynchronous::runc::{RuncContainer, RuncFactory},
common::{create_runc, has_shared_pid_namespace, ShimExecutor, GROUP_LABELS},
container::Container,
processes::Process,
runc::{RuncContainer, RuncFactory},
task::TaskService,
};

mod console;
mod container;
mod processes;
mod runc;
mod task;

use container::Container;
use processes::Process;
use task::TaskService;

pub(crate) struct Service {
exit: Arc<ExitSignal>,
id: String,
Expand Down
70 changes: 0 additions & 70 deletions crates/runc-shim/src/synchronous/console.rs

This file was deleted.

Loading

0 comments on commit ad83804

Please sign in to comment.