-
Notifications
You must be signed in to change notification settings - Fork 420
Description
Go can compile to WASM (GOOS=js GOARCH=wasm
), and WASM can be packaged into images and executed on K8s clusters using krustlet: https://developer.okta.com/blog/2022/01/28/webassembly-on-kubernetes-with-rust
So, maybe ko
can build a WASM executable, and put it in a multiarch image, alongside the other ko-built archs.
This wouldn't work for Go executables that need to call into their base images (I don't think WASM images have multiple layers, and the environment isn't very linux-ey...yet?), but it should mostly maybe kinda work if they're just static binaries, which is exactly ko's sweet spot.
An example WASM image that kruslet can apparently run: https://explore.ggcr.dev/?image=webassembly.azurecr.io%2Fhello-wasm%3Av1 -- note media types and the annotation.
Questions:
-
What OCI platform does kruslet expect when it's given a multiplatform image?
js/wasm
? -
How should users express this?
ko build ./ --wasm
to additionally produce a WASM image in the index?