From 3658e909f7ca8b45576998e4e7408a564bf9a76e Mon Sep 17 00:00:00 2001 From: Connor Catlett Date: Fri, 8 Sep 2023 13:43:48 +0000 Subject: [PATCH] Add kustomize e2e test Signed-off-by: Connor Catlett --- Makefile | 11 ++++++++++ hack/e2e/run.sh | 58 +++++++++++++++++++++++++++++-------------------- 2 files changed, 46 insertions(+), 23 deletions(-) diff --git a/Makefile b/Makefile index 8f7697084b..77d9423823 100644 --- a/Makefile +++ b/Makefile @@ -216,6 +216,17 @@ test-e2e-external-eks-windows: NODE_OS_DISTRO="windows" \ ./hack/e2e/run.sh +.PHONY: test-e2e-external-kustomize +test-e2e-external-kustomize: + AWS_REGION=us-west-2 \ + AWS_AVAILABILITY_ZONES=us-west-2a,us-west-2b,us-west-2c \ + EBS_INSTALL_SNAPSHOT="true" \ + TEST_PATH=./tests/e2e-kubernetes/... \ + GINKGO_FOCUS="External.Storage" \ + GINKGO_SKIP="\[Disruptive\]|\[Serial\]" \ + DEPLOY_METHOD="kustomize" \ + ./hack/e2e/run.sh + .PHONY: test-helm-chart test-helm-chart: AWS_REGION=us-west-2 \ diff --git a/hack/e2e/run.sh b/hack/e2e/run.sh index 387837e695..565dd60d8d 100755 --- a/hack/e2e/run.sh +++ b/hack/e2e/run.sh @@ -65,6 +65,9 @@ EKSCTL_ADMIN_ROLE=${EKSCTL_ADMIN_ROLE:-} # Creates a windows node group. WINDOWS=${WINDOWS:-"false"} +# Valid deploy methods: "helm" (default), "kustomize" +DEPLOY_METHOD=${DEPLOY_METHOD:-"helm"} + HELM_VALUES_FILE=${HELM_VALUES_FILE:-./hack/values.yaml} HELM_EXTRA_FLAGS=${HELM_EXTRA_FLAGS:-} @@ -198,28 +201,33 @@ if [[ "${HELM_CT_TEST}" == true ]]; then set -e set +x else - loudecho "Deploying driver" + loudecho "Deploying driver via ${DEPLOY_METHOD}" startSec=$(date +'%s') - HELM_ARGS=(upgrade --install "${DRIVER_NAME}" - --namespace kube-system - --set image.repository="${IMAGE_NAME}" - --set image.tag="${IMAGE_TAG}" - --set node.enableWindows="${WINDOWS}" - --timeout 10m0s - --wait - --kubeconfig "${KUBECONFIG}" - ./charts/"${DRIVER_NAME}") - if [[ -f "$HELM_VALUES_FILE" ]]; then - HELM_ARGS+=(-f "${HELM_VALUES_FILE}") - fi - eval "EXPANDED_HELM_EXTRA_FLAGS=$HELM_EXTRA_FLAGS" - if [[ -n "$EXPANDED_HELM_EXTRA_FLAGS" ]]; then - HELM_ARGS+=("${EXPANDED_HELM_EXTRA_FLAGS}") + if [[ ${DEPLOY_METHOD} == "helm" ]]; then + HELM_ARGS=(upgrade --install "${DRIVER_NAME}" + --namespace kube-system + --set image.repository="${IMAGE_NAME}" + --set image.tag="${IMAGE_TAG}" + --set node.enableWindows="${WINDOWS}" + --timeout 10m0s + --wait + --kubeconfig "${KUBECONFIG}" + ./charts/"${DRIVER_NAME}") + if [[ -f "$HELM_VALUES_FILE" ]]; then + HELM_ARGS+=(-f "${HELM_VALUES_FILE}") + fi + eval "EXPANDED_HELM_EXTRA_FLAGS=$HELM_EXTRA_FLAGS" + if [[ -n "$EXPANDED_HELM_EXTRA_FLAGS" ]]; then + HELM_ARGS+=("${EXPANDED_HELM_EXTRA_FLAGS}") + fi + set -x + "${HELM_BIN}" "${HELM_ARGS[@]}" + set +x + elif [[ ${DEPLOY_METHOD} == "kustomize" ]]; then + kubectl --kubeconfig "${KUBECONFIG}" apply -k "./deploy/kubernetes/overlays/stable" + kubectl --kubeconfig "${KUBECONFIG}" --namespace kube-system wait --timeout 10m0s --for "condition=ready" pod -l "app.kubernetes.io/name=aws-ebs-csi-driver" fi - set -x - "${HELM_BIN}" "${HELM_ARGS[@]}" - set +x endSec=$(date +'%s') deployTimeSeconds=$(((endSec - startSec) / 1)) @@ -285,10 +293,14 @@ if [[ "${CLEAN}" == true ]]; then loudecho "Cleaning" if [[ "${HELM_CT_TEST}" != true ]]; then - loudecho "Removing driver" - ${HELM_BIN} del "${DRIVER_NAME}" \ - --namespace kube-system \ - --kubeconfig "${KUBECONFIG}" + loudecho "Removing driver via ${DEPLOY_METHOD}" + if [[ ${DEPLOY_METHOD} == "helm" ]]; then + ${HELM_BIN} del "${DRIVER_NAME}" \ + --namespace kube-system \ + --kubeconfig "${KUBECONFIG}" + elif [[ ${DEPLOY_METHOD} == "kustomize" ]]; then + kubectl --kubeconfig "${KUBECONFIG}" delete -k "./deploy/kubernetes/overlays/stable" + fi fi if [[ "${CLUSTER_TYPE}" == "kops" ]]; then