From 11987ca7fd66378e10267a09d4e2b545f7535b09 Mon Sep 17 00:00:00 2001 From: Jenny Shu Date: Mon, 27 Jan 2025 16:24:50 -0500 Subject: [PATCH 1/4] add back workflow --- .github/workflows/pr-kubernetes-tests.yaml | 139 ++++++++++++++++++ .../workflows/pr-kubernetes-tests.yaml_noop | 134 ----------------- 2 files changed, 139 insertions(+), 134 deletions(-) create mode 100644 .github/workflows/pr-kubernetes-tests.yaml delete mode 100644 .github/workflows/pr-kubernetes-tests.yaml_noop diff --git a/.github/workflows/pr-kubernetes-tests.yaml b/.github/workflows/pr-kubernetes-tests.yaml new file mode 100644 index 00000000000..757957547a8 --- /dev/null +++ b/.github/workflows/pr-kubernetes-tests.yaml @@ -0,0 +1,139 @@ +name: Kubernetes Tests +on: + pull_request: + types: [opened, synchronize, reopened, ready_for_review] + +env: + VERSION: '1.0.0-ci1' + GITHUB_TOKEN: ${{ github.token }} + +jobs: + # TODO consider adding back later if we want to handle skip directives. + # currently we don't have changelogs to add the skip directives to + # prepare_env: + # name: Prepare Environment + # runs-on: ubuntu-22.04 + # timeout-minutes: 5 + # outputs: + # should-auto-succeed-kube-tests: ${{ steps.run-strategy.outputs.auto_succeed }} + # steps: + # - name: Cancel Previous Actions + # uses: styfle/cancel-workflow-action@0.12.1 + # with: + # access_token: ${{ github.token }} + # - id: checkout-code + # uses: actions/checkout@v4 + # with: + # # We require gathering the branch and tag history since we rely on a `git diff` + # # which compares the state of two branches + # fetch-depth: 0 + # - id: process-skip-directives + # uses: ./.github/actions/process-skip-directives + # with: + # base-ref: ${{ github.base_ref }} + # - id: run-strategy + # name: Determine Test Run Strategy + # run: | + # skip_kube_tests=${{ steps.process-skip-directives.outputs.skip-kube-tests }} + # if [[ ! -z $skip_kube_tests && $skip_kube_tests = true ]] ; then + # echo "auto_succeed=true" >> $GITHUB_OUTPUT + # fi + + end_to_end_tests: + name: End-to-End (${{ matrix.test.cluster-name }}) + # needs: prepare_env + runs-on: ubuntu-22.04 + timeout-minutes: 60 + if: ${{ !github.event.pull_request.draft }} + strategy: + fail-fast: false + matrix: + # We intentionally set an upper threshold of 30 minutes for our End-to-End tests + # Our goal is to load balance tests in a way that allows quick iteration on PRs + # If tests are exceeding the 30-minute limit, please see: + # /test/kubernetes/e2e/load_balancing_tests.md + # + # Above each test below, we document the latest date/time for the GitHub action step to run + # NOTE: We use the GitHub action step time (as opposed to the `go test` time), because it is easier to capture + + test: + - cluster-name: 'cluster-one' + go-test-args: '-v -timeout=25m' + go-test-run-regex: '^TestK8sGateway$$/^RouteDelegation$$' + # Dec 4, 2024: 22 minutes + # - cluster-name: 'cluster-one' + # go-test-args: '-v -timeout=25m' + # go-test-run-regex: '^TestK8sGateway$$/^RouteDelegation$$|^TestGlooctlGlooGatewayEdgeGateway$$|^TestGlooctlK8sGateway$$' + + # # Dec 4, 2024: 23 minutes + # - cluster-name: 'cluster-two' + # go-test-args: '-v -timeout=25m' + # go-test-run-regex: '^TestK8sGatewayIstioRevision$$|^TestRevisionIstioRegression$$|^TestK8sGateway$$/^Deployer$$|^TestK8sGateway$$/^RouteOptions$$|^TestK8sGateway$$/^VirtualHostOptions$$|^TestK8sGateway$$/^Upstreams$$|^TestK8sGateway$$/^HeadlessSvc$$|^TestK8sGateway$$/^PortRouting$$|^TestK8sGatewayMinimalDefaultGatewayParameters$$|^TestK8sGateway$$/^DirectResponse$$|^TestK8sGateway$$/^HttpListenerOptions$$|^TestK8sGateway$$/^ListenerOptions$$|^TestK8sGateway$$/^GlooAdminServer$$' + + # # Dec 4, 2024: 24 minutes + # - cluster-name: 'cluster-three' + # go-test-args: '-v -timeout=30m' + # go-test-run-regex: '(^TestK8sGatewayIstioAutoMtls$$|^TestAutomtlsIstioEdgeApisGateway$$|^TestIstioEdgeApiGateway$$|^TestIstioRegression$$)' + + # # Dec 4, 2024: 21 minutes + # - cluster-name: 'cluster-four' + # go-test-args: '-v -timeout=30m' + # go-test-run-regex: '(^TestK8sGatewayIstio$$|^TestGlooGatewayEdgeGateway$$|^TestGlooctlIstioInjectEdgeApiGateway$$)' + + # # Dec 4, 2024: 24 minutes + # - cluster-name: 'cluster-five' + # go-test-args: '-v -timeout=30m' + # go-test-run-regex: '^TestFullEnvoyValidation$$|^TestValidationStrict$$|^TestValidationAlwaysAccept$$|^TestTransformationValidationDisabled$$' + + # # Dec 4, 2024: 26 minutes + # - cluster-name: 'cluster-six' + # go-test-args: '-v -timeout=30m' + # go-test-run-regex: '^TestDiscoveryWatchlabels$$|^TestK8sGatewayNoValidation$$|^TestHelm$$|^TestHelmSettings$$|^TestK8sGatewayAws$$|^TestK8sGateway$$/^HTTPRouteServices$$|^TestK8sGateway$$/^TCPRouteServices$$|^TestZeroDowntimeRollout$$' + + # # Dec 4, 2024: 13 minutes + # - cluster-name: 'cluster-seven' + # go-test-args: '-v -timeout=25m' + # go-test-run-regex: '^TestK8sGateway$$/^CRDCategories$$|^TestK8sGateway$$/^Metrics$$|^TestGloomtlsGatewayEdgeGateway$$|^TestWatchNamespaceSelector$$' + + # In our PR tests, we run the suite of tests using the upper ends of versions that we claim to support + # The versions should mirror: https://docs.solo.io/gloo-edge/latest/reference/support/ + version-files: + - file: './.github/workflows/.env/pr-tests/versions.env' + steps: + # - id: auto-succeed-tests + # if: needs.prepare_env.outputs.should-auto-succeed-kube-tests == 'true' + # run: | + # echo "Regression tests auto-succeeded" + - uses: actions/checkout@v4 + - name: Prep Go Runner + uses: ./.github/actions/prep-go-runner + # if: needs.prepare_env.outputs.should-auto-succeed-kube-tests != 'true' + # The dotenv action is used to load key-value pairs from files. + # In this case, the file is specified in the matrix and will contain the versions of the tools to use + - name: Dotenv Action + uses: falti/dotenv-action@v1.1.4 + # if: needs.prepare_env.outputs.should-auto-succeed-kube-tests != 'true' + id: dotenv + with: + path: ${{ matrix.version-files.file }} + log-variables: true + - id: setup-kind-cluster + name: Setup KinD Cluster + # if: needs.prepare_env.outputs.should-auto-succeed-kube-tests != 'true' + uses: ./.github/actions/setup-kind-cluster + with: + cluster-name: ${{ matrix.test.cluster-name }} + kind-node-version: ${{ steps.dotenv.outputs.node_version }} + kind-version: ${{ steps.dotenv.outputs.kind_version }} + kubectl-version: ${{ steps.dotenv.outputs.kubectl_version }} + helm-version: ${{ steps.dotenv.outputs.helm_version }} + istio-version: ${{ steps.dotenv.outputs.istio_version }} + - id: run-tests + # if: needs.prepare_env.outputs.should-auto-succeed-kube-tests != 'true' + uses: ./.github/actions/kubernetes-e2e-tests + with: + cluster-name: ${{ matrix.test.cluster-name }} + test-args: ${{ matrix.test.go-test-args }} + run-regex: ${{ matrix.test.go-test-run-regex }} + istio-version: ${{ steps.dotenv.outputs.istio_version }} + matrix-label: "pr" diff --git a/.github/workflows/pr-kubernetes-tests.yaml_noop b/.github/workflows/pr-kubernetes-tests.yaml_noop deleted file mode 100644 index d78c691f937..00000000000 --- a/.github/workflows/pr-kubernetes-tests.yaml_noop +++ /dev/null @@ -1,134 +0,0 @@ -# name: Kubernetes Tests -# on: -# pull_request: -# types: [opened, synchronize, reopened, ready_for_review] - -# env: -# VERSION: '1.0.0-ci1' -# GITHUB_TOKEN: ${{ github.token }} - -# jobs: -# prepare_env: -# name: Prepare Environment -# runs-on: ubuntu-22.04 -# timeout-minutes: 5 -# outputs: -# should-auto-succeed-kube-tests: ${{ steps.run-strategy.outputs.auto_succeed }} -# steps: -# - name: Cancel Previous Actions -# uses: styfle/cancel-workflow-action@0.12.1 -# with: -# access_token: ${{ github.token }} -# - id: checkout-code -# uses: actions/checkout@v4 -# with: -# # We require gathering the branch and tag history since we rely on a `git diff` -# # which compares the state of two branches -# fetch-depth: 0 -# - id: process-skip-directives -# uses: ./.github/actions/process-skip-directives -# with: -# base-ref: ${{ github.base_ref }} -# - id: run-strategy -# name: Determine Test Run Strategy -# run: | -# skip_kube_tests=${{ steps.process-skip-directives.outputs.skip-kube-tests }} -# if [[ ! -z $skip_kube_tests && $skip_kube_tests = true ]] ; then -# echo "auto_succeed=true" >> $GITHUB_OUTPUT -# fi - -# end_to_end_tests: -# name: End-to-End (${{ matrix.test.cluster-name }}) -# needs: prepare_env -# runs-on: ubuntu-22.04 -# timeout-minutes: 60 -# if: ${{ !github.event.pull_request.draft }} -# strategy: -# fail-fast: false -# matrix: -# # We intentionally set an upper threshold of 30 minutes for our End-to-End tests -# # Our goal is to load balance tests in a way that allows quick iteration on PRs -# # If tests are exceeding the 30-minute limit, please see: -# # /test/kubernetes/e2e/load_balancing_tests.md -# # -# # Above each test below, we document the latest date/time for the GitHub action step to run -# # NOTE: We use the GitHub action step time (as opposed to the `go test` time), because it is easier to capture - -# test: -# # Dec 4, 2024: 22 minutes -# - cluster-name: 'cluster-one' -# go-test-args: '-v -timeout=25m' -# go-test-run-regex: '^TestK8sGateway$$/^RouteDelegation$$|^TestGlooctlGlooGatewayEdgeGateway$$|^TestGlooctlK8sGateway$$' - -# # Dec 4, 2024: 23 minutes -# - cluster-name: 'cluster-two' -# go-test-args: '-v -timeout=25m' -# go-test-run-regex: '^TestK8sGatewayIstioRevision$$|^TestRevisionIstioRegression$$|^TestK8sGateway$$/^Deployer$$|^TestK8sGateway$$/^RouteOptions$$|^TestK8sGateway$$/^VirtualHostOptions$$|^TestK8sGateway$$/^Upstreams$$|^TestK8sGateway$$/^HeadlessSvc$$|^TestK8sGateway$$/^PortRouting$$|^TestK8sGatewayMinimalDefaultGatewayParameters$$|^TestK8sGateway$$/^DirectResponse$$|^TestK8sGateway$$/^HttpListenerOptions$$|^TestK8sGateway$$/^ListenerOptions$$|^TestK8sGateway$$/^GlooAdminServer$$' - -# # Dec 4, 2024: 24 minutes -# - cluster-name: 'cluster-three' -# go-test-args: '-v -timeout=30m' -# go-test-run-regex: '(^TestK8sGatewayIstioAutoMtls$$|^TestAutomtlsIstioEdgeApisGateway$$|^TestIstioEdgeApiGateway$$|^TestIstioRegression$$)' - -# # Dec 4, 2024: 21 minutes -# - cluster-name: 'cluster-four' -# go-test-args: '-v -timeout=30m' -# go-test-run-regex: '(^TestK8sGatewayIstio$$|^TestGlooGatewayEdgeGateway$$|^TestGlooctlIstioInjectEdgeApiGateway$$)' - -# # Dec 4, 2024: 24 minutes -# - cluster-name: 'cluster-five' -# go-test-args: '-v -timeout=30m' -# go-test-run-regex: '^TestFullEnvoyValidation$$|^TestValidationStrict$$|^TestValidationAlwaysAccept$$|^TestTransformationValidationDisabled$$' - -# # Dec 4, 2024: 26 minutes -# - cluster-name: 'cluster-six' -# go-test-args: '-v -timeout=30m' -# go-test-run-regex: '^TestDiscoveryWatchlabels$$|^TestK8sGatewayNoValidation$$|^TestHelm$$|^TestHelmSettings$$|^TestK8sGatewayAws$$|^TestK8sGateway$$/^HTTPRouteServices$$|^TestK8sGateway$$/^TCPRouteServices$$|^TestZeroDowntimeRollout$$' - -# # Dec 4, 2024: 13 minutes -# - cluster-name: 'cluster-seven' -# go-test-args: '-v -timeout=25m' -# go-test-run-regex: '^TestK8sGateway$$/^CRDCategories$$|^TestK8sGateway$$/^Metrics$$|^TestGloomtlsGatewayEdgeGateway$$|^TestWatchNamespaceSelector$$' - -# # In our PR tests, we run the suite of tests using the upper ends of versions that we claim to support -# # The versions should mirror: https://docs.solo.io/gloo-edge/latest/reference/support/ -# version-files: -# - file: './.github/workflows/.env/pr-tests/versions.env' -# steps: -# - id: auto-succeed-tests -# if: needs.prepare_env.outputs.should-auto-succeed-kube-tests == 'true' -# run: | -# echo "Regression tests auto-succeeded" -# - uses: actions/checkout@v4 -# - name: Prep Go Runner -# uses: ./.github/actions/prep-go-runner -# if: needs.prepare_env.outputs.should-auto-succeed-kube-tests != 'true' -# # The dotenv action is used to load key-value pairs from files. -# # In this case, the file is specified in the matrix and will contain the versions of the tools to use -# - name: Dotenv Action -# uses: falti/dotenv-action@v1.1.4 -# if: needs.prepare_env.outputs.should-auto-succeed-kube-tests != 'true' -# id: dotenv -# with: -# path: ${{ matrix.version-files.file }} -# log-variables: true -# - id: setup-kind-cluster -# name: Setup KinD Cluster -# if: needs.prepare_env.outputs.should-auto-succeed-kube-tests != 'true' -# uses: ./.github/actions/setup-kind-cluster -# with: -# cluster-name: ${{ matrix.test.cluster-name }} -# kind-node-version: ${{ steps.dotenv.outputs.node_version }} -# kind-version: ${{ steps.dotenv.outputs.kind_version }} -# kubectl-version: ${{ steps.dotenv.outputs.kubectl_version }} -# helm-version: ${{ steps.dotenv.outputs.helm_version }} -# istio-version: ${{ steps.dotenv.outputs.istio_version }} -# - id: run-tests -# if: needs.prepare_env.outputs.should-auto-succeed-kube-tests != 'true' -# uses: ./.github/actions/kubernetes-e2e-tests -# with: -# cluster-name: ${{ matrix.test.cluster-name }} -# test-args: ${{ matrix.test.go-test-args }} -# run-regex: ${{ matrix.test.go-test-run-regex }} -# istio-version: ${{ steps.dotenv.outputs.istio_version }} -# matrix-label: "pr" From caa9c0c92891d94d28600d98510727cc9b807477 Mon Sep 17 00:00:00 2001 From: Jenny Shu Date: Thu, 30 Jan 2025 13:34:23 -0500 Subject: [PATCH 2/4] cleanup --- .../e2e/features/admin_server/suite.go | 4 - .../virtualhost_options/vhost_opt_suite.go | 20 +-- test/kubernetes/e2e/suite.go | 2 - test/kubernetes/e2e/test.go | 2 - test/kubernetes/e2e/tests/k8s_gw_aws_test.go | 1 - .../kubernetes/e2e/tests/k8s_gw_istio_test.go | 1 - ..._minimal_default_gatewayparameters_test.go | 2 - .../e2e/tests/k8s_gw_no_validation_test.go | 2 - test/kubernetes/e2e/tests/k8s_gw_test.go | 4 - test/kubernetes/e2e/tests/k8s_gw_tests.go | 64 ++++---- test/kubernetes/e2e/tests/upgrade_test.go | 2 - .../testutils/assertions/objects.go | 32 +--- .../testutils/gloogateway/clients.go | 148 ------------------ .../testutils/gloogateway/context.go | 10 -- 14 files changed, 44 insertions(+), 250 deletions(-) delete mode 100644 test/kubernetes/testutils/gloogateway/clients.go diff --git a/test/kubernetes/e2e/features/admin_server/suite.go b/test/kubernetes/e2e/features/admin_server/suite.go index e344e029cc1..5e80a9cd081 100644 --- a/test/kubernetes/e2e/features/admin_server/suite.go +++ b/test/kubernetes/e2e/features/admin_server/suite.go @@ -77,10 +77,6 @@ func (s *testingSuite) TestGetInputSnapshotIncludesEdgeApiResources() { // TestGetInputSnapshotIncludesK8sGatewayApiResources verifies that we can query the /snapshots/input API and have it return K8s Gateway API // resources without an error func (s *testingSuite) TestGetInputSnapshotIncludesK8sGatewayApiResources() { - if !s.testInstallation.Metadata.K8sGatewayEnabled { - s.T().Skip("Installation of Gloo Gateway does not have K8s Gateway enabled, skipping test as there is nothing to test") - } - s.T().Cleanup(func() { err := s.testInstallation.Actions.Kubectl().DeleteFile(s.ctx, gatewayParametersManifest) s.NoError(err, "can delete manifest") diff --git a/test/kubernetes/e2e/features/virtualhost_options/vhost_opt_suite.go b/test/kubernetes/e2e/features/virtualhost_options/vhost_opt_suite.go index 49c7d2a9ca0..9eae55ae0eb 100644 --- a/test/kubernetes/e2e/features/virtualhost_options/vhost_opt_suite.go +++ b/test/kubernetes/e2e/features/virtualhost_options/vhost_opt_suite.go @@ -157,20 +157,12 @@ func (s *testingSuite) TestConfigureInvalidVirtualHostOptions() { s.testInstallation.Assertions.ExpectObjectAdmitted(manifestVhoWebhookReject, err, output, "Validating *v1.VirtualHostOption failed") - if !s.testInstallation.Metadata.ValidationAlwaysAccept { - s.testInstallation.Assertions.ExpectGlooObjectNotExist( - s.ctx, - s.getterForMeta(&vhoWebhookReject), - &vhoWebhookReject, - ) - } else { - // Check status is rejected on bad VirtualHostOption - s.testInstallation.Assertions.EventuallyResourceStatusMatchesState( - s.getterForMeta(&vhoWebhookReject), - core.Status_Rejected, - defaults.KubeGatewayReporter, - ) - } + // Check status is rejected on bad VirtualHostOption + s.testInstallation.Assertions.EventuallyResourceStatusMatchesState( + s.getterForMeta(&vhoWebhookReject), + core.Status_Rejected, + defaults.KubeGatewayReporter, + ) // Check healthy response with no x-bar header s.testInstallation.Assertions.AssertEventualCurlResponse( diff --git a/test/kubernetes/e2e/suite.go b/test/kubernetes/e2e/suite.go index 100d3db7c74..cfa24ba6972 100644 --- a/test/kubernetes/e2e/suite.go +++ b/test/kubernetes/e2e/suite.go @@ -1,5 +1,3 @@ -//go:build ignore - package e2e import ( diff --git a/test/kubernetes/e2e/test.go b/test/kubernetes/e2e/test.go index b632396b773..376764cd09b 100644 --- a/test/kubernetes/e2e/test.go +++ b/test/kubernetes/e2e/test.go @@ -1,5 +1,3 @@ -//go:build ignore - package e2e import ( diff --git a/test/kubernetes/e2e/tests/k8s_gw_aws_test.go b/test/kubernetes/e2e/tests/k8s_gw_aws_test.go index b111b175561..b2101bafd34 100644 --- a/test/kubernetes/e2e/tests/k8s_gw_aws_test.go +++ b/test/kubernetes/e2e/tests/k8s_gw_aws_test.go @@ -26,7 +26,6 @@ func TestK8sGatewayAws(t *testing.T) { InstallNamespace: installNs, ProfileValuesManifestFile: e2e.KubernetesGatewayProfilePath, ValuesManifestFile: e2e.ManifestPath("aws-lambda-helm.yaml"), - K8sGatewayEnabled: true, // these should correspond to the `settings.aws.*` values in the aws-lambda-helm.yaml manifest AwsOptions: &gloogateway.AwsOptions{ EnableServiceAccountCredentials: true, diff --git a/test/kubernetes/e2e/tests/k8s_gw_istio_test.go b/test/kubernetes/e2e/tests/k8s_gw_istio_test.go index c459b611068..961f07441f0 100644 --- a/test/kubernetes/e2e/tests/k8s_gw_istio_test.go +++ b/test/kubernetes/e2e/tests/k8s_gw_istio_test.go @@ -25,7 +25,6 @@ func TestK8sGatewayIstio(t *testing.T) { InstallNamespace: installNs, ProfileValuesManifestFile: e2e.KubernetesGatewayProfilePath, ValuesManifestFile: e2e.ManifestPath("istio-automtls-disabled-helm.yaml"), - K8sGatewayEnabled: true, }, ) diff --git a/test/kubernetes/e2e/tests/k8s_gw_minimal_default_gatewayparameters_test.go b/test/kubernetes/e2e/tests/k8s_gw_minimal_default_gatewayparameters_test.go index 865a091200b..0704e6b4c8a 100644 --- a/test/kubernetes/e2e/tests/k8s_gw_minimal_default_gatewayparameters_test.go +++ b/test/kubernetes/e2e/tests/k8s_gw_minimal_default_gatewayparameters_test.go @@ -26,8 +26,6 @@ func TestK8sGatewayMinimalDefaultGatewayParameters(t *testing.T) { InstallNamespace: installNs, ProfileValuesManifestFile: e2e.KubernetesGatewayProfilePath, ValuesManifestFile: e2e.ManifestPath("k8s-gateway-minimal-default-gatewayparameters-test-helm.yaml"), - ValidationAlwaysAccept: false, - K8sGatewayEnabled: true, }, ) diff --git a/test/kubernetes/e2e/tests/k8s_gw_no_validation_test.go b/test/kubernetes/e2e/tests/k8s_gw_no_validation_test.go index c0546361ce1..de4f07462fa 100644 --- a/test/kubernetes/e2e/tests/k8s_gw_no_validation_test.go +++ b/test/kubernetes/e2e/tests/k8s_gw_no_validation_test.go @@ -25,8 +25,6 @@ func TestK8sGatewayNoValidation(t *testing.T) { InstallNamespace: installNs, ProfileValuesManifestFile: e2e.KubernetesGatewayProfilePath, ValuesManifestFile: e2e.ManifestPath("k8s-gateway-no-webhook-validation-test-helm.yaml"), - ValidationAlwaysAccept: true, - K8sGatewayEnabled: true, }, ) diff --git a/test/kubernetes/e2e/tests/k8s_gw_test.go b/test/kubernetes/e2e/tests/k8s_gw_test.go index 24860a580f8..a09ab549616 100644 --- a/test/kubernetes/e2e/tests/k8s_gw_test.go +++ b/test/kubernetes/e2e/tests/k8s_gw_test.go @@ -1,5 +1,3 @@ -//go:build ignore - package tests_test import ( @@ -25,8 +23,6 @@ func TestK8sGateway(t *testing.T) { InstallNamespace: installNs, ProfileValuesManifestFile: e2e.KubernetesGatewayProfilePath, ValuesManifestFile: e2e.EmptyValuesManifestPath, - ValidationAlwaysAccept: false, - K8sGatewayEnabled: true, }, ) diff --git a/test/kubernetes/e2e/tests/k8s_gw_tests.go b/test/kubernetes/e2e/tests/k8s_gw_tests.go index 1afd51c451a..f351fe78204 100644 --- a/test/kubernetes/e2e/tests/k8s_gw_tests.go +++ b/test/kubernetes/e2e/tests/k8s_gw_tests.go @@ -1,44 +1,44 @@ -//go:build ignore - package tests import ( "github.com/kgateway-dev/kgateway/test/kubernetes/e2e" - "github.com/kgateway-dev/kgateway/test/kubernetes/e2e/features/admin_server" - "github.com/kgateway-dev/kgateway/test/kubernetes/e2e/features/crd_categories" - "github.com/kgateway-dev/kgateway/test/kubernetes/e2e/features/deployer" - "github.com/kgateway-dev/kgateway/test/kubernetes/e2e/features/directresponse" - "github.com/kgateway-dev/kgateway/test/kubernetes/e2e/features/headless_svc" - "github.com/kgateway-dev/kgateway/test/kubernetes/e2e/features/http_listener_options" - "github.com/kgateway-dev/kgateway/test/kubernetes/e2e/features/listener_options" - "github.com/kgateway-dev/kgateway/test/kubernetes/e2e/features/metrics" - "github.com/kgateway-dev/kgateway/test/kubernetes/e2e/features/port_routing" - "github.com/kgateway-dev/kgateway/test/kubernetes/e2e/features/route_delegation" - "github.com/kgateway-dev/kgateway/test/kubernetes/e2e/features/route_options" - "github.com/kgateway-dev/kgateway/test/kubernetes/e2e/features/services/httproute" - "github.com/kgateway-dev/kgateway/test/kubernetes/e2e/features/services/tcproute" - "github.com/kgateway-dev/kgateway/test/kubernetes/e2e/features/upstreams" - "github.com/kgateway-dev/kgateway/test/kubernetes/e2e/features/virtualhost_options" + // "github.com/kgateway-dev/kgateway/test/kubernetes/e2e/features/admin_server" + // "github.com/kgateway-dev/kgateway/test/kubernetes/e2e/features/crd_categories" + // "github.com/kgateway-dev/kgateway/test/kubernetes/e2e/features/deployer" + // "github.com/kgateway-dev/kgateway/test/kubernetes/e2e/features/directresponse" + // "github.com/kgateway-dev/kgateway/test/kubernetes/e2e/features/headless_svc" + // "github.com/kgateway-dev/kgateway/test/kubernetes/e2e/features/http_listener_options" + // "github.com/kgateway-dev/kgateway/test/kubernetes/e2e/features/listener_options" + // "github.com/kgateway-dev/kgateway/test/kubernetes/e2e/features/metrics" + // "github.com/kgateway-dev/kgateway/test/kubernetes/e2e/features/port_routing" + // "github.com/kgateway-dev/kgateway/test/kubernetes/e2e/features/route_delegation" + // "github.com/kgateway-dev/kgateway/test/kubernetes/e2e/features/route_options" + // "github.com/kgateway-dev/kgateway/test/kubernetes/e2e/features/services/httproute" + // "github.com/kgateway-dev/kgateway/test/kubernetes/e2e/features/services/tcproute" + // "github.com/kgateway-dev/kgateway/test/kubernetes/e2e/features/upstreams" + // "github.com/kgateway-dev/kgateway/test/kubernetes/e2e/features/virtualhost_options" ) func KubeGatewaySuiteRunner() e2e.SuiteRunner { kubeGatewaySuiteRunner := e2e.NewSuiteRunner(false) - kubeGatewaySuiteRunner.Register("Deployer", deployer.NewTestingSuite) - kubeGatewaySuiteRunner.Register("HttpListenerOptions", http_listener_options.NewTestingSuite) - kubeGatewaySuiteRunner.Register("ListenerOptions", listener_options.NewTestingSuite) - kubeGatewaySuiteRunner.Register("RouteOptions", route_options.NewTestingSuite) - kubeGatewaySuiteRunner.Register("VirtualHostOptions", virtualhost_options.NewTestingSuite) - kubeGatewaySuiteRunner.Register("Upstreams", upstreams.NewTestingSuite) - kubeGatewaySuiteRunner.Register("HTTPRouteServices", httproute.NewTestingSuite) - kubeGatewaySuiteRunner.Register("TCPRouteServices", tcproute.NewTestingSuite) - kubeGatewaySuiteRunner.Register("HeadlessSvc", headless_svc.NewK8sGatewayHeadlessSvcSuite) - kubeGatewaySuiteRunner.Register("PortRouting", port_routing.NewK8sGatewayTestingSuite) - kubeGatewaySuiteRunner.Register("RouteDelegation", route_delegation.NewTestingSuite) - kubeGatewaySuiteRunner.Register("GlooAdminServer", admin_server.NewTestingSuite) - kubeGatewaySuiteRunner.Register("DirectResponse", directresponse.NewTestingSuite) - kubeGatewaySuiteRunner.Register("CRDCategories", crd_categories.NewTestingSuite) - kubeGatewaySuiteRunner.Register("Metrics", metrics.NewTestingSuite) + /* + kubeGatewaySuiteRunner.Register("Deployer", deployer.NewTestingSuite) + kubeGatewaySuiteRunner.Register("HttpListenerOptions", http_listener_options.NewTestingSuite) + kubeGatewaySuiteRunner.Register("ListenerOptions", listener_options.NewTestingSuite) + kubeGatewaySuiteRunner.Register("RouteOptions", route_options.NewTestingSuite) + kubeGatewaySuiteRunner.Register("VirtualHostOptions", virtualhost_options.NewTestingSuite) + kubeGatewaySuiteRunner.Register("Upstreams", upstreams.NewTestingSuite) + kubeGatewaySuiteRunner.Register("HTTPRouteServices", httproute.NewTestingSuite) + kubeGatewaySuiteRunner.Register("TCPRouteServices", tcproute.NewTestingSuite) + kubeGatewaySuiteRunner.Register("HeadlessSvc", headless_svc.NewK8sGatewayHeadlessSvcSuite) + kubeGatewaySuiteRunner.Register("PortRouting", port_routing.NewK8sGatewayTestingSuite) + kubeGatewaySuiteRunner.Register("RouteDelegation", route_delegation.NewTestingSuite) + kubeGatewaySuiteRunner.Register("GlooAdminServer", admin_server.NewTestingSuite) + kubeGatewaySuiteRunner.Register("DirectResponse", directresponse.NewTestingSuite) + kubeGatewaySuiteRunner.Register("CRDCategories", crd_categories.NewTestingSuite) + kubeGatewaySuiteRunner.Register("Metrics", metrics.NewTestingSuite) + */ return kubeGatewaySuiteRunner } diff --git a/test/kubernetes/e2e/tests/upgrade_test.go b/test/kubernetes/e2e/tests/upgrade_test.go index 814656e665b..6c1b9268ea0 100644 --- a/test/kubernetes/e2e/tests/upgrade_test.go +++ b/test/kubernetes/e2e/tests/upgrade_test.go @@ -30,7 +30,6 @@ func TestUpgradeFromLastPatchPreviousMinor(t *testing.T) { InstallNamespace: "upgrade-from-last-patch-previous-minor", ProfileValuesManifestFile: e2e.FullGatewayProfilePath, ValuesManifestFile: e2e.EmptyValuesManifestPath, - ValidationAlwaysAccept: false, ReleasedVersion: lastPatchPreviousMinorVersion.String(), }, ) @@ -57,7 +56,6 @@ func TestUpgradeFromCurrentPatchLatestMinor(t *testing.T) { InstallNamespace: "upgrade-from-current-patch-latest-minor", ProfileValuesManifestFile: e2e.FullGatewayProfilePath, ValuesManifestFile: e2e.EmptyValuesManifestPath, - ValidationAlwaysAccept: false, ReleasedVersion: currentPatchMostRecentMinorVersion.String(), }, ) diff --git a/test/kubernetes/testutils/assertions/objects.go b/test/kubernetes/testutils/assertions/objects.go index 92ad0f6a705..f1f2987ca2e 100644 --- a/test/kubernetes/testutils/assertions/objects.go +++ b/test/kubernetes/testutils/assertions/objects.go @@ -5,7 +5,6 @@ package assertions import ( "context" "fmt" - "strings" "time" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -82,36 +81,17 @@ func (p *Provider) ExpectGlooObjectNotExist(ctx context.Context, getter helpers. p.Gomega.Expect(errors.IsNotExist(err)).To(BeTrue(), fmt.Sprintf("obj %s.%s should not be found in cluster", meta.GetName(), meta.GetNamespace())) } +// TODO clean up these functions, as the validation webhook has been removed // ExpectObjectAdmitted should be used when applying Policy objects that are subject to the Gloo Gateway Validation Webhook // If the testInstallation has validation enabled and the manifest contains a known substring (e.g. `webhook-reject`) // we expect the application to fail, with an expected error substring supplied as `expectedOutput` func (p *Provider) ExpectObjectAdmitted(manifest string, err error, actualOutput, expectedOutput string) { - if p.glooGatewayContext.ValidationAlwaysAccept { - p.Assert.NoError(err, "can apply "+manifest) - return - } - - if strings.Contains(manifest, WebhookReject) { - // when validation is enforced (i.e. does NOT always accept), an apply should result in an error - // and the output from the command should contain a validation failure message - p.Assert.Error(err, "got error when applying "+manifest) - p.Assert.Contains(actualOutput, expectedOutput, "apply failed with expected message for "+manifest) - } else { - p.Assert.NoError(err, "can apply "+manifest) - } + p.Assert.NoError(err, "can apply "+manifest) + return } +// TODO clean this up as the validation webhook has been removed func (p *Provider) ExpectObjectDeleted(manifest string, err error, actualOutput string) { - if p.glooGatewayContext.ValidationAlwaysAccept { - p.Assert.NoError(err, "can delete "+manifest) - return - } - - if strings.Contains(manifest, WebhookReject) { - // when validation is enforced (i.e. does NOT always accept), a delete should result in an error and "not found" in the output - p.Assert.Error(err, "delete failed for "+manifest) - p.Assert.Contains(actualOutput, "NotFound") - } else { - p.Assert.NoError(err, "can delete "+manifest) - } + p.Assert.NoError(err, "can delete "+manifest) + return } diff --git a/test/kubernetes/testutils/gloogateway/clients.go b/test/kubernetes/testutils/gloogateway/clients.go deleted file mode 100644 index 0cff2b94fae..00000000000 --- a/test/kubernetes/testutils/gloogateway/clients.go +++ /dev/null @@ -1,148 +0,0 @@ -//go:build ignore - -package gloogateway - -import ( - "context" - - v1alpha1 "github.com/kgateway-dev/kgateway/projects/gloo/pkg/api/external/solo/ratelimit" - v1 "github.com/kgateway-dev/kgateway/projects/gloo/pkg/api/v1" - - gatewayv1 "github.com/kgateway-dev/kgateway/projects/gateway/pkg/api/v1" - "github.com/kgateway-dev/kgateway/test/kubernetes/testutils/cluster" - - "github.com/solo-io/solo-kit/pkg/api/external/kubernetes/service" - "github.com/solo-io/solo-kit/pkg/api/v1/clients/factory" - "github.com/solo-io/solo-kit/pkg/api/v1/clients/kube" - "github.com/solo-io/solo-kit/pkg/api/v1/clients/kube/cache" - skkube "github.com/solo-io/solo-kit/pkg/api/v1/resources/common/kubernetes" -) - -// ResourceClients is a set of clients for interacting with the Edge resources -type ResourceClients interface { - RouteOptionClient() gatewayv1.RouteOptionClient - VirtualHostOptionClient() gatewayv1.VirtualHostOptionClient - ServiceClient() skkube.ServiceClient - UpstreamClient() v1.UpstreamClient - VirtualServiceClient() gatewayv1.VirtualServiceClient - RateLimitConfigClient() v1alpha1.RateLimitConfigClient - GatewayClient() gatewayv1.GatewayClient -} - -type Clients struct { - routeOptionClient gatewayv1.RouteOptionClient - serviceClient skkube.ServiceClient - upstreamClient v1.UpstreamClient - virtualHostOptionClient gatewayv1.VirtualHostOptionClient - virtualServiceClient gatewayv1.VirtualServiceClient - rateLimitConfigClient v1alpha1.RateLimitConfigClient - gatewayClient gatewayv1.GatewayClient -} - -func NewResourceClients(ctx context.Context, clusterCtx *cluster.Context) (ResourceClients, error) { - sharedClientCache := kube.NewKubeCache(ctx) - - routeOptionClientFactory := &factory.KubeResourceClientFactory{ - Crd: gatewayv1.RouteOptionCrd, - Cfg: clusterCtx.RestConfig, - SharedCache: sharedClientCache, - } - routeOptionClient, err := gatewayv1.NewRouteOptionClient(ctx, routeOptionClientFactory) - if err != nil { - return nil, err - } - - upstreamClientFactory := &factory.KubeResourceClientFactory{ - Crd: v1.UpstreamCrd, - Cfg: clusterCtx.RestConfig, - SharedCache: sharedClientCache, - } - upstreamClient, err := v1.NewUpstreamClient(ctx, upstreamClientFactory) - if err != nil { - return nil, err - } - - virtualServiceClientFactory := &factory.KubeResourceClientFactory{ - Crd: gatewayv1.VirtualServiceCrd, - Cfg: clusterCtx.RestConfig, - SharedCache: sharedClientCache, - } - virtualServiceClient, err := gatewayv1.NewVirtualServiceClient(ctx, virtualServiceClientFactory) - if err != nil { - return nil, err - } - - kubeCoreCache, err := cache.NewKubeCoreCache(ctx, clusterCtx.Clientset) - if err != nil { - return nil, err - } - serviceClient := service.NewServiceClient(clusterCtx.Clientset, kubeCoreCache) - - virtualHostOptionClientFactory := &factory.KubeResourceClientFactory{ - Crd: gatewayv1.VirtualHostOptionCrd, - Cfg: clusterCtx.RestConfig, - SharedCache: sharedClientCache, - } - virtualHostOptionClient, err := gatewayv1.NewVirtualHostOptionClient(ctx, virtualHostOptionClientFactory) - if err != nil { - return nil, err - } - - rlcClientFactory := &factory.KubeResourceClientFactory{ - Crd: v1alpha1.RateLimitConfigCrd, - Cfg: clusterCtx.RestConfig, - SharedCache: sharedClientCache, - } - rlcClient, err := v1alpha1.NewRateLimitConfigClient(ctx, rlcClientFactory) - if err != nil { - return nil, err - } - - gwClientFactory := &factory.KubeResourceClientFactory{ - Crd: gatewayv1.GatewayCrd, - Cfg: clusterCtx.RestConfig, - SharedCache: sharedClientCache, - } - gwClient, err := gatewayv1.NewGatewayClient(ctx, gwClientFactory) - if err != nil { - return nil, err - } - - return &Clients{ - routeOptionClient: routeOptionClient, - serviceClient: serviceClient, - upstreamClient: upstreamClient, - virtualHostOptionClient: virtualHostOptionClient, - virtualServiceClient: virtualServiceClient, - rateLimitConfigClient: rlcClient, - gatewayClient: gwClient, - }, nil -} - -func (c *Clients) RouteOptionClient() gatewayv1.RouteOptionClient { - return c.routeOptionClient -} - -func (c *Clients) VirtualHostOptionClient() gatewayv1.VirtualHostOptionClient { - return c.virtualHostOptionClient -} - -func (c *Clients) ServiceClient() skkube.ServiceClient { - return c.serviceClient -} - -func (c *Clients) UpstreamClient() v1.UpstreamClient { - return c.upstreamClient -} - -func (c *Clients) VirtualServiceClient() gatewayv1.VirtualServiceClient { - return c.virtualServiceClient -} - -func (c *Clients) RateLimitConfigClient() v1alpha1.RateLimitConfigClient { - return c.rateLimitConfigClient -} - -func (c *Clients) GatewayClient() gatewayv1.GatewayClient { - return c.gatewayClient -} diff --git a/test/kubernetes/testutils/gloogateway/context.go b/test/kubernetes/testutils/gloogateway/context.go index 251c8139f87..6f77433eaf6 100644 --- a/test/kubernetes/testutils/gloogateway/context.go +++ b/test/kubernetes/testutils/gloogateway/context.go @@ -20,16 +20,6 @@ type Context struct { // ValuesManifestFile points to the file that contains the set of Helm values that are unique to this test ValuesManifestFile string - // whether or not the K8s Gateway controller is enabled - K8sGatewayEnabled bool - - // whether or not the installation is an enterprise installation - IsEnterprise bool - - // whether or not the validation webhook is configured to always accept resources, - // i.e. if this is set to true, the webhook will accept regardless of errors found during validation - ValidationAlwaysAccept bool - // is populated if the installation has any AWS options configured (via `settings.aws.*` Helm values) AwsOptions *AwsOptions From 13c25c5dc72290435e00abe33384059a0bd6dc6f Mon Sep 17 00:00:00 2001 From: Jenny Shu Date: Fri, 31 Jan 2025 10:45:20 -0500 Subject: [PATCH 3/4] add back readme section --- test/kubernetes/e2e/README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/test/kubernetes/e2e/README.md b/test/kubernetes/e2e/README.md index c29a0adc90a..a7d6e59002f 100644 --- a/test/kubernetes/e2e/README.md +++ b/test/kubernetes/e2e/README.md @@ -53,6 +53,16 @@ Some tests may require environment variables to be set. Some required env vars a - Istio features: Require `ISTIO_VERSION` to be set. The tests running in CI use `ISTIO_VERSION="${ISTIO_VERSION:-1.19.9}"` to default to a specific version of Istio. +## Resource example generation tool + +This tool generates the input resources defined in code as an output yaml file. You can find an example under `test/kubernetes/e2e/features/headless_svc/generate/generate_examples.go`. + +These examples are run as part of the codegen, but can also be manually run using the following command: + +```bash +go generate +``` + ## Debugging Refer to the [Debugging guide](./debugging.md) for more information on how to debug tests. From 9183133b54ff2ebc5bc2047af6c00f4efdd67d98 Mon Sep 17 00:00:00 2001 From: Jenny Shu Date: Fri, 31 Jan 2025 10:45:30 -0500 Subject: [PATCH 4/4] delete unused file --- test/testutils/services.go | 23 ----------------------- 1 file changed, 23 deletions(-) delete mode 100644 test/testutils/services.go diff --git a/test/testutils/services.go b/test/testutils/services.go deleted file mode 100644 index e5256773330..00000000000 --- a/test/testutils/services.go +++ /dev/null @@ -1,23 +0,0 @@ -//go:build ignore - -package testutils - -import ( - "fmt" -) - -const ( - // ConsulBinaryVersion defines the version of the Consul binary - ConsulBinaryVersion = "1.13.3" - // ConsulBinaryName defines the name of the Consul binary - ConsulBinaryName = "consul" - // VaultBinaryVersion defines the version of the Vault binary - VaultBinaryVersion = "1.13.3" - // VaultBinaryName defines the name of the Vault binary - VaultBinaryName = "vault" -) - -var ( - ConsulDockerImage = fmt.Sprintf("hashicorp/%s:%s", ConsulBinaryName, ConsulBinaryVersion) - VaultDockerImage = fmt.Sprintf("hashicorp/%s:%s", VaultBinaryName, VaultBinaryVersion) -)