diff --git a/pkg/xds/topology/outbound.go b/pkg/xds/topology/outbound.go index 5098eb483592..50ea6d698dbb 100644 --- a/pkg/xds/topology/outbound.go +++ b/pkg/xds/topology/outbound.go @@ -267,10 +267,6 @@ func fillLocalMeshServices( continue } - if meshSvc.Spec.Selector.DataplaneRef != nil { - continue - } - for _, dpp := range dpps { dpNetworking := dpp.Spec.GetNetworking() for _, inbound := range dpNetworking.GetHealthyInbounds() { diff --git a/pkg/xds/topology/outbound_test.go b/pkg/xds/topology/outbound_test.go index fd13094db2a1..40431dda12ef 100644 --- a/pkg/xds/topology/outbound_test.go +++ b/pkg/xds/topology/outbound_test.go @@ -1168,7 +1168,7 @@ var _ = Describe("TrafficRoute", func() { }, dataplanes: []*core_mesh.DataplaneResource{ { - Meta: &test_model.ResourceMeta{Mesh: defaultMeshName}, + Meta: &test_model.ResourceMeta{Mesh: defaultMeshName, Name: "redis-0"}, Spec: &mesh_proto.Dataplane{ Networking: &mesh_proto.Dataplane_Networking{ Address: "192.168.0.1", @@ -1248,6 +1248,25 @@ var _ = Describe("TrafficRoute", func() { }, }, }, + { + Meta: &test_model.ResourceMeta{ + Mesh: "default", + Name: "redis-0", + }, + Spec: &v1alpha1.MeshService{ + Selector: v1alpha1.Selector{ + DataplaneRef: &v1alpha1.DataplaneRef{ + Name: "redis-0", + }, + }, + Ports: []v1alpha1.Port{ + { + Port: 6379, + TargetPort: intstr.FromInt(6379), + }, + }, + }, + }, }, mesh: defaultMeshWithMTLS, expected: core_xds.EndpointMap{ @@ -1260,6 +1279,15 @@ var _ = Describe("TrafficRoute", func() { Weight: 1, }, }, + "redis-0_svc_6379": []core_xds.Endpoint{ + { + Target: "192.168.0.1", + Port: 6379, + Tags: map[string]string{mesh_proto.ServiceTag: "redis_svc_6379", "version": "v1"}, + Locality: nil, + Weight: 1, + }, + }, "kong_kong-system_svc_80": []core_xds.Endpoint{ { Target: "192.168.0.2",