首页 > 解决方案 > lua envoyFilter 在 istio-sidecar 中被忽略

问题描述

我正在尝试使 envoyFilter 在 istio-sidecar 中工作。

看起来 :

但是我的脚本完全被忽略了。请问,我错过了什么?

PS:我从特使的 ref 那里得到了 lua:

piVersion: networking.istio.io/v1alpha3
kind: EnvoyFilter
metadata:
  name: authent-filter
  namespace: sma-app-integration
spec:
  workloadSelector:
    labels:
      com.effia.smartaccess/secured: enabled
  configPatches:
  - applyTo: HTTP_FILTER
    match:
      context: SIDECAR_INBOUND
      listener:
        portNumber: 8080
        filterChain:
          filter:
            name: "envoy.http_connection_manager"
            subFilter:
              name: "envoy.router"
    patch:
      operation: INSERT_FIRST
      value:
        name: envoy.filters.http.lua
        typed_config:
          "@type": "type.googleapis.com/envoy.extensions.filters.http.lua.v3.Lua"
          inlineCode: |
              function envoy_on_request(request_handle)
                request_handle:respond({[":status"] = "100"},"nope")
              end

编辑:好吧,我们无法让它工作并切换到 Nginx。最近的一项功能可以完成工作。

标签: envoyproxyistio-sidecar

解决方案


我认为您应该将 contect 更改为“context:GATEWAY”,因为这是用于入口流量并且必须应用于所有网关。

然后您可以通过执行配置转储来检查它是否存在: kubectl exec $pod -n $namespace -c istio-proxy -- Pilot-agent request GET config_dump > dump.json

并搜索“authent-filter”以查看它是否已应用。


推荐阅读