Skip to content

Commit

Permalink
Add kustomize e2e test
Browse files Browse the repository at this point in the history
Signed-off-by: Connor Catlett <[email protected]>
  • Loading branch information
ConnorJC3 committed Sep 8, 2023
1 parent ff266e6 commit 66a1013
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 23 deletions.
12 changes: 12 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,18 @@ 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 \
HELM_EXTRA_FLAGS='--set=controller.k8sTagClusterId=$$CLUSTER_NAME' \
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 \
Expand Down
58 changes: 35 additions & 23 deletions hack/e2e/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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:-}

Expand Down Expand Up @@ -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))
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 66a1013

Please sign in to comment.