Closed kate-goldenring closed 10 months ago
This is fairly prescriptive. We may want to support detecting/finding the runtime config in Spin runtime instead of passing it as a flag to the Spin CLI.
The same goes for the Spin.toml
file as it is now, so this approach makes sense to me
LGTM
This is great, thanks!
Adds support for Runtime Config in the shim by expecting it to be loaded into the root of a container. This is fairly prescriptive. We may want to support detecting/finding the runtime config in Spin runtime instead of passing it as a flag to the Spin CLI. If we come up with a Spin solution to this, we may need to update the shim to be aligned with whatever approach we choose in Spin. But this unlocks a lot of use cases with the Spin shim now.
Test it out
To test it app, you can use a runtime config to use a non-default KV store. A build example can be pulled from here (http://ghcr.io/kate-goldenring/keyvalue:latest). It is a Spin 1.x app but should still run on the 2.0 shim. I included a section with the app contents below. The Dockerfile for the app looks like:
And the runtime config (
runtime-config.toml
) defines a new store named foo. The app allows this store in the Spin.toml (key_value_stores = ["foo"]
).Download the shim from the action of this PR (or can use a 1.0 shim with k3d:v0.9.2 with these changes here https://github.com/kate-goldenring/containerd-wasm-shims/suites/17958017983/artifacts/1032496968).
Create a deployment
Apply toml and ping the app:
Contents of the Spin App
Example Spin manifest (notice
key_value_stores = ["foo"]
). This is a 1.0 manifest. Feel free to update to use 2.0Example implementation which gets and sets a value to the non default store: