Fix peered service protocols using proxy-defaults.

pull/15251/head
Derek Menteer 2 years ago committed by Derek Menteer
parent 218eb3e1ea
commit 1483c94531

@ -173,11 +173,21 @@ func MergeServiceConfig(defaults *structs.ServiceConfigResponse, service *struct
us.MeshGateway.Mode = remoteCfg.MeshGateway.Mode us.MeshGateway.Mode = remoteCfg.MeshGateway.Mode
} }
preMergeProtocol, found := us.Config["protocol"]
// Merge in everything else that is read from the map // Merge in everything else that is read from the map
if err := mergo.Merge(&us.Config, remoteCfg.Config); err != nil { if err := mergo.Merge(&us.Config, remoteCfg.Config); err != nil {
return nil, err 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 // 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. // 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 // Note that we use the "mesh_gateway" key and not other variants like "MeshGateway" because

Loading…
Cancel
Save