envoyproxy - lua envoyFilter 在 istio-sidecar 中被忽略
问题描述
我正在尝试使 envoyFilter 在 istio-sidecar 中工作。
看起来 :
- 发生注射。由于我的过滤器存在于集群的资源中,并且每当我更新过滤器时,istiod 都会推送到我的边车。(而且我的 pod 和我的过滤器在同一个命名空间中)
- 我用来选择的标签出现在 pod 上。
但是我的脚本完全被忽略了。请问,我错过了什么?
PS:我从特使的 ref 那里得到了 lua:
- https://www.envoyproxy.io/docs/envoy/latest/configuration/http/http_filters/lua_filter.html?highlight=request_handle#configuration
- https://www.envoyproxy.io/docs/envoy/latest/configuration/http/http_filters/lua_filter#respond
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。最近的一项功能可以完成工作。
解决方案
我认为您应该将 contect 更改为“context:GATEWAY”,因为这是用于入口流量并且必须应用于所有网关。
然后您可以通过执行配置转储来检查它是否存在: kubectl exec $pod -n $namespace -c istio-proxy -- Pilot-agent request GET config_dump > dump.json
并搜索“authent-filter”以查看它是否已应用。
推荐阅读
- sql - 标量函数返回内存不足错误
- build - 从源错误构建虚幻引擎(针对 Hololens 问题.....)
- r - 检查 Snp 位置是否与基因的基因组区域共定位(开始和结束)
- c# - 如何转义传递给 CrmServiceClient 构造函数的连接字符串中的特殊字符
- python - 将 Azure 存储容器装载到 Databricks 工作区/笔记本导致 AttributeError
- python - 是否可以在运行时从 Python 与 AnyLogic 通信?
- python - Django Forum App,评论在用户端不更新,但可以通过admin查看
- javascript - 无法发布 /api/user
- c# - 我怎样才能让我的 Syncfusion 卡片布局尊重我的验证而不是提前?
- python - Python/Pandas:如何根据个人 id 替换 Pandas 数据框的特定值?