-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
[hack week] Add containerd runwasi wasmtime shims #6872
Conversation
name: wasmtime | ||
handler: wasmtime | ||
--- | ||
apiVersion: node.k8s.io/v1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you want to pull the wasmtimed runtimeclass until that's working better or leave it in?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh I'm not planning on merging any of this at the moment, I'm going to keep it around as-is while upstream works on the shims.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In that case I may try to add "runu"
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
dc19ed2
to
4fb04e1
Compare
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
Hi @brandond Very excited to see k3s supporting Wasm containers! I am with the WasmEdge project. Just to clarify that WasmEdge has no runtime dependency on LLVM. In fact, one could build WasmEdge using GCC, which is available on s360x. We are using LLVM for AOT compilation. But the "Wasm image" typically only contains the Wasm bytecode (for interpreter) or the AOT compiled native code (done on another machine). In either case, the deployment machine does not need LLVM. One of the unique features of WasmEdge is that it enables developers to build complete microservices -- HTTP servers, web service clients, pooled database connections, messaging queue clients etc. All using libraries they are already familiar with (eg tokio / hyper on Rust, node / fetch() on JavaScript). See examples here: https://github.com/docker/awesome-compose/tree/master/wasmedge-mysql-nginx https://github.com/docker/awesome-compose/tree/master/wasmedge-kafka-mysql WasmEdge provides first-class support for AI inference frameworks, such as Tensorflow, PyTorch, and OpenVINO. https://github.com/second-state/WasmEdge-WASINN-examples Finally, WasmEdge can run JavaScript apps. It supports many node.js APIs and even AI inference APIs. https://wasmedge.org/book/en/write_wasm/js.html I could go on ... We would love to see WasmEdge supported in k3s. Thank you! Michael Yuan - maintainer of WasmEdge |
@juntao thanks for stopping by! Do you have any tips on building without a working llvm/lld for the target arch? We aim to ship static binaries for arm/arm64/amd64/s390x and I was having a very hard time finding a distro with working static libs for lld on s390x. My preference would be to build in either buildroot or alpine, given that's where we're doing our existing work. At the moment we're also using musl instead of glibc, but it appears that some of the rust ecosystem may not play nicely with that either. Are there any downsides to omitting llvm from the wasmedge build? Does it just break .wit support, requiring the image to contain only compiled to bytecode? |
Hi, the only thing you need is to set |
@hydai thanks! I was looking at https://wasmedge.org/book/en/contribute/build_from_src.html and https://wasmedge.org/book/en/contribute/build_from_src/linux.html but it wasn't clear from there that turning off WASMEDGE_BUILD_AOT_RUNTIME eliminates the LLVM dependencies, but that makes sense. It looks like I'll need to use a gnu toolchain for rust on arm and s390x, so I'lll probably have to move the runwasi build out to another pipeline... which is fine, as they were probably too time consuming to do in the main K3s build anyway. |
I am not familiar with the s390x arch. Please let me know if you encounter any issues :-) |
@hydai I have given up on s390x due to lack of rust support for musl libc on that platform, but I'm running into problems building for 32bit arm which I would expect to work. I opened WasmEdge/WasmEdge#2254 if you wouldn't mind taking a look. |
Hi @brandond |
@hydai yes, we use musl for everything. Our "root" (userspace binaries that ship with k3s) are derived from buildroot, while the golang bits are built on alpine. Everything is statically linked. |
It sounds like it would be helpful if runwasi provided prebuilt bins with some variety of configurations. What would help most? We'd be happy to help make this process easier. Also have you consider the spin and slight shims via https://github.com/deislabs/containerd-wasm-shims? We are including these in AKS and in Cluster API (CAPZ documentation is forthcoming, but the bits are in image-builder via kubernetes-sigs/image-builder#1037). |
Proposed Changes
Note that this currently balloons the k3s build time by several minutes, due to the extra time spent building the rust crates.
Types of Changes
new feature
Verification
Run a WebAssembly image:
Testing
Linked Issues
User-Facing Change
Further Comments
Caveats:
E0201 23:38:33.301847 53 kuberuntime_sandbox.go:72] "Failed to create sandbox for pod" err=<rpc error: code = Unknown desc = failed to create containerd task: failed to start shim: start failed: containerd-shim-wasmtimed-v1: Ttrpc(RpcStatus(code: NOT_FOUND message: "/runwasi.services.sandbox.v1.Manager/Connect is not supported")): exit status 1: unknown > pod="default/example-wasi-6b754d67db-htqwc"
I'm poking upstream about that.