-
Notifications
You must be signed in to change notification settings - Fork 95
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #47 from cpuguy83/cg2_subtree_parents
Add tests for k8s and fix cgroup issue
- Loading branch information
Showing
7 changed files
with
124 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
target | ||
test/k8s/Dockerfile | ||
test/k8s/_out/* | ||
.github | ||
out | ||
*.md | ||
LICENSE | ||
.gitignore | ||
.dockerignore | ||
docs | ||
bin/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,4 @@ bin/ | |
test/out/img.tar | ||
**/target/ | ||
!src/bin/ | ||
test/k8s/_out |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# syntax=docker/dockerfile:1.4 | ||
|
||
ARG KIND_NODE_VERSION=v1.23.13 | ||
|
||
FROM kindest/node:${KIND_NODE_VERSION} AS kind-base | ||
|
||
# We need the build to link using against same system libs as the kind image otherwise the shim won't work. | ||
# So use the node image here as a base and install rust on top of it. | ||
FROM kind-base AS shim-build | ||
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs > /tmp/rustup.sh && sh /tmp/rustup.sh -y --profile=minimal | ||
ENV PATH="/root/.cargo/bin:${PATH}" | ||
RUN rustup install stable | ||
WORKDIR /shim | ||
COPY . . | ||
RUN apt-get update && apt-get install -y build-essential | ||
RUN \ | ||
--mount=type=cache,target=/usr/local/cargo/registry \ | ||
--mount=type=cache,target=/shim/target \ | ||
mkdir -p /opt/shim; make build install PREFIX=/opt/shim | ||
|
||
FROM scratch AS shim | ||
COPY --from=shim-build /opt/shim/bin/* / | ||
|
||
|
||
# Reuse kind-base so we don't have to download other images... | ||
FROM kind-base AS kind-fetch | ||
ARG TARGETARCH | ||
ARG KIND_VERSION=v0.17.0 | ||
RUN curl -sSLf https://kind.sigs.k8s.io/dl/${KIND_VERSION}/kind-linux-${TARGETARCH} > /root/kind && chmod +x /root/kind | ||
|
||
FROM scratch AS kind | ||
COPY --from=kind-fetch /root/kind /kind | ||
|
||
FROM kind-base | ||
RUN <<EOF | ||
set -e | ||
echo '[plugins."io.containerd.grpc.v1.cri".containerd.runtimes.wasm]' >> /etc/containerd/config.toml | ||
echo 'runtime_type = "io.containerd.wasmtime.v1"' >> /etc/containerd/config.toml | ||
sed -i 's,SystemdCgroup = true,,' /etc/containerd/config.toml | ||
EOF | ||
COPY --link --from=shim /* /usr/local/bin/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
apiVersion: node.k8s.io/v1 | ||
kind: RuntimeClass | ||
metadata: | ||
name: wasm | ||
handler: wasm | ||
--- | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: wasi-demo | ||
labels: | ||
app: wasi-demo | ||
spec: | ||
replicas: 3 | ||
selector: | ||
matchLabels: | ||
app: wasi-demo | ||
template: | ||
metadata: | ||
labels: | ||
app: wasi-demo | ||
spec: | ||
runtimeClassName: wasm | ||
containers: | ||
- name: demo | ||
image: ghcr.io/containerd/runwasi/wasi-demo-app:latest | ||
imagePullPolicy: Never |