Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use youki's libcontainer APIs to implement wasmtime shim. #142

Merged
merged 36 commits into from
Jul 10, 2023
Merged
Show file tree
Hide file tree
Changes from 28 commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
407b883
Update youki to the latest main branch and oci-spec to 0.6.1.
Mossaka Jun 12, 2023
8ca83f2
Merge remote-tracking branch 'upstream/main' into oci-0.6.1
Mossaka Jun 13, 2023
c555e3f
Removed some uses of unsafe in wasmedge shim
Mossaka Jun 13, 2023
fc1bb2e
Use youki's libcontainer APIs to implement wasmtime shim.
Mossaka Jun 13, 2023
83ed1a2
Fix some clippy warnings
Mossaka Jun 14, 2023
d8e4c1a
Merge remote-tracking branch 'upstream/main' into wasmtime-youki
Mossaka Jun 14, 2023
d3b7f69
Passed the test_delete_after_create test
Mossaka Jun 21, 2023
d998250
Merge remote-tracking branch 'upstream/main' into wasmtime-youki
Mossaka Jun 21, 2023
feb93fc
This commit adds a new crate called "containerd-shim-common".
Mossaka Jun 21, 2023
47ce17d
Apply suggestions from code review
Mossaka Jun 23, 2023
363f1cd
Resolved some review comments
Mossaka Jun 23, 2023
6882dd5
Removed common crate and moved the library to containerd-shim-wasm and
Mossaka Jun 23, 2023
fc33358
Rollback accidentally deleted deps
Mossaka Jun 23, 2023
b606b25
Removed the libcontainer feature
Mossaka Jun 23, 2023
8c9e43d
Fixed the test_wasi test
Mossaka Jun 28, 2023
11c2e20
Add trace to "cargo test" in CI
Mossaka Jun 28, 2023
839442a
Merge remote-tracking branch 'upstream/main' into wasmtime-youki
Mossaka Jun 28, 2023
80cd742
Temp commit to run tests on ubuntu 22.04 only
Mossaka Jun 28, 2023
ebad282
Rollback ubuntu 20.02 test in CI
Mossaka Jun 29, 2023
560356f
Use the same determine root logic from wasmedge shim
Mossaka Jun 29, 2023
4b106b2
Fixed clippy issues
Mossaka Jun 29, 2023
51182c6
Reset stdio at the end of the tests
Mossaka Jun 29, 2023
7ca42a1
Need rollback: commenting out the stdio thing
Mossaka Jun 29, 2023
8d5c858
Use inherit_stdio()
Mossaka Jun 29, 2023
65177c3
Setup CI build env for wasmtimie e2e
Mossaka Jun 30, 2023
bb1e940
Add inpsection step to e2e-wasmtime
Mossaka Jun 30, 2023
e120093
Add deps to kind nodes that run k8s tests
Mossaka Jul 5, 2023
76fa9cb
Merge remote-tracking branch 'upstream/main' into wasmtime-youki
Mossaka Jul 5, 2023
f7472fb
Handle Result types from dup and dup2 in both wasmtime and wasmedge s…
Mossaka Jul 6, 2023
d807601
Small refactoring
Mossaka Jul 6, 2023
3f31397
Update crates/containerd-shim-wasmtime/src/executor.rs
Mossaka Jul 6, 2023
2c64834
Merge branch 'wasmtime-youki' of https://github.com/Mossaka/runwasi i…
Mossaka Jul 6, 2023
729c3b4
Add a log to when Errno::ECHILD was returned
Mossaka Jul 6, 2023
a28fad9
Merge remote-tracking branch 'upstream/main' into wasmtime-youki
Mossaka Jul 7, 2023
aaaea73
Resolve comments
Mossaka Jul 9, 2023
dfc680d
Rustfmt
Mossaka Jul 9, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,19 @@ jobs:
- uses: actions/checkout@v3
- name: setup rust-wasm target
run: rustup target add wasm32-wasi
- name: Setup OCI runtime build env
run: |
sudo apt -y update
sudo apt install -y pkg-config libsystemd-dev libdbus-glib-1-dev build-essential libelf-dev libseccomp-dev libclang-dev
- name: run
run: make test/k8s
run: |
make test/k8s
# only runs when the previous step fails
- name: inspect failed pods
if: failure()
run: |
kubectl get pods --all-namespaces
kubectl describe pods --all-namespaces
- name: cleanup
if: always()
run: make test/k8s/clean
Expand Down
174 changes: 3 additions & 171 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ members = [
"crates/oci-tar-builder",
"crates/containerd-shim-wasmedge",
"crates/containerd-shim-wasmtime",
"benches/containerd-shim-benchmarks",
]

[workspace.package]
Expand All @@ -18,6 +17,7 @@ homepage = "https://github.com/containerd/runwasi"

[workspace.dependencies]
anyhow = "1.0"
containerd-shim-wasm = { path = "crates/containerd-shim-wasm" }
serde = "1.0"
serde_json = "1.0"
env_logger = "0.10"
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ fix:

.PHONY: test
test:
cargo test --all --verbose
RUST_LOG=trace cargo test --all --verbose -- --nocapture

.PHONY: install
install:
Expand Down
2 changes: 1 addition & 1 deletion crates/containerd-shim-wasm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,4 @@ rand = "0.8"
[features]
default = []
generate_bindings = ["ttrpc-codegen"]
generate_doc = []
generate_doc = []
10 changes: 8 additions & 2 deletions crates/containerd-shim-wasm/src/sandbox/instance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ pub struct InstanceConfig<E>
where
E: Send + Sync + Clone,
{
/// The wasm engine to use.
/// The WASI engine to use.
/// This should be cheap to clone.
engine: E,
/// Optional stdin named pipe path.
Expand Down Expand Up @@ -104,21 +104,27 @@ where
}
}

/// Represents a wasi module(s).
/// Represents a WASI module(s).
/// Instance is a trait that gets implemented by consumers of this library.
pub trait Instance {
/// The WASI engine type
type E: Send + Sync + Clone;

/// Create a new instance
fn new(id: String, cfg: Option<&InstanceConfig<Self::E>>) -> Self;

/// Start the instance
/// The returned value should be a unique ID (such as a PID) for the instance.
/// Nothing internally should be using this ID, but it is returned to containerd where a user may want to use it.
fn start(&self) -> Result<u32, Error>;

/// Send a signal to the instance
fn kill(&self, signal: u32) -> Result<(), Error>;

/// Delete any reference to the instance
/// This is called after the instance has exited.
fn delete(&self) -> Result<(), Error>;

/// Set up waiting for the instance to exit
/// The Wait struct is used to send the exit code and time back to the
/// caller. The recipient is expected to call function
Expand Down
Loading