Fix proxy being overriden by default addresses (#1886)

This commit is contained in:
ben-toogood 2020-07-31 08:55:08 +01:00 committed by Vasiliy Tolstov
parent bba26ae81d
commit 75a4a1c7aa

View File

@ -188,8 +188,14 @@ func (r *rtr) fetchRoutes(service string) error {
for _, srv := range services { for _, srv := range services {
var domain string var domain string
// since a wildcard query was performed, the service could belong
// to one of many namespaces, to get this information we check
// the node metadata. TODO: Add Domain to registry.Service
if srv.Metadata != nil && len(srv.Metadata["domain"]) > 0 { if srv.Metadata != nil && len(srv.Metadata["domain"]) > 0 {
domain = srv.Metadata["domain"] domain = srv.Metadata["domain"]
} else if len(srv.Nodes) > 0 && srv.Nodes[0].Metadata != nil {
domain = srv.Nodes[0].Metadata["domain"]
} else { } else {
domain = registry.WildcardDomain domain = registry.WildcardDomain
} }