Skip to content

Commit

Permalink
chore(spin): bump spin to 2.0.0 (#177)
Browse files Browse the repository at this point in the history
bump spin shim version to v2

Signed-off-by: jiaxiao zhou <jiazho@microsoft.com>
  • Loading branch information
Mossaka committed Nov 9, 2023
1 parent 372bcb3 commit e5e2679
Show file tree
Hide file tree
Showing 43 changed files with 1,890 additions and 1,729 deletions.
36 changes: 26 additions & 10 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,25 +17,41 @@ jobs:
os: "ubuntu-latest",
arch: "aarch64"
}
shims: [slight, spin, wws, lunatic]
shims:
- {
name: "slight",
version: "v1",
}
- {
name: "spin",
version: "v2",
}
- {
name: "wws",
version: "v1",
}
- {
name: "lunatic",
version: "v1",
}
env:
ARCH: ${{ matrix.config.arch }}
steps:
- uses: actions/checkout@v3
- uses: Swatinem/rust-cache@v2
with:
workspaces: |
"containerd-shim-*-v1 -> target"
"containerd-shim-* -> target"
- name: "Install dependencies"
run: |
sudo apt-get update
sudo apt-get install -y protobuf-compiler libseccomp-dev
- name: build ${{ matrix.shims }}
- name: build ${{ matrix.shims.name }}
run: |
VERBOSE=1 make build SHIMS=${{ matrix.shims }}
- name: unit tests ${{ matrix.shims }}
VERBOSE=1 make build SHIMS=${{ matrix.shims.name }}
- name: unit tests ${{ matrix.shims.name }}
run: |
VERBOSE=1 make unit-tests SHIMS=${{ matrix.shims }}
VERBOSE=1 make unit-tests SHIMS=${{ matrix.shims.name }}
- name: lowercase the runner OS name
shell: bash
run: |
Expand All @@ -44,12 +60,12 @@ jobs:
- name: package release assets
run: |
mkdir _dist
cp containerd-shim-*-v1/target/${{ matrix.config.arch }}-unknown-linux-musl/release/containerd-shim-*-v1 _dist/
cp containerd-shim-*/target/${{ matrix.config.arch }}-unknown-linux-musl/release/containerd-shim-*-${{ matrix.shims.version }} _dist/
cd _dist
tar czf containerd-wasm-shims-v1-${{ matrix.shims }}-${{ env.RUNNER_OS }}-${{ matrix.config.arch }}.tar.gz containerd-shim-*-v1
tar czf containerd-wasm-shims-${{ matrix.shims.version }}-${{ matrix.shims.name }}-${{ env.RUNNER_OS }}-${{ matrix.config.arch }}.tar.gz containerd-shim-*-${{ matrix.shims.version }}
- name: upload shim artifacts
uses: actions/upload-artifact@v3
with:
name: containerd-wasm-shims-v1-${{ matrix.shims }}-${{ env.RUNNER_OS }}-${{ matrix.config.arch }}
path: _dist/containerd-wasm-shims-v1-${{ matrix.shims }}-${{ env.RUNNER_OS }}-${{ matrix.config.arch }}.tar.gz
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
retention-days: 5
4 changes: 2 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
- uses: Swatinem/rust-cache@v2
with:
workspaces: |
"containerd-shim-*-v1 -> target"
"containerd-shim-* -> target"
- name: "Install dependencies"
run: |
sudo apt-get update
Expand All @@ -37,7 +37,7 @@ jobs:
- name: Extract containerd-wasm-shims-v1-linux-${{ env.ARCH }}
run: |
mkdir -p ./bin
for f in containerd-wasm-shims-v1-*-linux-${{ env.ARCH }}/containerd-wasm-shims-v1-*-linux-${{ env.ARCH }}.tar.gz
for f in containerd-wasm-shims-*-*-linux-${{ env.ARCH }}/containerd-wasm-shims-*-*-linux-${{ env.ARCH }}.tar.gz
do tar -xzf "$f" -C ./bin
done
- name: install k3d
Expand Down
4 changes: 2 additions & 2 deletions Cargo.lock

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

16 changes: 8 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ test: unit-tests integration-tests

.PHONY: unit-tests
unit-tests: build
$(foreach shim,$(SHIMS),cross test --release --manifest-path=containerd-shim-$(shim)-v1/Cargo.toml --target $(TARGET);)
$(foreach shim,$(SHIMS),cross test --release --manifest-path=containerd-shim-$(shim)/Cargo.toml --target $(TARGET);)

.PHONY: check-bins
check-bins:
Expand Down Expand Up @@ -56,8 +56,8 @@ test/clean:

.PHONY: fmt
fmt:
$(foreach shim,$(SHIMS),cargo fmt --all --manifest-path=containerd-shim-$(shim)-v1/Cargo.toml -- --check;)
$(foreach shim,$(SHIMS),cargo clippy --all-targets --all-features --workspace --manifest-path=containerd-shim-$(shim)-v1/Cargo.toml -- -D warnings;)
$(foreach shim,$(SHIMS),cargo fmt --all --manifest-path=containerd-shim-$(shim)/Cargo.toml -- --check;)
$(foreach shim,$(SHIMS),cargo clippy --all-targets --all-features --workspace --manifest-path=containerd-shim-$(shim)/Cargo.toml -- -D warnings;)
cargo fmt --all -- --check
cargo clippy --all-targets --all-features --workspace -- --deny=warnings

