Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add kustomize e2e test #1735

Merged
merged 1 commit into from
Sep 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
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