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

Add the shim to to the network NS specified #364

Merged
merged 1 commit into from
Oct 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
7 changes: 7 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,10 @@ test/k8s/cluster-oci-%: dist/img-oci.tar bin/kind test/k8s/_out/img-oci-%
test/k8s-%: test/k8s/clean test/k8s/cluster-%
kubectl --context=kind-$(KIND_CLUSTER_NAME) apply -f test/k8s/deploy.yaml
kubectl --context=kind-$(KIND_CLUSTER_NAME) wait deployment wasi-demo --for condition=Available=True --timeout=90s
# verify that we are still running after some time
sleep 5s
kubectl --context=kind-$(KIND_CLUSTER_NAME) wait deployment wasi-demo --for condition=Available=True --timeout=5s


.PHONY: test/k8s/clean
test/k8s/clean: bin/kind
Expand All @@ -251,6 +255,9 @@ test/k3s-%: dist/img.tar bin/k3s dist-%
sudo bin/k3s kubectl apply -f test/k8s/deploy.yaml
sudo bin/k3s kubectl get pods --all-namespaces
sudo bin/k3s kubectl wait deployment wasi-demo --for condition=Available=True --timeout=120s
# verify that we are still running after some time
sleep 5s
sudo bin/k3s kubectl wait deployment wasi-demo --for condition=Available=True --timeout=5s
sudo bin/k3s kubectl get pods -o wide

.PHONY: test/k3s/clean
Expand Down
4 changes: 4 additions & 0 deletions crates/containerd-shim-wasm/src/sandbox/shim.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ use ttrpc::context::Context;
use super::instance::{Instance, InstanceConfig, Nop};
use super::{oci, Error, SandboxService};
use crate::sys::metrics::get_metrics;
use crate::sys::networking::setup_namespaces;

enum InstanceOption<I: Instance> {
Instance(I),
Expand Down Expand Up @@ -1210,6 +1211,9 @@ where
.unwrap_or(&id)
.to_string();

setup_namespaces(&spec)
.map_err(|e| shim::Error::Other(format!("failed to setup namespaces: {}", e)))?;

#[cfg(unix)]
mount::<str, Path, str, str>(
None,
Expand Down