|
1 | 1 | --- |
2 | | -title: "WasmEdge Integration" |
3 | | -linkTitle: "WasmEdge Integration" |
4 | | -weight: 3380 |
| 2 | +title: "Wasm Functions" |
| 3 | +linkTitle: "Wasm Functions" |
| 4 | +weight: 3310 |
5 | 5 | description: |
6 | 6 | --- |
7 | 7 |
|
8 | | -## WasmEdge Integration |
9 | | - |
10 | 8 | `WasmEdge` is a lightweight, high-performance, and extensible WebAssembly runtime for cloud native, edge, and decentralized applications. It powers serverless apps, embedded functions, microservices, smart contracts, and IoT devices. |
11 | 9 |
|
12 | 10 | OpenFunction now supports building and running wasm functions with `WasmEdge` as the workload runtime. |
13 | 11 |
|
14 | 12 | > You can find the WasmEdge Integration proposal [here](https://github.com/OpenFunction/OpenFunction/blob/main/docs/proposals/20230223-wasmedge-integration.md) |
15 | 13 |
|
16 | | -### Function Build |
| 14 | +## Wasm container images |
| 15 | + |
| 16 | +The wasm image containing the wasm binary is a special container image without the OS layer. An special annotation `module.wasm.image/variant: compat-smart` should be added to this wasm container image for a wasm runtime like WasmEdge to recognize it. This is handled automatically in OpenFunction and users only need to specify the `workloadRuntime` as `wasmedge`. |
| 17 | + |
| 18 | +### The build phase of the wasm container images |
17 | 19 |
|
18 | | -When the value of the `spec.workloadRuntime` field is `wasmedge` or the annotations of the Function CR contains `module.wasm.image/variant: compat-smart`, |
19 | | -`spec.build.shipwright.strategy` will be automatically generated based on the `ClusterBuildStrategy` named `wasmedge`. |
| 20 | +If `function.spec.workloadRuntime` is set to `wasmedge` or the function's annotation contains `module.wasm.image/variant: compat-smart`, |
| 21 | +`function.spec.build.shipwright.strategy` will be automatically generated based on the `ClusterBuildStrategy` named `wasmedge` in order to build a wasm container image with the `module.wasm.image/variant: compat-smart` annotation. |
20 | 22 |
|
21 | | -### Function Serving |
| 23 | +### The serving phase of the wasm container images |
22 | 24 |
|
23 | | -When the value of the `spec.workloadRuntime` field is `wasmedge` or the annotations of the Function CR contains `module.wasm.image/variant: compat-smart`: |
24 | | -- If `spec.serving.annotations` does not contain `module.wasm.image/variant`, `module.wasm.image/variant: compat-smart` will be automatically generated into `spec.serving.annotations` |
25 | | -- If `spec.serving.template.runtimeClassName` field is not set, the value of this field will be automatically set to `openfunction-crun` |
| 25 | +When `function.spec.workloadRuntime` is set to `wasmedge` or the function's annotation contains `module.wasm.image/variant: compat-smart`: |
| 26 | +- If `function.spec.serving.annotations` does not contain `module.wasm.image/variant`, `module.wasm.image/variant: compat-smart` will be automatically added to `function.spec.serving.annotations`. |
| 27 | +- If `function.spec.serving.template.runtimeClassName` is not set, this `runtimeClassName` will be automatically set to the default `openfunction-crun` |
26 | 28 |
|
27 | | -> If your kubernetes cluster is in a public cloud, such as `azure`, you can set `spec.serving.template.runtimeClassName` to override the default `runtimeClassName`. |
| 29 | +> If your kubernetes cluster is in a public cloud like `Azure`, you can set `spec.serving.template.runtimeClassName` manually to override the default `runtimeClassName`. |
28 | 30 |
|
29 | 31 | ## Build and run wasm functions |
30 | 32 |
|
|
0 commit comments