Expand All @@ -73,15 +73,15 @@ install-cross:
.PHONY: $(BUILD_TARGETS)
$(BUILD_TARGETS): SHIM = $(word 2,$(subst -, ,$@))
$(BUILD_TARGETS): install-cross
cross build --release --target $(TARGET) --manifest-path=containerd-shim-$(SHIM)-v1/Cargo.toml $(VERBOSE_FLAG)
cross build --release --target $(TARGET) --manifest-path=containerd-shim-$(SHIM)/Cargo.toml $(VERBOSE_FLAG)

.PHONY: build-%
build-%:
cargo build --release --manifest-path=containerd-shim-$*-v1/Cargo.toml
cargo build --release --manifest-path=containerd-shim-$*/Cargo.toml

.PHONY: install
install: $(foreach shim,$(SHIMS),build-$(shim))
sudo $(INSTALL) containerd-shim-*/target/release/containerd-shim-*-v1 $(PREFIX)/bin
sudo $(INSTALL) containerd-shim-*/target/release/containerd-shim-* $(PREFIX)/bin

.PHONY: update-deps
update-deps:
Expand All @@ -105,9 +105,9 @@ run_%: install load

.PHONY: clean
clean: $(addprefix clean-,$(SHIMS))
$(foreach shim,$(SHIMS),test -f $(PREFIX)/bin/containerd-shim-$(shim)-v1 && sudo rm -rf $(PREFIX)/bin/containerd-shim-$(proj)-v1 || true;)
$(foreach shim,$(SHIMS),test -f $(PREFIX)/bin/containerd-shim-$(shim)-* && sudo rm -rf $(PREFIX)/bin/containerd-shim-$(proj)-* || true;)
test -d ./test && sudo rm -rf ./test || true

.PHONY: clean-%
clean-%:
cargo clean --manifest-path containerd-shim-$*-v1/Cargo.toml
cargo clean --manifest-path containerd-shim-$*/Cargo.toml
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ As mentioned above, this project uses runwasi's `containerd-shim-wasm` to build
## Quickstarts

- [Start k3d and run a sample WASM application](./deployments/k3d/README.md#how-to-run-the-example).
- [Create a Spin application on k3d](./containerd-shim-spin-v1/quickstart.md)
- [Create a Spin application on k3d](./containerd-shim-spin-v2/quickstart.md)
- [Deploy a SpiderLightning application with k3d](./containerd-shim-slight-v1/quickstart.md)
- [Deploy a Wasm Workers Server application with k3d](./containerd-shim-slight-v1/quickstart.md)

Expand All @@ -53,12 +53,12 @@ In [the deployments directory](deployments) you will find examples of deploying

To use one of these containerd shims in Kubernetes, you must do the following:

1. Install the shim binary somewhere on the path of your Kubernetes worker nodes. For example, copy `containerd-shim-spin-v1` to `/bin`.
1. Install the shim binary somewhere on the path of your Kubernetes worker nodes. For example, copy `containerd-shim-spin-v2` to `/bin`.
2. Add the following to the containerd config.toml that maps the runtime type to the shim binary from step 1.

```toml
[plugins."io.containerd.grpc.v1.cri".containerd.runtimes.spin]
runtime_type = "io.containerd.spin.v1"
runtime_type = "io.containerd.spin.v2"
```

3. Apply a runtime class that contains a handler that matches the "spin" config runtime name from step 2.
Expand Down

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

Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
containerd-shim-wasm = { git = "https://github.com/containerd/runwasi", tag = "containerd-shim-wasm/v0.4.0" }
containerd-shim-wasm = { git = "https://github.com/containerd/runwasi", rev = "c768e5b0919ca02903a301bf82a390489437dabe" }
log = "~0.4"
anyhow = "1.0.72"
chrono = { version = "0.4.26", features = ["std"] }
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ mod common;
mod engine;

fn main() {
shim_main::<Instance<engine::LunaticEngine>>("lunatic", version!(), revision!(), None);
shim_main::<Instance<engine::LunaticEngine>>("lunatic", version!(), revision!(), "v1", None);
}

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

Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Containerd shim for running Slight workloads.
"""

[dependencies]
containerd-shim-wasm = { git = "https://github.com/containerd/runwasi", tag = "containerd-shim-wasm/v0.4.0" }
containerd-shim-wasm = { git = "https://github.com/containerd/runwasi", rev = "c768e5b0919ca02903a301bf82a390489437dabe" }
log = "0.4"
tokio = { version = "1", features = [ "full" ] }
slight = { git = "https://github.com/deislabs/spiderlightning", version = "0.5.1" }
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ use containerd_shim_wasm::sandbox::cli::{revision, shim_main, version};
mod engine;

fn main() {
shim_main::<Instance<engine::SlightEngine>>("slight", version!(), revision!(), None);
shim_main::<Instance<engine::SlightEngine>>("slight", version!(), revision!(), "v1", None);
}
Loading

0 comments on commit e5e2679

Please sign in to comment.