From 1483c945319301072019d138007b661bbc6b501f Mon Sep 17 00:00:00 2001 From: Derek Menteer Date: Thu, 27 Oct 2022 14:27:07 -0500 Subject: [PATCH] Fix peered service protocols using proxy-defaults. --- agent/configentry/merge_service_config.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/agent/configentry/merge_service_config.go b/agent/configentry/merge_service_config.go index f11d96fcc5..b131b7e7a7 100644 --- a/agent/configentry/merge_service_config.go +++ b/agent/configentry/merge_service_config.go @@ -173,11 +173,21 @@ func MergeServiceConfig(defaults *structs.ServiceConfigResponse, service *struct us.MeshGateway.Mode = remoteCfg.MeshGateway.Mode } + preMergeProtocol, found := us.Config["protocol"] // Merge in everything else that is read from the map if err := mergo.Merge(&us.Config, remoteCfg.Config); err != nil { return nil, err } + // Reset the protocol to its pre-merged version for peering upstreams. + if us.DestinationPeer != "" { + if found { + us.Config["protocol"] = preMergeProtocol + } else { + delete(us.Config, "protocol") + } + } + // Delete the mesh gateway key from opaque config since this is the value that was resolved from // the servers and NOT the final merged value for this upstream. // Note that we use the "mesh_gateway" key and not other variants like "MeshGateway" because