V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
novolunt

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

  •  
  •   novolunt · Jul 21, 2022 · 1654 views
    This topic created in 1390 days ago, the information mentioned may be changed or developed.

    写一个 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
    
    
    Supplement 1  ·  Jul 21, 2022
    - istio/proxyv2:latest 上测试正常

    - istio 上的报错
    ```
    2022-07-21T06:03:18.260303Z warning envoy wasm wasm log: did not find root id
    2022-07-21T06:03:18.260753Z warning envoy wasm wasm log: did not find root id
    2022-07-21T06:03:30.644131Z critical envoy wasm wasm log istio-system.header-injection: base ctx: can't create context
    2022-07-21T06:03:30.644152Z critical envoy wasm wasm log istio-system.header-injection: not implemented
    2022-07-21T06:03:30.644217Z error envoy wasm Function: proxy_on_context_create failed: Uncaught RuntimeError: unreachable

    ```
    No Comments Yet
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   6041 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 152ms · UTC 06:07 · PVG 14:07 · LAX 23:07 · JFK 02:07
    ♥ Do have faith in what you're doing.