proxycfg: use external addresses in tproxy when crossing partition boundaries (#11823)

This commit is contained in:
R.B. Boyer 2021-12-13 14:34:49 -06:00 committed by GitHub
parent f7eeffb98d
commit 3dccd14d31
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 2 deletions

View File

@ -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{}{}
}
}