diff --git a/agent/consul/state/intention.go b/agent/consul/state/intention.go index 736091473..b43eac03e 100644 --- a/agent/consul/state/intention.go +++ b/agent/consul/state/intention.go @@ -1001,6 +1001,9 @@ func (s *Store) IntentionTopology(ws memdb.WatchSet, } result := make(structs.ServiceList, 0, len(allServices)) for _, candidate := range allServices { + if candidate.Name == structs.ConsulServiceName { + continue + } decision, err := s.IntentionDecision(candidate.Name, candidate.NamespaceOrDefault(), intentions, decisionMatchType, defaultDecision, true) if err != nil { src, dst := target, candidate diff --git a/agent/consul/state/intention_test.go b/agent/consul/state/intention_test.go index 5989dff35..2d1a479f7 100644 --- a/agent/consul/state/intention_test.go +++ b/agent/consul/state/intention_test.go @@ -1889,6 +1889,11 @@ func TestStore_IntentionTopology(t *testing.T) { Address: "127.0.0.1", } services := []structs.NodeService{ + { + ID: structs.ConsulServiceID, + Service: structs.ConsulServiceName, + EnterpriseMeta: *structs.DefaultEnterpriseMeta(), + }, { ID: "api-1", Service: "api", @@ -1960,7 +1965,7 @@ func TestStore_IntentionTopology(t *testing.T) { target: structs.NewServiceName("web", nil), downstreams: false, expect: expect{ - idx: 9, + idx: 10, services: structs.ServiceList{ { Name: "mysql", @@ -1987,7 +1992,7 @@ func TestStore_IntentionTopology(t *testing.T) { target: structs.NewServiceName("web", nil), downstreams: false, expect: expect{ - idx: 9, + idx: 10, services: structs.ServiceList{ { Name: "api", @@ -2014,7 +2019,7 @@ func TestStore_IntentionTopology(t *testing.T) { target: structs.NewServiceName("api", nil), downstreams: true, expect: expect{ - idx: 9, + idx: 10, services: structs.ServiceList{ { Name: "ingress-gateway", @@ -2045,7 +2050,7 @@ func TestStore_IntentionTopology(t *testing.T) { target: structs.NewServiceName("api", nil), downstreams: true, expect: expect{ - idx: 9, + idx: 10, services: structs.ServiceList{ { Name: "web", @@ -2072,7 +2077,7 @@ func TestStore_IntentionTopology(t *testing.T) { target: structs.NewServiceName("web", nil), downstreams: false, expect: expect{ - idx: 9, + idx: 10, services: structs.ServiceList{ { Name: "api", @@ -2103,7 +2108,7 @@ func TestStore_IntentionTopology(t *testing.T) { target: structs.NewServiceName("web", nil), downstreams: false, expect: expect{ - idx: 9, + idx: 10, services: structs.ServiceList{}, }, }, @@ -2125,7 +2130,7 @@ func TestStore_IntentionTopology(t *testing.T) { target: structs.NewServiceName("web", nil), downstreams: false, expect: expect{ - idx: 9, + idx: 10, services: structs.ServiceList{ { Name: "api",