From cecf5b18f867bb67f2803e1463b2e763dc6ca6ec Mon Sep 17 00:00:00 2001 From: freddygv Date: Wed, 15 Sep 2021 15:17:11 -0600 Subject: [PATCH] Bring back entmeta args defaulting --- command/connect/envoy/envoy.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/command/connect/envoy/envoy.go b/command/connect/envoy/envoy.go index 12374babe4..1615887815 100644 --- a/command/connect/envoy/envoy.go +++ b/command/connect/envoy/envoy.go @@ -527,6 +527,20 @@ func (c *cmd) generateConfig() ([]byte, error) { args.ProxySourceService = svc.Service } + // In most cases where namespaces and partitions are enabled they will already be set + // correctly because the http client that fetched this will provide them explicitly. + // However, if these arguments were not provided, they will be empty even + // though Namespaces and Partitions are actually being used. + // Overriding them ensures that we always set the Namespace and Partition args + // if the cluster is using them. This prevents us from defaulting to the "default" + // when a non-default partition or namespace was inferred from the ACL token. + if svc.Namespace != "" { + args.Namespace = svc.Namespace + } + if svc.Partition != "" { + args.Partition = svc.Partition + } + if svc.Datacenter != "" { // The agent will definitely have the definitive answer here. args.Datacenter = svc.Datacenter