diff --git a/internal/xds/translator/ratelimit.go b/internal/xds/translator/ratelimit.go index a08fc8d4885..6fb3e2d86db 100644 --- a/internal/xds/translator/ratelimit.go +++ b/internal/xds/translator/ratelimit.go @@ -268,7 +268,16 @@ func GetRateLimitServiceConfigStr(pbCfg *rlsconfv3.RateLimitConfig) (string, err enc.SetIndent(2) // Translate pb config to yaml yamlRoot := config.ConfigXdsProtoToYaml(pbCfg) - err := enc.Encode(*yamlRoot) + rateLimitConfig := &struct { + Name string + Domain string + Descriptors []config.YamlDescriptor + }{ + Name: pbCfg.Name, + Domain: yamlRoot.Domain, + Descriptors: yamlRoot.Descriptors, + } + err := enc.Encode(rateLimitConfig) return buf.String(), err } diff --git a/internal/xds/translator/testdata/out/ratelimit-config/distinct-match.yaml b/internal/xds/translator/testdata/out/ratelimit-config/distinct-match.yaml index 0ad9f90e736..d418c71595e 100644 --- a/internal/xds/translator/testdata/out/ratelimit-config/distinct-match.yaml +++ b/internal/xds/translator/testdata/out/ratelimit-config/distinct-match.yaml @@ -1,3 +1,4 @@ +name: first-listener domain: first-listener descriptors: - key: first-route diff --git a/internal/xds/translator/testdata/out/ratelimit-config/distinct-remote-address-match.yaml b/internal/xds/translator/testdata/out/ratelimit-config/distinct-remote-address-match.yaml index c14867776b2..7f50507431f 100644 --- a/internal/xds/translator/testdata/out/ratelimit-config/distinct-remote-address-match.yaml +++ b/internal/xds/translator/testdata/out/ratelimit-config/distinct-remote-address-match.yaml @@ -1,3 +1,4 @@ +name: first-listener domain: first-listener descriptors: - key: first-route diff --git a/internal/xds/translator/testdata/out/ratelimit-config/empty-header-matches.yaml b/internal/xds/translator/testdata/out/ratelimit-config/empty-header-matches.yaml index db1ce990b00..f00ce09876f 100644 --- a/internal/xds/translator/testdata/out/ratelimit-config/empty-header-matches.yaml +++ b/internal/xds/translator/testdata/out/ratelimit-config/empty-header-matches.yaml @@ -1,3 +1,4 @@ +name: first-listener domain: first-listener descriptors: - key: first-route diff --git a/internal/xds/translator/testdata/out/ratelimit-config/masked-remote-address-match.yaml b/internal/xds/translator/testdata/out/ratelimit-config/masked-remote-address-match.yaml index e997acedcd6..d15316a3e41 100644 --- a/internal/xds/translator/testdata/out/ratelimit-config/masked-remote-address-match.yaml +++ b/internal/xds/translator/testdata/out/ratelimit-config/masked-remote-address-match.yaml @@ -1,3 +1,4 @@ +name: first-listener domain: first-listener descriptors: - key: first-route diff --git a/internal/xds/translator/testdata/out/ratelimit-config/multiple-masked-remote-address-match-with-same-cidr.yaml b/internal/xds/translator/testdata/out/ratelimit-config/multiple-masked-remote-address-match-with-same-cidr.yaml index 931e235d362..22db357e4fb 100644 --- a/internal/xds/translator/testdata/out/ratelimit-config/multiple-masked-remote-address-match-with-same-cidr.yaml +++ b/internal/xds/translator/testdata/out/ratelimit-config/multiple-masked-remote-address-match-with-same-cidr.yaml @@ -1,3 +1,4 @@ +name: first-listener domain: first-listener descriptors: - key: first-route diff --git a/internal/xds/translator/testdata/out/ratelimit-config/multiple-matches.yaml b/internal/xds/translator/testdata/out/ratelimit-config/multiple-matches.yaml index b1ba8190ced..69c29c429aa 100644 --- a/internal/xds/translator/testdata/out/ratelimit-config/multiple-matches.yaml +++ b/internal/xds/translator/testdata/out/ratelimit-config/multiple-matches.yaml @@ -1,3 +1,4 @@ +name: first-listener domain: first-listener descriptors: - key: first-route diff --git a/internal/xds/translator/testdata/out/ratelimit-config/multiple-routes.yaml b/internal/xds/translator/testdata/out/ratelimit-config/multiple-routes.yaml index 81dc4dea6ef..f2068677be6 100644 --- a/internal/xds/translator/testdata/out/ratelimit-config/multiple-routes.yaml +++ b/internal/xds/translator/testdata/out/ratelimit-config/multiple-routes.yaml @@ -1,3 +1,4 @@ +name: first-listener domain: first-listener descriptors: - key: first-route diff --git a/internal/xds/translator/testdata/out/ratelimit-config/multiple-rules.yaml b/internal/xds/translator/testdata/out/ratelimit-config/multiple-rules.yaml index ebe7d02ca8a..e3332959caa 100644 --- a/internal/xds/translator/testdata/out/ratelimit-config/multiple-rules.yaml +++ b/internal/xds/translator/testdata/out/ratelimit-config/multiple-rules.yaml @@ -1,3 +1,4 @@ +name: first-listener domain: first-listener descriptors: - key: first-route diff --git a/internal/xds/translator/testdata/out/ratelimit-config/value-match.yaml b/internal/xds/translator/testdata/out/ratelimit-config/value-match.yaml index 08078af1c67..fa71116ba75 100644 --- a/internal/xds/translator/testdata/out/ratelimit-config/value-match.yaml +++ b/internal/xds/translator/testdata/out/ratelimit-config/value-match.yaml @@ -1,3 +1,4 @@ +name: first-listener domain: first-listener descriptors: - key: first-route