diff --git a/pkg/plugins/policies/meshhttproute/plugin/v1alpha1/plugin_test.go b/pkg/plugins/policies/meshhttproute/plugin/v1alpha1/plugin_test.go index b942d658c1bb..8b08eb5b3047 100644 --- a/pkg/plugins/policies/meshhttproute/plugin/v1alpha1/plugin_test.go +++ b/pkg/plugins/policies/meshhttproute/plugin/v1alpha1/plugin_test.go @@ -263,9 +263,10 @@ var _ = Describe("MeshHTTPRoute", func() { } }()), Entry("default-meshmultizoneservice", func() outboundsTestCase { - backendDP := samples.DataplaneWebBuilder(). + backendDP := builders.Dataplane(). + WithName("backend"). + WithAddress("192.168.0.4"). AddInbound(builders.Inbound(). - WithAddress("192.168.0.4"). WithPort(8084). WithTags(map[string]string{ mesh_proto.ServiceTag: "backend", @@ -274,9 +275,18 @@ var _ = Describe("MeshHTTPRoute", func() { }), ).Build() meshSvc := meshservice_api.MeshServiceResource{ - Meta: &test_model.ResourceMeta{Name: "backend", Mesh: "default"}, + Meta: &test_model.ResourceMeta{ + Name: "backend", Mesh: "default", + Labels: map[string]string{ + "service": "backend", + }, + }, Spec: &meshservice_api.MeshService{ - Selector: meshservice_api.Selector{}, + Selector: meshservice_api.Selector{ + DataplaneTags: meshservice_api.DataplaneTags{ + mesh_proto.ServiceTag: "backend", + }, + }, Ports: []meshservice_api.Port{{ Port: 80, TargetPort: intstr.FromInt(8084), @@ -287,10 +297,6 @@ var _ = Describe("MeshHTTPRoute", func() { Type: meshservice_api.MeshServiceIdentityServiceTagType, Value: "backend", }, - { - Type: meshservice_api.MeshServiceIdentityServiceTagType, - Value: "other-backend", - }, }, }, Status: &meshservice_api.MeshServiceStatus{ @@ -302,7 +308,13 @@ var _ = Describe("MeshHTTPRoute", func() { meshMZSvc := meshmultizoneservice_api.MeshMultiZoneServiceResource{ Meta: &test_model.ResourceMeta{Name: "multi-backend", Mesh: "default"}, Spec: &meshmultizoneservice_api.MeshMultiZoneService{ - Selector: meshmultizoneservice_api.Selector{}, + Selector: meshmultizoneservice_api.Selector{ + MeshService: meshmultizoneservice_api.MeshServiceSelector{ + MatchLabels: map[string]string{ + "service": "backend", + }, + }, + }, Ports: []meshmultizoneservice_api.Port{{ Port: 80, AppProtocol: core_mesh.ProtocolHTTP, diff --git a/pkg/plugins/policies/meshhttproute/plugin/v1alpha1/testdata/default-meshmultizoneservice.clusters.golden.yaml b/pkg/plugins/policies/meshhttproute/plugin/v1alpha1/testdata/default-meshmultizoneservice.clusters.golden.yaml index f64ed3b3f811..b594ac7ee6e5 100644 --- a/pkg/plugins/policies/meshhttproute/plugin/v1alpha1/testdata/default-meshmultizoneservice.clusters.golden.yaml +++ b/pkg/plugins/policies/meshhttproute/plugin/v1alpha1/testdata/default-meshmultizoneservice.clusters.golden.yaml @@ -20,9 +20,6 @@ resources: - matcher: exact: spiffe://default/backend sanType: URI - - matcher: - exact: spiffe://default/other-backend - sanType: URI validationContextSdsSecretConfig: name: mesh_ca:secret:default sdsConfig: diff --git a/pkg/plugins/policies/meshhttproute/plugin/v1alpha1/testdata/default-meshmultizoneservice.endpoints.golden.yaml b/pkg/plugins/policies/meshhttproute/plugin/v1alpha1/testdata/default-meshmultizoneservice.endpoints.golden.yaml index 3f64ad2b0044..ec63a32385e8 100644 --- a/pkg/plugins/policies/meshhttproute/plugin/v1alpha1/testdata/default-meshmultizoneservice.endpoints.golden.yaml +++ b/pkg/plugins/policies/meshhttproute/plugin/v1alpha1/testdata/default-meshmultizoneservice.endpoints.golden.yaml @@ -3,3 +3,19 @@ resources: resource: '@type': type.googleapis.com/envoy.config.endpoint.v3.ClusterLoadAssignment clusterName: default_multi-backend___mzsvc_80 + endpoints: + - lbEndpoints: + - endpoint: + address: + socketAddress: + address: 192.168.0.4 + portValue: 8084 + loadBalancingWeight: 1 + metadata: + filterMetadata: + envoy.lb: + app: backend + kuma.io/protocol: http + envoy.transport_socket_match: + app: backend + kuma.io/protocol: http