From a1171e53b44178ad0f6c3100ace7cf3a5256064c Mon Sep 17 00:00:00 2001 From: Vaughn Dice Date: Fri, 2 Feb 2024 11:43:37 -0500 Subject: [PATCH 1/2] chore(*): update repo name Signed-off-by: Vaughn Dice --- Cargo.toml | 4 ++-- containerd-shim-spin/Cargo.toml | 4 ++-- containerd-shim-spin/quickstart.md | 8 ++++---- containerd-shim-spin/src/engine.rs | 1 + deployments/k3d/DockerSetup.md | 4 ++-- deployments/k3d/README.md | 6 +++--- deployments/k8s/all-in-one-demo.yaml | 2 +- deployments/workloads/workload.yaml | 2 +- images/spin-dapr/README.md | 4 ++-- images/spin/go-hello/go.mod | 2 +- 10 files changed, 19 insertions(+), 18 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 1cdc714..befc2a3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,8 +3,8 @@ version = "0.10.0" edition = "2021" license = "Apache-2.0" readme = "README.md" -repository = "https://github.com/deislabs/containerd-wasm-shims" -homepage = "https://github.com/deislabs/containerd-wasm-shims" +repository = "https://github.com/spinkube/containerd-shim-spin" +homepage = "https://github.com/spinkube/containerd-shim-spin" [workspace] diff --git a/containerd-shim-spin/Cargo.toml b/containerd-shim-spin/Cargo.toml index 6db3374..c7cc65f 100644 --- a/containerd-shim-spin/Cargo.toml +++ b/containerd-shim-spin/Cargo.toml @@ -3,9 +3,9 @@ name = "containerd-shim-spin-v2" version = "0.10.0" authors = ["DeisLabs Engineering Team"] edition = "2021" -repository = 'https://github.com/deislabs/containerd-wasm-shims' +repository = 'https://github.com/spinkube/containerd-shim-spin' license = "Apache-2.0" -homepage = 'https://github.com/deislabs/containerd-wasm-shims' +homepage = 'https://github.com/spinkube/containerd-shim-spin' description = """ Containerd shim for running Spin workloads. """ diff --git a/containerd-shim-spin/quickstart.md b/containerd-shim-spin/quickstart.md index 1be8302..731f079 100644 --- a/containerd-shim-spin/quickstart.md +++ b/containerd-shim-spin/quickstart.md @@ -14,13 +14,13 @@ Before you begin, you need to have the following installed: Start a k3d cluster with the wasm shims already installed: ```bash -k3d cluster create wasm-cluster --image ghcr.io/deislabs/containerd-wasm-shims/examples/k3d:v0.10.0 -p "8081:80@loadbalancer" --agents 2 --registry-create mycluster-registry:12345 +k3d cluster create wasm-cluster --image ghcr.io/spinkube/containerd-shim-spin/examples/k3d:v0.10.0 -p "8081:80@loadbalancer" --agents 2 --registry-create mycluster-registry:12345 ``` Apply RuntimeClass for spin applications to use the spin wasm shim: ```bash -kubectl apply -f https://raw.githubusercontent.com/deislabs/containerd-wasm-shims/main/deployments/workloads/runtime.yaml +kubectl apply -f https://raw.githubusercontent.com/spinkube/containerd-shim-spin/main/deployments/workloads/runtime.yaml ``` ## Deploy an existing sample spin application @@ -28,7 +28,7 @@ kubectl apply -f https://raw.githubusercontent.com/deislabs/containerd-wasm-shim Deploy a pre-built sample spin application: ```bash -kubectl apply -f https://raw.githubusercontent.com/deislabs/containerd-wasm-shims/main/deployments/workloads/workload.yaml +kubectl apply -f https://raw.githubusercontent.com/spinkube/containerd-shim-spin/main/deployments/workloads/workload.yaml echo "waiting 5 seconds for workload to be ready" sleep 5 curl -v http://0.0.0.0:8081/spin/hello @@ -59,7 +59,7 @@ Hello world from Spin! Delete the pre-built sample spin application: ```bash -kubectl delete -f https://raw.githubusercontent.com/deislabs/containerd-wasm-shims/main/deployments/workloads/workload.yaml +kubectl delete -f https://raw.githubusercontent.com/spinkube/containerd-shim-spin/main/deployments/workloads/workload.yaml ``` ## Create a new spin sample application diff --git a/containerd-shim-spin/src/engine.rs b/containerd-shim-spin/src/engine.rs index 940e322..404baf4 100644 --- a/containerd-shim-spin/src/engine.rs +++ b/containerd-shim-spin/src/engine.rs @@ -197,6 +197,7 @@ impl SpinEngine { match resolved { ResolvedAppSource::File { manifest_path, .. } => { // TODO: This should be configurable, see https://github.com/deislabs/containerd-wasm-shims/issues/166 + // TODO: ^^ Move aforementioned issue to this repo let files_mount_strategy = FilesMountStrategy::Direct; spin_loader::from_file(&manifest_path, files_mount_strategy, None).await } diff --git a/deployments/k3d/DockerSetup.md b/deployments/k3d/DockerSetup.md index 0241dda..6de1f27 100644 --- a/deployments/k3d/DockerSetup.md +++ b/deployments/k3d/DockerSetup.md @@ -56,7 +56,7 @@ docker buildx build --platform=wasi/wasm --load -t wasmtest_spin:latest ../../im The `wasi/wasm` platform specifies that the image is a wasm image. The major benefit of using this platform is that you don't need to build each image for a different computer architecture. -The `--load` flag tells Docker to load the image into the local Docker daemon. As described in this [issue](https://github.com/deislabs/containerd-wasm-shims/issues/87), this flag actually doesn't work for wasi/wasm platform. You will need to save the image to a tar file and load it into the local Docker daemon. +The `--load` flag tells Docker to load the image into the local Docker daemon. As described in this [issue](https://github.com/spinkube/containerd-shim-spin/issues/87), this flag actually doesn't work for wasi/wasm platform. You will need to save the image to a tar file and load it into the local Docker daemon. ```shell docker save wasmtest_spin:latest -o wasmtest_spin.tar @@ -64,7 +64,7 @@ docker save wasmtest_spin:latest -o wasmtest_spin.tar ### Load the image to k3d -Refer to this [document](https://github.com/deislabs/containerd-wasm-shims/tree/main/deployments/k3d#how-build-get-started-from-source) to create a k3d cluster. +Refer to this [document](https://github.com/spinkube/containerd-shim-spin/tree/main/deployments/k3d#how-build-get-started-from-source) to create a k3d cluster. Assume you have a k3d cluster named `k3d-default`, you can load the image to the cluster using the following command. diff --git a/deployments/k3d/README.md b/deployments/k3d/README.md index e88e978..cc51217 100644 --- a/deployments/k3d/README.md +++ b/deployments/k3d/README.md @@ -17,9 +17,9 @@ $ tree . ## How to run the example The shell script below will create a k3d cluster locally with the Wasm shims installed and containerd configured. The script then applies the runtime classes for the shims and an example service and deployment. Finally, we curl the `/hello` and receive a response from the example workload. ```shell -k3d cluster create wasm-cluster --image ghcr.io/deislabs/containerd-wasm-shims/examples/k3d:v0.10.0 -p "8081:80@loadbalancer" --agents 2 -kubectl apply -f https://github.com/deislabs/containerd-wasm-shims/raw/main/deployments/workloads/runtime.yaml -kubectl apply -f https://github.com/deislabs/containerd-wasm-shims/raw/main/deployments/workloads/workload.yaml +k3d cluster create wasm-cluster --image ghcr.io/spinkube/containerd-shim-spin/examples/k3d:v0.10.0 -p "8081:80@loadbalancer" --agents 2 +kubectl apply -f https://github.com/spinkube/containerd-shim-spin/raw/main/deployments/workloads/runtime.yaml +kubectl apply -f https://github.com/spinkube/containerd-shim-spin/raw/main/deployments/workloads/workload.yaml echo "waiting 5 seconds for workload to be ready" sleep 15 curl -v http://127.0.0.1:8081/spin/hello diff --git a/deployments/k8s/all-in-one-demo.yaml b/deployments/k8s/all-in-one-demo.yaml index f90613e..4628898 100644 --- a/deployments/k8s/all-in-one-demo.yaml +++ b/deployments/k8s/all-in-one-demo.yaml @@ -24,7 +24,7 @@ spec: runtimeClassName: wasmtime-spin-v2 containers: - name: testwasm - image: ghcr.io/deislabs/containerd-wasm-shims/examples/spin-rust-hello:latest + image: ghcr.io/spinkube/containerd-shim-spin/examples/spin-rust-hello:latest --- apiVersion: v1 kind: Service diff --git a/deployments/workloads/workload.yaml b/deployments/workloads/workload.yaml index e05896c..5c9e3af 100644 --- a/deployments/workloads/workload.yaml +++ b/deployments/workloads/workload.yaml @@ -15,7 +15,7 @@ spec: runtimeClassName: wasmtime-spin containers: - name: spin-hello - image: ghcr.io/deislabs/containerd-wasm-shims/examples/spin-rust-hello:v0.10.0 + image: ghcr.io/spinkube/containerd-shim-spin/examples/spin-rust-hello:v0.10.0 command: ["/"] resources: # limit the resources to 128Mi of memory and 100m of CPU limits: diff --git a/images/spin-dapr/README.md b/images/spin-dapr/README.md index 74f4172..f1a80f6 100644 --- a/images/spin-dapr/README.md +++ b/images/spin-dapr/README.md @@ -18,7 +18,7 @@ sudo mv ./spin /usr/local/bin/ ### Run example with K3d: ```sh # start the K3d cluster -k3d cluster create wasm-cluster --image ghcr.io/deislabs/containerd-wasm-shims/examples/k3d:v0.10.0 -p "8081:80@loadbalancer" +k3d cluster create wasm-cluster --image ghcr.io/spinkube/containerd-shim-spin/examples/k3d:v0.10.0 -p "8081:80@loadbalancer" # Install Dapr dapr init -k --wait # or via helm @@ -36,7 +36,7 @@ mkdir -p test/out_spin-dapr/ docker save spin-dapr:latest -o test/out_spin-dapr/img.tar k3d image load -c wasm-cluster spin-dapr:latest test/out_spin-dapr/img.tar # Apply the manifest -kubectl apply -f https://github.com/deislabs/containerd-wasm-shims/raw/main/deployments/workloads/runtime.yaml +kubectl apply -f https://github.com/spinkube/containerd-shim-spin/raw/main/deployments/workloads/runtime.yaml kubectl apply -f images/spin-dapr/deploy.yaml # When everythin is up, forward the port and get the last kubernetes event diff --git a/images/spin/go-hello/go.mod b/images/spin/go-hello/go.mod index 098c0c6..f9a39a1 100644 --- a/images/spin/go-hello/go.mod +++ b/images/spin/go-hello/go.mod @@ -1,6 +1,6 @@ -module github.com/deislabs/containerd-wasm-shims/go-hello +module github.com/spinkube/containerd-shim-spin/go-hello go 1.20 From e1ee0d9482025c20555b6463857a933fb08af6c3 Mon Sep 17 00:00:00 2001 From: Vaughn Dice Date: Fri, 2 Feb 2024 12:56:09 -0500 Subject: [PATCH 2/2] chore(*): more naming updates Signed-off-by: Vaughn Dice --- .github/workflows/build.yaml | 8 +++--- .github/workflows/ci.yaml | 4 +-- .github/workflows/docker-build-push.yaml | 2 +- Cargo.lock | 32 ++++++++++++------------ tests/Cargo.toml | 2 +- 5 files changed, 24 insertions(+), 24 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 2b78ffd..6b2c074 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -48,12 +48,12 @@ jobs: - name: package release assets run: | mkdir _dist - cp containerd-shim-*/target/${{ matrix.config.arch }}-unknown-linux-musl/release/containerd-shim-*-${{ matrix.shims.version }} _dist/ + cp containerd-shim-spin/target/${{ matrix.config.arch }}-unknown-linux-musl/release/containerd-shim-spin-${{ matrix.shims.version }} _dist/ cd _dist - tar czf containerd-wasm-shims-${{ matrix.shims.version }}-${{ matrix.shims.name }}-${{ env.RUNNER_OS }}-${{ matrix.config.arch }}.tar.gz containerd-shim-*-${{ matrix.shims.version }} + tar czf containerd-shim-spin-${{ matrix.shims.version }}-${{ env.RUNNER_OS }}-${{ matrix.config.arch }}.tar.gz containerd-shim-spin-${{ matrix.shims.version }} - name: upload shim artifacts uses: actions/upload-artifact@v3 with: - name: containerd-wasm-shims-${{ matrix.shims.version }}-${{ matrix.shims.name }}-${{ env.RUNNER_OS }}-${{ matrix.config.arch }} - path: _dist/containerd-wasm-shims-${{ matrix.shims.version }}-${{ matrix.shims.name }}-${{ env.RUNNER_OS }}-${{ matrix.config.arch }}.tar.gz + name: containerd-shim-spin-${{ matrix.shims.version }}-${{ env.RUNNER_OS }}-${{ matrix.config.arch }} + path: _dist/containerd-shim-spin-${{ matrix.shims.version }}-${{ env.RUNNER_OS }}-${{ matrix.config.arch }}.tar.gz retention-days: 5 diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 0b746ef..f128be0 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -34,10 +34,10 @@ jobs: steps: - uses: actions/checkout@v3 - uses: actions/download-artifact@v3 - - name: Extract containerd-wasm-shims-v1-linux-${{ env.ARCH }} + - name: Extract containerd-shim-spin-linux-${{ env.ARCH }} run: | mkdir -p ./bin - for f in containerd-wasm-shims-*-*-linux-${{ env.ARCH }}/containerd-wasm-shims-*-*-linux-${{ env.ARCH }}.tar.gz + for f in containerd-shim-spin-*-linux-${{ env.ARCH }}/containerd-shim-spin-*-linux-${{ env.ARCH }}.tar.gz do tar -xzf "$f" -C ./bin done - name: install k3d diff --git a/.github/workflows/docker-build-push.yaml b/.github/workflows/docker-build-push.yaml index d4fb9a4..ff86010 100644 --- a/.github/workflows/docker-build-push.yaml +++ b/.github/workflows/docker-build-push.yaml @@ -48,7 +48,7 @@ jobs: with: context: ${{ matrix.image.context }} load: true - tags: containerd-wasm-shims${{ matrix.image.imageName }}:test + tags: containerd-shim-spin/${{ matrix.image.imageName }}:test platforms: wasi/wasm - name: build and push # we use v3 here because we can't push wasi/wasm images with v4 diff --git a/Cargo.lock b/Cargo.lock index cbf3f14..733fc49 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1294,6 +1294,22 @@ dependencies = [ "ttrpc-codegen", ] +[[package]] +name = "containerd-shim-spin-tests" +version = "0.10.0" +dependencies = [ + "anyhow", + "curl", + "http", + "hyper 0.14.27", + "k8s-openapi", + "kube", + "rand 0.8.5", + "redis 0.23.3", + "tokio", + "tower", +] + [[package]] name = "containerd-shim-spin-v2" version = "0.10.0" @@ -1349,22 +1365,6 @@ dependencies = [ "windows-sys 0.48.0", ] -[[package]] -name = "containerd-wasm-shims-tests" -version = "0.10.0" -dependencies = [ - "anyhow", - "curl", - "http", - "hyper 0.14.27", - "k8s-openapi", - "kube", - "rand 0.8.5", - "redis 0.23.3", - "tokio", - "tower", -] - [[package]] name = "core-foundation" version = "0.9.3" diff --git a/tests/Cargo.toml b/tests/Cargo.toml index 9e64a0b..2c1d432 100644 --- a/tests/Cargo.toml +++ b/tests/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "containerd-wasm-shims-tests" +name = "containerd-shim-spin-tests" version.workspace = true edition.workspace = true license.workspace = true