写一个 wasm 通过逻辑拦截请求并处理,本地测试通过,不知道如果写 istio 配置
wasm 本地测试通过,怎么写成 istio 可用的配置 其参数官方是这个,但 envoy 配置文件参数那么多,比如 connectTimeout 设置为 15.0s 就没找到相应的配置 https://istio.io/latest/docs/reference/config/proxy_extensions/wasm-plugin/
源 WasmPlugin 插件配置如下,需要怎么更改:
apiVersion: extensions.istio.io/v1alpha1
kind: WasmPlugin
metadata:
name: header-injection
namespace: istio-system
spec:
selector:
matchLabels:
istio: ingressgateway
url: oci://myharbor.com/wasm/add-header:v0.1
imagePullPolicy: IfNotPresent
源 envoy 配置文件
admin:
accessLogPath: /dev/null
address:
socketAddress:
address: 0.0.0.0
portValue: 19000
staticResources:
clusters:
- connectTimeout: 15.0s
dnsLookupFamily: V4_ONLY
hosts:
- socketAddress:
address: jsonplaceholder.typicode.com
ipv4Compat: true
portValue: 443
name: static-cluster
tlsContext:
sni: jsonplaceholder.typicode.com
type: LOGICAL_DNS
listeners:
- address:
socketAddress:
address: 0.0.0.0
portValue: 8080
filterChains:
- filters:
- config:
httpFilters:
- config:
config:
name: add-header
rootId: add_header
vmConfig:
code:
local:
filename: /media/filter.wasm
runtime: envoy.wasm.runtime.v8
vmId: add-header
name: envoy.filters.http.wasm
- name: envoy.router
routeConfig:
name: test
virtualHosts:
- domains:
- '*'
name: jsonplaceholder
routes:
- match:
prefix: /
route:
autoHostRewrite: true
cluster: static-cluster
statPrefix: ingress_http
name: envoy.http_connection_manager
name: listener_0