From c0faddbe1fbd9669a91011ca23247d3955676a7d Mon Sep 17 00:00:00 2001 From: John Maguire Date: Wed, 10 Jul 2024 10:55:53 -0400 Subject: [PATCH] [NET-10246] use correct enterprise meta for service name for LinkedService (#21382) * use correct enterprise meta for service name for LinkedService * add changelog --- .changelog/21382.txt | 3 +++ agent/consul/state/catalog.go | 7 +++---- 2 files changed, 6 insertions(+), 4 deletions(-) create mode 100644 .changelog/21382.txt diff --git a/.changelog/21382.txt b/.changelog/21382.txt new file mode 100644 index 0000000000..dc59445371 --- /dev/null +++ b/.changelog/21382.txt @@ -0,0 +1,3 @@ +```release-note:bug +terminating-gateway: **(Enterprise Only)** Fixed issue where enterprise metadata applied to linked services was the terminating-gateways enterprise metadata and not the linked services enterprise metadata. +``` diff --git a/agent/consul/state/catalog.go b/agent/consul/state/catalog.go index ce40fda3e0..dcfe4ec91f 100644 --- a/agent/consul/state/catalog.go +++ b/agent/consul/state/catalog.go @@ -942,7 +942,7 @@ func ensureServiceTxn(tx WriteTxn, idx uint64, node string, preserveIndexes bool } if conf != nil { termGatewayConf := conf.(*structs.TerminatingGatewayConfigEntry) - addrs, err := getTermGatewayVirtualIPs(tx, idx, termGatewayConf.Services, &svc.EnterpriseMeta) + addrs, err := getTermGatewayVirtualIPs(tx, idx, termGatewayConf.Services) if err != nil { return err } @@ -3585,11 +3585,10 @@ func getTermGatewayVirtualIPs( tx WriteTxn, idx uint64, services []structs.LinkedService, - entMeta *acl.EnterpriseMeta, ) (map[string]structs.ServiceAddress, error) { addrs := make(map[string]structs.ServiceAddress, len(services)) for _, s := range services { - sn := structs.ServiceName{Name: s.Name, EnterpriseMeta: *entMeta} + sn := structs.ServiceName{Name: s.Name, EnterpriseMeta: s.EnterpriseMeta} // Terminating Gateways cannot route to services in peered clusters psn := structs.PeeredServiceName{ServiceName: sn, Peer: structs.DefaultPeerKeyword} vip, err := assignServiceVirtualIP(tx, idx, psn) @@ -3606,7 +3605,7 @@ func getTermGatewayVirtualIPs( func updateTerminatingGatewayVirtualIPs(tx WriteTxn, idx uint64, conf *structs.TerminatingGatewayConfigEntry, entMeta *acl.EnterpriseMeta) error { // Build the current map of services with virtual IPs for this gateway services := conf.Services - addrs, err := getTermGatewayVirtualIPs(tx, idx, services, entMeta) + addrs, err := getTermGatewayVirtualIPs(tx, idx, services) if err != nil { return err }