From e16a8f78c1412aa8b78b110b478e86384f99e17c Mon Sep 17 00:00:00 2001 From: Krzysztof Kwiatosz Date: Wed, 4 Dec 2024 11:48:05 +0100 Subject: [PATCH] Get rid of flaky gardener test (#1280) --- .github/workflows/_integration-tests.yaml | 28 ---------------- docs/contributor/04-10-testing-strategy.md | 1 - hack/Makefile | 4 --- hack/gardener.mk | 30 ----------------- hack/provision_gardener.sh | 23 ------------- hack/shoot_template.yaml | 39 ---------------------- 6 files changed, 125 deletions(-) delete mode 100644 hack/gardener.mk delete mode 100755 hack/provision_gardener.sh delete mode 100644 hack/shoot_template.yaml diff --git a/.github/workflows/_integration-tests.yaml b/.github/workflows/_integration-tests.yaml index 8e8d82573..0dbe72244 100644 --- a/.github/workflows/_integration-tests.yaml +++ b/.github/workflows/_integration-tests.yaml @@ -33,34 +33,6 @@ jobs: - if: ${{ always() }} uses: ./.github/actions/collect-cluster-info - gardener-integration-test: - if: ${{ !startsWith(github.event_name, 'pull_request') }} - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: ./.github/actions/setup-go - - name: provision gardener - run: | - echo "$GARDENER_SA" > $GARDENER_SA_PATH - echo "Used kubeconfig file has $(sed -n '$=' $GARDENER_SA_PATH) lines" - make -C hack provision-gardener - env: - GARDENER_SECRET_NAME: ${{ secrets.GARDENER_SECRET_NAME }} - GARDENER_PROJECT: ${{ secrets.GARDENER_PROJECT }} - GARDENER_SA_PATH: /tmp/gardener-sa.yaml - GARDENER_SA: ${{ secrets.GARDENER_SA }} - - name: run test - run: | - make -C components/operator deploy - make -C tests/operator test - env: - IMG: ${{ inputs.image }} - - name: deprovision gardener - if: ${{ always() }} - run: make -C hack deprovision-gardener - env: - GARDENER_SA_PATH: /tmp/gardener-sa.yaml - serverless-integration-test: if: ${{ !startsWith(github.event_name, 'pull_request') || github.event.pull_request.draft == false }} runs-on: ubuntu-latest diff --git a/docs/contributor/04-10-testing-strategy.md b/docs/contributor/04-10-testing-strategy.md index eee715aa2..19eaa1aef 100644 --- a/docs/contributor/04-10-testing-strategy.md +++ b/docs/contributor/04-10-testing-strategy.md @@ -18,6 +18,5 @@ Each pull request to the repository triggers the following CI/CD jobs that verif - `push / integrations / serverless-integration-test` - Runs the create/update/delete Serverless integration tests in k3d cluster. For the configuration, see the [_integration-tests.yaml](https://github.com/kyma-project/serverless/blob/main/.github/workflows/_integration-tests.yaml) file. - `integration tests (push) / serverless-integration-test` - Runs the basic functionality integration and the `tracing`, `api-gateway`, `cloud-event` and `hana-client` contract compatibility integration test suite for Serverless in a k3d cluster. For the configuration, see the [_integration-tests.yaml](https://github.com/kyma-project/serverless/blob/main/.github/workflows/_integration-tests.yaml) file. - `push / integrations / git-auth-integration-test` - Runs the `GitHub` and `Azure DevOps` API and authentication integration test suite for Serverless. For the configuration, see the [_integration-tests.yaml](https://github.com/kyma-project/serverless/blob/main/.github/workflows/_integration-tests.yaml) file. -- `push / integrations / gardener-integration-test` - Checks the installation of the Serverless module in the Gardener shoot cluster and runs basic integration tests of Serverless. For the configuration, see the [_integration-tests.yaml](https://github.com/kyma-project/serverless/blob/main/.github/workflows/_integration-tests.yaml) file. - `push / upgrades / operator-upgrade-test` - Runs the upgrade integration test suite and verifies if the latest release can be successfully upgraded to the new (`main`) revision. For the configuration, see the [_upgrade-tests.yaml](https://github.com/kyma-project/serverless/blob/main/.github/workflows/_upgrade-tests.yaml) file. - `push / upgrades / serverless-upgrade-test` - Runs the basic functionality integration and the `tracing`, `api-gateway`, and `cloud-event` contract compatibility integration test suite for Serverless in a k3d cluster after upgrading from the latest release to the actual revision to check if the Serverless component is working properly after the upgrade. For the configuration, see the [_upgrade-tests.yaml](https://github.com/kyma-project/serverless/blob/main/.github/workflows/_upgrade-tests.yaml) file. diff --git a/hack/Makefile b/hack/Makefile index 078eba604..73b82a3cd 100644 --- a/hack/Makefile +++ b/hack/Makefile @@ -1,7 +1,3 @@ -# This Makefile is used to add context to the `gardener.mk` file by adding the PROJECT_ROOT variable -# this is needed to use targets in the gardener.mk file from a prompt (e.g. `make -C hack provision-gardener`) - PROJECT_ROOT=.. include ${PROJECT_ROOT}/hack/help.mk -include ${PROJECT_ROOT}/hack/gardener.mk diff --git a/hack/gardener.mk b/hack/gardener.mk deleted file mode 100644 index 4d0c1f5ce..000000000 --- a/hack/gardener.mk +++ /dev/null @@ -1,30 +0,0 @@ -ifndef PROJECT_ROOT -$(error PROJECT_ROOT is undefined) -endif -include ${PROJECT_ROOT}/hack/tools.mk - -##@ Gardener - -GARDENER_INFRASTRUCTURE = az -HIBERNATION_HOUR=$(shell echo $$(( ( $(shell date +%H | sed s/^0//g) + 5 ) % 24 ))) -GIT_COMMIT_SHA=$(shell git rev-parse --short=8 HEAD) -SHOOT=test-${GIT_COMMIT_SHA} -ifneq (,$(GARDENER_SA_PATH)) -GARDENER_K8S_VERSION=$(shell kubectl --kubeconfig=${GARDENER_SA_PATH} get cloudprofiles.core.gardener.cloud ${GARDENER_INFRASTRUCTURE} -o=jsonpath='{.spec.kubernetes.versions[0].version}') -else -GARDENER_K8S_VERSION=1.31.2 -endif - -.PHONY: provision-gardener -provision-gardener: ## Provision gardener cluster with latest k8s version - PROJECT_ROOT=${PROJECT_ROOT} \ - GARDENER_SA_PATH=${GARDENER_SA_PATH} \ - SHOOT=${SHOOT} PROJECT=${GARDENER_PROJECT} \ - GARDENER_K8S_VERSION=${GARDENER_K8S_VERSION} \ - SECRET=${GARDENER_SECRET_NAME} \ - ${PROJECT_ROOT}/hack/provision_gardener.sh - -.PHONY: deprovision-gardener -deprovision-gardener: kyma ## Deprovision gardener cluster - kubectl --kubeconfig=${GARDENER_SA_PATH} annotate shoot test-${GIT_COMMIT_SHA} confirmation.gardener.cloud/deletion=true - kubectl --kubeconfig=${GARDENER_SA_PATH} delete shoot test-${GIT_COMMIT_SHA} --wait=false diff --git a/hack/provision_gardener.sh b/hack/provision_gardener.sh deleted file mode 100755 index ec770bf53..000000000 --- a/hack/provision_gardener.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash - -set -eo pipefail - -# render and applyshoot template -shoot_template=$(envsubst < ${PROJECT_ROOT}/hack/shoot_template.yaml) - -export KUBECONFIG="${GARDENER_SA_PATH}" -echo "$shoot_template" | kubectl --kubeconfig=$KUBECONFIG apply -f - - -echo "waiting fo cluster to be ready..." -kubectl --kubeconfig=$KUBECONFIG wait --for=condition=EveryNodeReady shoot/${SHOOT} --timeout=17m - -# create kubeconfig request, that creates a kubeconfig which is valid for one day -kubectl --kubeconfig=$KUBECONFIG create \ - -f <(printf '{"spec":{"expirationSeconds":86400}}') \ - --raw /apis/core.gardener.cloud/v1beta1/namespaces/garden-${PROJECT}/shoots/${SHOOT}/adminkubeconfig | \ - jq -r ".status.kubeconfig" | \ - base64 -d > ${SHOOT}_kubeconfig.yaml - -# replace the default kubeconfig -mkdir -p ~/.kube -mv ${SHOOT}_kubeconfig.yaml ~/.kube/config diff --git a/hack/shoot_template.yaml b/hack/shoot_template.yaml deleted file mode 100644 index 596aed3b3..000000000 --- a/hack/shoot_template.yaml +++ /dev/null @@ -1,39 +0,0 @@ -apiVersion: core.gardener.cloud/v1beta1 -kind: Shoot -metadata: - name: ${SHOOT} -spec: - secretBindingName: ${SECRET} - cloudProfileName: az - region: westeurope - purpose: evaluation - provider: - type: azure - infrastructureConfig: - apiVersion: azure.provider.extensions.gardener.cloud/v1alpha1 - kind: InfrastructureConfig - networks: - vnet: - cidr: 10.250.0.0/16 - workers: 10.250.0.0/19 - workers: - - name: cpu-worker - minimum: 1 - maximum: 2 - machine: - type: Standard_A4_v2 - volume: - type: Standard_LRS - size: 50Gi - networking: - type: calico - pods: 100.96.0.0/11 - nodes: 10.250.0.0/16 - services: 100.64.0.0/13 - kubernetes: - version: "${GARDENER_K8S_VERSION}" - hibernation: - enabled: false - addons: - nginxIngress: - enabled: false