【问题标题】:Envoy ext_authz filter before lualua 之前的 Envoy ext_authz 过滤器
【发布时间】:2019-09-16 10:09:24
【问题描述】:

我正在尝试将 ext_authz 过滤器添加到我们的过滤器链中。问题是我们已经有了添加一些 HTTP 标头的 LUA 过滤器,并且我们的路由基于 cluster_header。据我了解,他们俩不能一起工作。如果我将路由的 cluster_header 更改为确切的集群 - 将调用 ext_auth,否则 LUA 过滤器将起作用。除了在 LUA 中调用 auth 服务之外,有什么方法可以让它们一起工作?

配置如下:

filter_chains:
  - filters:
      - name: envoy.http_connection_manager
        typed_config:
          "@type": type.googleapis.com/envoy.config.filter.network.http_connection_manager.v2.HttpConnectionManager
        stat_prefix: ingress_http
        route_config:
          name: local_route
          virtual_hosts:
            - name: main
              domains: ["*"]
              routes:
                - match:
                    prefix: "/"
                  route:
                    cluster_header: cluster
                    hash_policy:
                      header:
                        header_name: balancing-key
                  metadata:
                    filter_metadata:
                      envoy.lua:
                        default_cluster: some-cluster                
         http_filters:
           - name: envoy.ext_authz
             typed_config:
               "@type": type.googleapis.com/envoy.config.filter.http.ext_authz.v2.ExtAuthz
               grpc_service:
                 envoy_grpc:
                   cluster_name: ext-authz
           - name: envoy.lua
             typed_config:
               "@type": type.googleapis.com/envoy.config.filter.http.lua.v2.Lua
               inline_code: some-code

【问题讨论】:

    标签: envoyproxy


    【解决方案1】:

    解决了。我刚刚在 lua 之后移动了 ext_authz 过滤器,它可以工作。

    【讨论】:

      【解决方案2】:

      github上的主题:https://github.com/envoyproxy/envoy/issues/8250

      最后评论:

      如果您查看“调用解码标头”行(在调用过滤器之后出现),我相信 ext_authz 是在 lua 之前调用的。它只是什么都不做。该过滤器的 decodeHeader 实现中有一个 if 语句,如果没有路由或集群,它会跳过工作而不记录。因此,如果您在配置中添加了 cluster_header: cluster 并使用 lua 过滤器设置集群标头,则 ext_authz 不会进行身份验证调用。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2020-10-24
        • 1970-01-01
        • 2021-05-18
        • 1970-01-01
        • 2020-11-16
        • 2012-01-30
        • 1970-01-01
        相关资源
        最近更新 更多