Skip to content

Commit

Permalink
Merge pull request #364 from jsturtevant/fix-network-ns
Browse files Browse the repository at this point in the history
Add the shim to to the network NS specified
  • Loading branch information
Mossaka authored Oct 26, 2023
2 parents 5a9f656 + b936b92 commit 5a0a47a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
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

0 comments on commit 5a0a47a

Please sign in to comment.