Configure Wasmtime wasm features from toml config file#444
Open
tanishiking wants to merge 2 commits into
Open
Conversation
tanishiking
commented
May 18, 2026
| spin-core = { git = "https://github.com/spinframework/spin", tag = "v3.6.3" } | ||
| spin-factor-outbound-networking = { git = "https://github.com/spinframework/spin", tag = "v3.6.3" } | ||
| wasmtime = "42.0.2" | ||
| wasmtime-cli-flags = { version = "42.0.2", features = ["component-model", "gc"] } |
Author
There was a problem hiding this comment.
Author
|
Ah, wait, it doesn't work for precompilation. (I randomly put the same We might need to |
Author
|
e186ac7 allows precompilation to read the Wasmtime configuration from the Pod-mounted |
Load Wasmtime CLI TOML feature flags so the workloads that requires proposals like GC and exception handling can run on Spinkube. Wasmtime configuration should be configured as the TOML format https://docs.wasmtime.dev/cli-options.html#cli-options-using-toml-file We should monunt the config file into the pod as a volume. By default, shim reads the configuration file from `/runtime/wasmtime.toml`, but we can configure the path by `SPIN_WASMTIME_CONFIG_PATH` environment variable at cluster level. For example: ```toml apiVersion: v1 kind: ConfigMap metadata: name: wasmtime-config-gc data: wasmtime.toml: | [wasm] gc = true exceptions = true function-references = true reference-types = true --- apiVersion: apps/v1 kind: Deployment metadata: name: scala-wasm-health-smoke spec: replicas: 1 selector: matchLabels: app: scala-wasm-health-smoke template: metadata: labels: app: scala-wasm-health-smoke spec: runtimeClassName: wasmtime-spin-v2 containers: - name: app image: ttl.sh/scala-wasm-health-smoke:1h command: ["/"] ports: - containerPort: 80 volumeMounts: - name: wasmtime-config mountPath: /runtime/wasmtime.toml subPath: wasmtime.toml readOnly: true volumes: - name: wasmtime-config configMap: name: wasmtime-config-gc ``` Signed-off-by: Rikito Taniguchi <rikitotaniguchi@proton.me>
Use the OCI spec provided by runwasi to resolve the `wasmtime.toml` and create the precompiler engine using that config. This enables pod mounted Wasmtime config during AOT compilation without having `/runtime/wasmtime.toml` on the node. Signed-off-by: Rikito Taniguchi <rikitotaniguchi@proton.me>
551f721 to
e186ac7
Compare
jsturtevant
pushed a commit
to containerd/runwasi
that referenced
this pull request
Jun 13, 2026
spinframework/containerd-shim-spin#444 adds Wasmtime TOML feature configuration. Runtime configuration can be provided through a Pod mounted `/runtime/wasmtime.toml` for example, but precompilation currently creates the compiler before the shim has access to the configuration. This commits adds `Shim::compiler_with_spec(&Spec)`. Instance creation now loads `config.json` before loading OCI Wasm layers and passes the spec to the compiler through that new API. Downstream shims precompilation should be able to read the spec to configure the wasmtime engine. Concern, this might add a small per-container-start cost: - we read `config.json` before precopmile - construct a precompiler per container rather than once per shim process.
Author
|
upstream containerd/runwasi#1128 is merged, but it's not yet released |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Close #431
context:
Thanks to spinframework/spin#3377, we can now run Scala-wasm generated Wasm Component binary with GC/EH locally on spin 🎉
Here's the Scala Spin templates: https://github.com/scala-wasm/scala-wasm-spin-templates
However, we cannot run those binaries on neither spinkube (,Fermyon cloud nor Akamai Function) yet, because there's no way to configure Wasm features for those environments.
This PR enables spinkube to configure the Wasm features by mounting TOML file to the pod.
Load Wasmtime CLI TOML feature flags so the workloads that requires proposals like GC and exception handling can run on Spinkube.
Wasmtime configuration should be configured as the TOML format https://docs.wasmtime.dev/cli-options.html#cli-options-using-toml-file
We should monunt the config file into the pod as a volume. By default, shim reads the configuration file from
/runtime/wasmtime.toml, but we can configure the path bySPIN_WASMTIME_CONFIG_PATHenvironment variable at cluster level.For example: