envoyproxy/envoy

VirtualHost metadata not merged with Route metadata

Open

#31,605 建立於 2024年1月3日

在 GitHub 查看
 (5 留言) (0 反應) (0 負責人)C++ (5,373 fork)batch import
area/docsarea/metadataarea/routerbugenhancementhelp wantedno stalebot

倉庫指標

Star
 (27,997 star)
PR 合併指標
 (平均合併 8天) (30 天內合併 378 個 PR)

描述

Title: metadata from RouteConfiguration not merged into per-route metadata map

Description:

I have a VirtualHost set up to contain metadata, as well as per-route metadata configured for each route. They both use the envoy.filters.http.lua namespace. However, inside the Lua handler, only the per-route metadata is available, not the one that I configured in the VirtualHost.

According to the documentation

Metadata key-values for a filter are merged as connection and request handling occurs, with later values for the same key overriding earlier values.

but that seems to not be happening.

What am I doing wrong?

The obvious workaround for this would be to simply add the "top level" metadata to each route, but with over 600 routes, that is quite a lot of boilerplate.

Here is a minified excerpt from my configuration to illustrate the setup:

  - "@type": "type.googleapis.com/envoy.config.route.v3.RouteConfiguration"
    name: "xds_routes"
    virtual_hosts:
      - domains:
          - "*"
        metadata:
          filter_metadata:
            envoy.filters.http.lua:
              should_be_merged_in: "but it is not"
        name: "xds_upstream"
        routes:
          - metadata:
              filter_metadata:
                envoy.filters.http.lua:
                  route_meta:
                    this_meatada: "can be accessed inside the lua handler"

貢獻者指南