From 61f1b6e42a3cc83868a359a6e6f736cf7bb70e07 Mon Sep 17 00:00:00 2001 From: slonka Date: Thu, 19 Sep 2024 15:28:33 +0200 Subject: [PATCH] chore(meshhealthcheck): prevent targeting meshexternalservice by validation Signed-off-by: slonka --- pkg/plugins/policies/core/matchers/egress_test.go | 4 ++-- .../policies/meshhealthcheck/api/v1alpha1/validator.go | 1 - .../policies/meshhealthcheck/api/v1alpha1/validator_test.go | 4 ++-- .../policies/meshhealthcheck/plugin/v1alpha1/plugin_test.go | 2 +- .../universal/meshexternalservice/meshexternalservice.go | 2 +- 5 files changed, 6 insertions(+), 7 deletions(-) diff --git a/pkg/plugins/policies/core/matchers/egress_test.go b/pkg/plugins/policies/core/matchers/egress_test.go index e7e8e61ccd36..1d8502d00188 100644 --- a/pkg/plugins/policies/core/matchers/egress_test.go +++ b/pkg/plugins/policies/core/matchers/egress_test.go @@ -128,7 +128,7 @@ var _ = Describe("EgressMatchedPolicies", func() { Expect(err).ToNot(HaveOccurred()) Expect(bytes).To(test_matchers.MatchGoldenYAML(strings.Replace(inputFile, ".input.", ".golden.", 1))) }, - Entry("should generate to resource rules for egress and mesh externalservice"), + XEntry("should generate to resource rules for egress and mesh externalservice"), ) }, test.EntriesForFolder(filepath.Join("egressmatchedpolicies", "meshexternalservice", "torules")), @@ -151,7 +151,7 @@ var _ = Describe("EgressMatchedPolicies", func() { Expect(err).ToNot(HaveOccurred()) Expect(bytes).To(test_matchers.MatchGoldenYAML(strings.Replace(inputFile, ".input.", ".golden.", 1))) }, - Entry("should generate to resource rules for egress and mesh externalservice"), + XEntry("should generate to resource rules for egress and mesh externalservice"), ) }, test.EntriesForFolder(filepath.Join("egressmatchedpolicies", "meshexternalservice", "fromtorules")), diff --git a/pkg/plugins/policies/meshhealthcheck/api/v1alpha1/validator.go b/pkg/plugins/policies/meshhealthcheck/api/v1alpha1/validator.go index fe7620053de3..ba1eb0be209d 100644 --- a/pkg/plugins/policies/meshhealthcheck/api/v1alpha1/validator.go +++ b/pkg/plugins/policies/meshhealthcheck/api/v1alpha1/validator.go @@ -40,7 +40,6 @@ func validateTo(topTargetRef common_api.TargetRef, to []To) validators.Validatio SupportedKinds: []common_api.TargetRefKind{ common_api.Mesh, common_api.MeshService, - common_api.MeshExternalService, common_api.MeshMultiZoneService, }, })) diff --git a/pkg/plugins/policies/meshhealthcheck/api/v1alpha1/validator_test.go b/pkg/plugins/policies/meshhealthcheck/api/v1alpha1/validator_test.go index 5cfb573e4409..a53850475d1e 100644 --- a/pkg/plugins/policies/meshhealthcheck/api/v1alpha1/validator_test.go +++ b/pkg/plugins/policies/meshhealthcheck/api/v1alpha1/validator_test.go @@ -82,7 +82,7 @@ to: tcp: # it will pick the protocol as described in 'protocol selection' section disabled: true # new, default false, can be disabled for override `), - Entry("to level MeshExternalService", ` + XEntry("to level MeshExternalService", ` targetRef: kind: Mesh to: @@ -295,7 +295,7 @@ violations: - field: spec.to[0].default.http.expectedStatuses[1] message: must be in inclusive range [100, 599]`, }), - Entry("cannot use MeshExternalService with other type than Mesh", testCase{ + XEntry("cannot use MeshExternalService with other type than Mesh", testCase{ inputYaml: ` targetRef: kind: MeshSubset diff --git a/pkg/plugins/policies/meshhealthcheck/plugin/v1alpha1/plugin_test.go b/pkg/plugins/policies/meshhealthcheck/plugin/v1alpha1/plugin_test.go index 0d6ad00ba931..944127b36968 100644 --- a/pkg/plugins/policies/meshhealthcheck/plugin/v1alpha1/plugin_test.go +++ b/pkg/plugins/policies/meshhealthcheck/plugin/v1alpha1/plugin_test.go @@ -287,7 +287,7 @@ var _ = Describe("MeshHealthCheck", func() { }), ) - It("should generate correct configuration for MeshExternalService with ZoneEgress", func() { + XIt("should generate correct configuration for MeshExternalService with ZoneEgress", func() { // given rs := core_xds.NewResourceSet() rs.Add(&core_xds.Resource{ diff --git a/test/e2e_env/universal/meshexternalservice/meshexternalservice.go b/test/e2e_env/universal/meshexternalservice/meshexternalservice.go index b961186ce510..a8bea2a543bc 100644 --- a/test/e2e_env/universal/meshexternalservice/meshexternalservice.go +++ b/test/e2e_env/universal/meshexternalservice/meshexternalservice.go @@ -591,7 +591,7 @@ spec: }) }) - Context("MeshExternalService with MeshHealthCheck", func() { + XContext("MeshExternalService with MeshHealthCheck", func() { E2EAfterEach(func() { Expect(DeleteMeshResources(universal.Cluster, meshNameNoDefaults, meshhealthcheck_api.MeshHealthCheckResourceTypeDescriptor,