From 52e0c795d964fea7f4df191c242f2c9b64d143c8 Mon Sep 17 00:00:00 2001 From: Nathan Coleman Date: Fri, 1 Sep 2023 15:19:00 -0400 Subject: [PATCH] Add response filters to route consolidation logic --- agent/consul/discoverychain/gateway.go | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/agent/consul/discoverychain/gateway.go b/agent/consul/discoverychain/gateway.go index 559d17844f7bb..9b8c4eb73c770 100644 --- a/agent/consul/discoverychain/gateway.go +++ b/agent/consul/discoverychain/gateway.go @@ -27,9 +27,10 @@ type GatewayChainSynthesizer struct { } type hostnameMatch struct { - match structs.HTTPMatch - filters structs.HTTPFilters - services []structs.HTTPService + match structs.HTTPMatch + filters structs.HTTPFilters + responseFilters structs.HTTPResponseFilters + services []structs.HTTPService } // NewGatewayChainSynthesizer creates a new GatewayChainSynthesizer for the @@ -87,9 +88,10 @@ func initHostMatches(hostname string, route *structs.HTTPRouteConfigEntry, curre // Add all matches for this rule to the list for this hostname for _, match := range rule.Matches { matches = append(matches, hostnameMatch{ - match: match, - filters: rule.Filters, - services: rule.Services, + match: match, + filters: rule.Filters, + responseFilters: rule.ResponseFilters, + services: rule.Services, }) } } @@ -226,9 +228,10 @@ func consolidateHTTPRoutes(matchesByHostname map[string][]hostnameMatch, listene // Add all rules for this hostname for _, rule := range rules { route.Rules = append(route.Rules, structs.HTTPRouteRule{ - Matches: []structs.HTTPMatch{rule.match}, - Filters: rule.filters, - Services: rule.services, + Matches: []structs.HTTPMatch{rule.match}, + Filters: rule.filters, + ResponseFilters: rule.responseFilters, + Services: rule.services, }) }