From 64da2bc8baf75b7c2dcf9387cee13d0f2afc05b0 Mon Sep 17 00:00:00 2001 From: slonka Date: Wed, 25 Sep 2024 09:55:39 +0200 Subject: [PATCH] chore(debug): try reproducing es flake Signed-off-by: slonka --- .github/workflows/build-test-distribute.yaml | 2 +- .../externalservices/externalservices.go | 45 ++++++++++--------- .../kubernetes/kubernetes_suite_test.go | 2 +- 3 files changed, 26 insertions(+), 23 deletions(-) diff --git a/.github/workflows/build-test-distribute.yaml b/.github/workflows/build-test-distribute.yaml index ff210f691c07..e96345b1ab9e 100644 --- a/.github/workflows/build-test-distribute.yaml +++ b/.github/workflows/build-test-distribute.yaml @@ -84,7 +84,7 @@ jobs: uses: ./.github/workflows/_test.yaml with: FULL_MATRIX: ${{ needs.check.outputs.FULL_MATRIX }} - RUNNERS_BY_ARCH: ${{ (github.event_name == 'push' || github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository) && '{"amd64":"ubuntu-latest-kong","arm64":"ubuntu-latest-arm64-kong"}' || '{"amd64":"ubuntu-latest","arm64":""}' }} + RUNNERS_BY_ARCH: ${{ (github.event_name == 'push' || github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository) && '{"amd64":"ubuntu-latest-kong","arm64":"ubuntu-latest-arm64-kong"}' || '{"amd64":"ubuntu-latest-kong","arm64":""}' }} secrets: inherit build_publish: permissions: diff --git a/test/e2e_env/kubernetes/externalservices/externalservices.go b/test/e2e_env/kubernetes/externalservices/externalservices.go index 4c7ae831001e..7fafa7e99343 100644 --- a/test/e2e_env/kubernetes/externalservices/externalservices.go +++ b/test/e2e_env/kubernetes/externalservices/externalservices.go @@ -2,6 +2,7 @@ package externalservices import ( "fmt" + "github.com/google/uuid" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" @@ -14,15 +15,17 @@ import ( ) func ExternalServices() { - meshName := "external-services" - namespace := "external-services" - clientNamespace := "client-external-services" + id := uuid.NewString() + meshName := "external-services" + id + esService := "external-service" + id + namespace := "external-services" + id + clientNamespace := "client-external-services" + id mesh := ` apiVersion: kuma.io/v1alpha1 kind: Mesh metadata: - name: external-services + name: %s spec: mtls: enabledBackend: ca-1 @@ -35,8 +38,8 @@ spec: routing: zoneEgress: true ` - meshPassthroughEnabled := fmt.Sprintf(mesh, "true") - meshPassthroughDisabled := fmt.Sprintf(mesh, "false") + meshPassthroughEnabled := fmt.Sprintf(mesh, meshName, "true") + meshPassthroughDisabled := fmt.Sprintf(mesh, meshName, "false") BeforeAll(func() { err := NewClusterSetup(). @@ -59,24 +62,24 @@ spec: }) Context("non-TLS", func() { - externalService := ` + externalService := fmt.Sprintf(` apiVersion: kuma.io/v1alpha1 kind: ExternalService -mesh: external-services +mesh: %s metadata: name: external-service-1 spec: tags: - kuma.io/service: external-service + kuma.io/service: %s kuma.io/protocol: http networking: - address: external-service.external-services.svc.cluster.local:80 # .svc.cluster.local is needed, otherwise Kubernetes will resolve this to the real IP -` + address: external-service.%s.svc.cluster.local:80 # .svc.cluster.local is needed, otherwise Kubernetes will resolve this to the real IP +`, meshName, esService, namespace) - trafficPermission := ` + trafficPermission := fmt.Sprintf(` apiVersion: kuma.io/v1alpha1 kind: TrafficPermission -mesh: external-services +mesh: %s metadata: name: traffic-to-es spec: @@ -85,8 +88,8 @@ spec: kuma.io/service: '*' destinations: - match: - kuma.io/service: external-service -` + kuma.io/service: %s +`, meshName, esService) BeforeAll(func() { err := kubernetes.Cluster.Install(testserver.Install( @@ -96,11 +99,11 @@ spec: Expect(err).ToNot(HaveOccurred()) }) - It("should route to external-service", func() { + FIt("should route to external-service", func() { // given working communication outside the mesh with passthrough enabled and no traffic permission Eventually(func(g Gomega) { _, err := client.CollectEchoResponse( - kubernetes.Cluster, "demo-client", "external-service.external-services", + kubernetes.Cluster, "demo-client", fmt.Sprintf("external-service.%s", namespace), client.FromKubernetesPod(clientNamespace, "demo-client"), ) g.Expect(err).ToNot(HaveOccurred()) @@ -112,7 +115,7 @@ spec: // then accessing the external service is no longer possible Eventually(func(g Gomega) { response, err := client.CollectFailure( - kubernetes.Cluster, "demo-client", "external-service.external-services", + kubernetes.Cluster, "demo-client", fmt.Sprintf("external-service.%s", namespace), client.FromKubernetesPod(clientNamespace, "demo-client"), ) g.Expect(err).ToNot(HaveOccurred()) @@ -125,7 +128,7 @@ spec: // then traffic is still blocked because of lack of the traffic permission Eventually(func(g Gomega) { response, err := client.CollectFailure( - kubernetes.Cluster, "demo-client", "external-service.external-services", + kubernetes.Cluster, "demo-client", fmt.Sprintf("external-service.%s", namespace), client.FromKubernetesPod(clientNamespace, "demo-client"), ) g.Expect(err).ToNot(HaveOccurred()) @@ -138,7 +141,7 @@ spec: // then you can access external service again Eventually(func(g Gomega) { _, err := client.CollectEchoResponse( - kubernetes.Cluster, "demo-client", "external-service.external-services", + kubernetes.Cluster, "demo-client", fmt.Sprintf("external-service.%s", namespace), client.FromKubernetesPod(clientNamespace, "demo-client"), ) g.Expect(err).ToNot(HaveOccurred()) @@ -147,7 +150,7 @@ spec: // and you can also use .mesh on port of the provided host Eventually(func(g Gomega) { _, err := client.CollectEchoResponse( - kubernetes.Cluster, "demo-client", "external-service.mesh", + kubernetes.Cluster, "demo-client", fmt.Sprintf("%s.mesh", esService), client.FromKubernetesPod(clientNamespace, "demo-client"), ) g.Expect(err).ToNot(HaveOccurred()) diff --git a/test/e2e_env/kubernetes/kubernetes_suite_test.go b/test/e2e_env/kubernetes/kubernetes_suite_test.go index 3135fee97213..0197b1900bf4 100644 --- a/test/e2e_env/kubernetes/kubernetes_suite_test.go +++ b/test/e2e_env/kubernetes/kubernetes_suite_test.go @@ -74,7 +74,7 @@ var ( _ = Describe("K8S API Bypass", k8s_api_bypass.K8sApiBypass, Ordered) _ = Describe("Reachable Services", reachableservices.ReachableServices, Ordered) _ = Describe("Defaults", defaults.Defaults, Ordered) - _ = Describe("External Services", externalservices.ExternalServices, Ordered) + _ = FDescribe("External Services", externalservices.ExternalServices, Ordered) _ = Describe("External Services Permissive MTLS", externalservices.PermissiveMTLS, Ordered) _ = Describe("Mesh External Services", meshexternalservices.MeshExternalServices, Ordered) _ = Describe("ExternalName Services", externalname_services.ExternalNameServices, Ordered)