From 3dccd14d31748a93e4dc4a18760cc014f2e3c7c2 Mon Sep 17 00:00:00 2001 From: "R.B. Boyer" <4903+rboyer@users.noreply.github.com> Date: Mon, 13 Dec 2021 14:34:49 -0600 Subject: [PATCH] proxycfg: use external addresses in tproxy when crossing partition boundaries (#11823) --- agent/proxycfg/upstreams.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/agent/proxycfg/upstreams.go b/agent/proxycfg/upstreams.go index 74015c118..e5bcc098e 100644 --- a/agent/proxycfg/upstreams.go +++ b/agent/proxycfg/upstreams.go @@ -108,8 +108,10 @@ func (s *handlerUpstreams) handleUpdateUpstreams(ctx context.Context, u cache.Up } } - // TODO(partitions) Update to account for upstream in remote partition once tproxy supports it - addr, _ := node.BestAddress(false) + // Make sure to use an external address when crossing partitions. + isRemote := !structs.EqualPartitions(svc.PartitionOrDefault(), s.proxyID.PartitionOrDefault()) + addr, _ := node.BestAddress(isRemote) + upstreamsSnapshot.PassthroughUpstreams[svc.String()].Addrs[addr] = struct{}{} } }