In this lab, you will use the sample application Image Hub. This version of the Image Hub filter has been simplified for your lab. To self-study deeper functionality, try the other version of the Image Hub filter that is available in the Image Hub repo.
Using Meshery, select Istio from the Management menu.
In the Istio management page:
Next, load the custom Envoy filter. This filter is written in Rust and is compiled against WebAssembly as it's target runtime.
Using Meshery, select Istio from the Management menu.
In the Istio management page:
Alternative, manual installation steps are provided for reference below. No need to execute these if you have performed the steps above.
Manually deploy the Image Hub filter.
1apiVersion: networking.istio.io/v1alpha32kind: EnvoyFilter3metadata:4 name: custom-filter5spec:6 configPatches:7 - applyTo: HTTP_FILTER8 match:9 context: SIDECAR_OUTBOUND # will match outbound listeners in all sidecars10 listener:11 portNumber: 908012 filterChain:13 name: envoy.http_connection_manager14 filter:15 name: "envoy.tcp_proxy"16 patch:17 operation: INSERT_BEFORE18 value:19 # This is the full filter config including the name and config or typed_config section.20 name: "envoy.filters.http.wasm"21 config:22 config:23 name: custom-filter24 rootId: my_root_id25 vmConfig:26 code:27 local:28 filename: /var/lib/imagehub/filter.wasm29 runtime: envoy.wasm.runtime.v830 vmId: custom-filter31 allow_precompiled: true32 workloadSelector:33 labels:34 app: api-v135 version: v1
Manually patch the Image Hub Deployment.
1---(2 // kubectl patch deployment/api-v1 -p '3 {4 "spec": {5 "template": {6 "metadata": {7 "annotations": {8 "sidecar.istio.io/userVolumeMount": "[{\"mountPath\":\"/var/lib/imagehub\",\"name\":\"wasm-filter\"}]"9 }10 },11 "spec": {12 "initContainers": [13 {14 "command": [15 "curl",16 "-L",17 "-o",18 "/var/lib/imagehub/filter.wasm",19 "https://github.com/layer5io/advanced-istio-service-mesh-workshop/raw/master/lab-7/ratelimiter/ratelimit-filter.wasm"20 ],21 "image": "curlimages/curl",22 "imagePullPolicy": "Always",23 "name": "add-wasm",24 "resources": {},25 "terminationMessagePath": "/dev/termination-log",26 "terminationMessagePolicy": "File",27 "volumeMounts": [28 {29 "mountPath": "/var/lib/imagehub",30 "name": "wasm-filter"31 }32 ]33 }34 ],35 "volumes": [36 {37 "emptyDir": {},38 "name": "wasm-filter"39 }40 ]41 }42 }43 }44 }45)46// '
A future version of Meshery will allow you to deploy any filter from the wasm-filters repo. PR the repo to upload your custom filter and have Meshery deploy it.