V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
novolunt
V2EX  ›  Kubernetes

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

  •  
  •   novolunt · 2022-07-21 12:12:55 +08:00 · 1077 次点击
    这是一个创建于 644 天前的主题,其中的信息可能已经有所发展或是发生改变。

    写一个 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
    
    
    第 1 条附言  ·  2022-07-21 14:09:45 +08:00
    - 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

    ```
    目前尚无回复
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   5728 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 1849ms · UTC 02:22 · PVG 10:22 · LAX 19:22 · JFK 22:22
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.