Skip to content

Commit

Permalink
Install snapshot controller independently of helm for e2e tests
Browse files Browse the repository at this point in the history
  • Loading branch information
wongma7 committed Jul 7, 2021
1 parent e0938d0 commit 99514d5
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 6 deletions.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ test-e2e-external-eks:
K8S_VERSION="1.20" \
HELM_VALUES_FILE="./hack/values_eksctl.yaml" \
HELM_EXTRA_FLAGS='--set=controller.k8sTagClusterId=$$CLUSTER_NAME' \
EBS_INSTALL_SNAPSHOT="true" \
EKSCTL_ADMIN_ROLE="Infra-prod-KopsDeleteAllLambdaServiceRoleF1578477-1ELDFIB4KCMXV" \
AWS_REGION=us-west-2 \
AWS_AVAILABILITY_ZONES=us-west-2a,us-west-2b \
Expand Down
22 changes: 17 additions & 5 deletions hack/e2e/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ IMAGE_TAG=${IMAGE_TAG:-${TEST_ID}}

# kops: must include patch version (e.g. 1.19.1)
# eksctl: mustn't include patch version (e.g. 1.19)
K8S_VERSION=${K8S_VERSION:-1.20.6}
K8S_VERSION=${K8S_VERSION:-1.20.8}

KOPS_VERSION=${KOPS_VERSION:-1.20.0}
KOPS_VERSION=${KOPS_VERSION:-1.21.0}
KOPS_STATE_FILE=${KOPS_STATE_FILE:-s3://k8s-kops-csi-e2e}
KOPS_PATCH_FILE=${KOPS_PATCH_FILE:-./hack/kops-patch.yaml}
KOPS_PATCH_NODE_FILE=${KOPS_PATCH_NODE_FILE:-./hack/kops-patch-node.yaml}
Expand All @@ -71,7 +71,7 @@ GINKGO_SKIP=${GINKGO_SKIP:-"\[Disruptive\]"}
GINKGO_NODES=${GINKGO_NODES:-4}
TEST_EXTRA_FLAGS=${TEST_EXTRA_FLAGS:-}

EBS_SNAPSHOT_CRD=${EBS_SNAPSHOT_CRD:-"./deploy/kubernetes/cluster/crd_snapshotter.yaml"}
EBS_INSTALL_SNAPSHOT=${EBS_INSTALL_SNAPSHOT:-"false"}
EBS_CHECK_MIGRATION=${EBS_CHECK_MIGRATION:-"false"}

CLEAN=${CLEAN:-"true"}
Expand Down Expand Up @@ -144,6 +144,15 @@ elif [[ "${CLUSTER_TYPE}" == "eksctl" ]]; then
fi
fi

if [[ "${EBS_INSTALL_SNAPSHOT}" == true ]]; then
loudecho "Installing snapshot controller and CRDs"
kubectl apply --kubeconfig "${KUBECONFIG}" -f https://raw.githubusercontent.com/kubernetes-csi/external-snapshotter/v4.1.1/deploy/kubernetes/snapshot-controller/rbac-snapshot-controller.yaml
kubectl apply --kubeconfig "${KUBECONFIG}" -f https://raw.githubusercontent.com/kubernetes-csi/external-snapshotter/v4.1.1/deploy/kubernetes/snapshot-controller/setup-snapshot-controller.yaml
kubectl apply --kubeconfig "${KUBECONFIG}" -f https://raw.githubusercontent.com/kubernetes-csi/external-snapshotter/v4.1.1/client/config/crd/snapshot.storage.k8s.io_volumesnapshotclasses.yaml
kubectl apply --kubeconfig "${KUBECONFIG}" -f https://raw.githubusercontent.com/kubernetes-csi/external-snapshotter/v4.1.1/client/config/crd/snapshot.storage.k8s.io_volumesnapshotcontents.yaml
kubectl apply --kubeconfig "${KUBECONFIG}" -f https://raw.githubusercontent.com/kubernetes-csi/external-snapshotter/v4.1.1/client/config/crd/snapshot.storage.k8s.io_volumesnapshots.yaml
fi

loudecho "Deploying driver"
startSec=$(date +'%s')

Expand All @@ -154,12 +163,15 @@ HELM_ARGS=(upgrade --install "${DRIVER_NAME}"
--wait
--kubeconfig "${KUBECONFIG}"
./charts/"${DRIVER_NAME}")
if test -f "$HELM_VALUES_FILE"; then
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[@]}" "${EXPANDED_HELM_EXTRA_FLAGS}"
"${HELM_BIN}" "${HELM_ARGS[@]}"
set +x

endSec=$(date +'%s')
Expand Down
2 changes: 2 additions & 0 deletions hack/kops-patch.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
spec:
snapshotController:
enabled: true
additionalPolicies:
node: |
[
Expand Down
1 change: 0 additions & 1 deletion hack/values.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
enableVolumeSnapshot: true
controller:
logLevel: 5
node:
Expand Down

0 comments on commit 99514d5

Please sign in to comment.