An example of deploying Wasm using Istio 1.8.
To compile the AssemblyScript into build/untouched.wasm:
npm install
npm run asbuild:untouched
First, deploy a pod. This example uses an httpbin pod, with special annotations to mount WASM files from a ConfigMap into the sidecar.
kubectl apply -f deploy/httpbin.yaml
To deploy the Wasm compiled above onto that httpbin pod:
./deploy/update-wasm.sh
Execute
kubectl exec -ti deploy/httpbin -c istio-proxy -- curl -v http://httpbin.default:8000/status/418
When this is working -- it currently isn't -- we want to see the status 418 and the body from http://example.com
.
- Ignore
WARNING AS201: Conversion from type 'usize' to 'u32' will require an explicit cast
; this is some problem with the Solo.io runtime. - Use
istioctl pc log <pod> --level wasm:debug
to turn on debug logging.- Turn it off with
istioctl pc log <pod> --level wasm:warning
- Turn it off with
- Use
istioctl proxy-status
and verify httpbin isn't STALE. - Verify the mount worked using
kubectl exec deployment/httpbin -c istio-proxy -- ls -l /var/local/wasm
- Some of the WASM fields in EnvoyFilter are a bit different than in Istio 1.5-1.7. If you are porting old filters try to make them look like the example here.
- The spec for WebAssembly for Proxies is here. This documents vNext, not the 0.2.0 used by this example. There is no documentation for that.
- This project uses the Solo.io Proxy Runtime to give the ABI an object-based feel.
- Both the spec and the AssemblyScript runtime docs are written for advanced Envoy extension developers. They lack an explanation of what is going on. See Solo.io Runtime Issue 24 for links to Envoy docs and C++ header files.