mirror of https://github.com/hashicorp/consul
Fix virtual services being included in intention topology as downstreams. (#17099)
parent
46816071df
commit
a33b224a55
|
@ -1079,7 +1079,11 @@ func (s *Store) intentionTopologyTxn(
|
||||||
}
|
}
|
||||||
addSvcs(tempServices)
|
addSvcs(tempServices)
|
||||||
|
|
||||||
|
if !downstreams {
|
||||||
// Query the virtual ip table as well to include virtual services that don't have a registered instance yet.
|
// Query the virtual ip table as well to include virtual services that don't have a registered instance yet.
|
||||||
|
// We only need to do this for upstreams currently, so that tproxy can find which discovery chains should be
|
||||||
|
// contacted for failover scenarios. Virtual services technically don't need to be considered as downstreams,
|
||||||
|
// because they will take on the identity of the calling service, rather than the chain itself.
|
||||||
vipIndex, vipServices, err := servicesVirtualIPsTxn(tx)
|
vipIndex, vipServices, err := servicesVirtualIPsTxn(tx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return index, nil, fmt.Errorf("failed to list service virtual IPs: %v", err)
|
return index, nil, fmt.Errorf("failed to list service virtual IPs: %v", err)
|
||||||
|
@ -1090,6 +1094,7 @@ func (s *Store) intentionTopologyTxn(
|
||||||
if vipIndex > index {
|
if vipIndex > index {
|
||||||
index = vipIndex
|
index = vipIndex
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// destinations can only ever be upstream, since they are only allowed as intention destination.
|
// destinations can only ever be upstream, since they are only allowed as intention destination.
|
||||||
index, tempServices, err = serviceNamesOfKindTxn(tx, ws, structs.ServiceKindDestination, *wildcardMeta)
|
index, tempServices, err = serviceNamesOfKindTxn(tx, ws, structs.ServiceKindDestination, *wildcardMeta)
|
||||||
|
|
Loading…
Reference in New Issue