wasmtime: read config from env variable TOML#1105
wasmtime: read config from env variable TOML#1105tanishiking wants to merge 1 commit intocontainerd:mainfrom
Conversation
fix containerd#1004 and containerd#847 ? Allow workloads to configure Wasmtime per deployment by setting `RUNWASI_WASMTIME_CONFIG_TOML` environment varialbe toml string. Example: ```yaml apiVersion: v1 kind: ConfigMap metadata: name: wasmtime-config data: wasmtime.toml: | [wasm] gc = true function-references = true exceptions = true [optimize] opt-level = 1 --- apiVersion: apps/v1 kind: Deployment metadata: name: hello spec: template: spec: runtimeClassName: wasmtime containers: - name: app image: ghcr.io/example/hello-wasm:latest env: - name: RUNWASI_WASMTIME_CONFIG_TOML valueFrom: configMapKeyRef: name: wasmtime-config key: wasmtime.toml ```
kate-goldenring
left a comment
There was a problem hiding this comment.
Some initial thoughts. Thank you for looking into this. A current workaround should be to set this as a containerd environment variable: https://github.com/spinframework/skips/tree/main/proposals/003-shim-runtime-options#spin-shim-executor-environment-variables
| if needs_precompile { | ||
| log::info!("precompiling layers for image: {}", container.image); | ||
| let compiled_layers = match compiler.compile(&layers).await { | ||
| let compiled_layers = match compiler.compile(&layers, envs).await { |
There was a problem hiding this comment.
I am not sure we want to pass all container environment variables to compile.
| async fn compile( | ||
| &self, | ||
| _layers: &[WasmLayer], | ||
| _envs: &[String], |
There was a problem hiding this comment.
What was your decision process around adding the configurability to Compiler::compile. Instead of Shim::compiler where many engines (wasmtime and spin) configure the runtime? We could look specify a known configuration file environment variable that is passed to shim::compiler to inform the construction of the compiler
fix #1004 and
#847 ?
Allow workloads to configure Wasmtime per deployment by setting
RUNWASI_WASMTIME_CONFIG_TOMLenvironment varialbe toml string. Not sure this is the best way to passing configuration, but it'd be a good starting point for discussing the design :)Example: