wasm 插件配置问题,怎么把 wasm 转成 istio 插件

2022-07-21 12:12:55 +08:00
 novolunt

写一个 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

1085 次点击
所在节点    Kubernetes
0 条回复

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/867719

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX