37
37
# - kind (https://github.com/kubernetes-sigs/kind) installed
38
38
# - optional: Go already installed
39
39
40
+ set -x
41
+
40
42
RELEASE_TOOLS_ROOT=" $( realpath " $( dirname " ${BASH_SOURCE[0]} " ) " ) "
41
43
REPO_DIR=" $( pwd) "
42
44
@@ -323,7 +325,7 @@ configvar CSI_PROW_E2E_MOCK "$(if [ "${CSI_PROW_DRIVER_CANARY}" = "canary" ] &&
323
325
324
326
# Regex for non-alpha, feature-tagged tests that should be run.
325
327
#
326
- configvar CSI_PROW_E2E_FOCUS_LATEST ' \[Feature:VolumeSnapshotDataSource\]' " non-alpha, feature-tagged tests for latest Kubernetes version"
328
+ configvar CSI_PROW_E2E_FOCUS_LATEST ' \[Feature:VolumeSnapshotDataSource\]|\[Feature:volumegroupsnapshot\] ' " non-alpha, feature-tagged tests for latest Kubernetes version"
327
329
configvar CSI_PROW_E2E_FOCUS " $( get_versioned_variable CSI_PROW_E2E_FOCUS " ${csi_prow_kubernetes_version_suffix} " ) " " non-alpha, feature-tagged tests"
328
330
329
331
# Serial vs. parallel is always determined by these regular expressions.
@@ -360,6 +362,10 @@ configvar CSI_PROW_E2E_ALPHA "$(get_versioned_variable CSI_PROW_E2E_ALPHA "${csi
360
362
# kubernetes-csi components must be updated, either by disabling
361
363
# the failing test for "latest" or by updating the test and not running
362
364
# it anymore for older releases.
365
+
366
+ # Hack enable the vgs feature gate
367
+ export CSI_PROW_E2E_GATES_1_33=" CSIVolumeGroupSnapshot=true"
368
+
363
369
configvar CSI_PROW_E2E_ALPHA_GATES_LATEST ' ' " alpha feature gates for latest Kubernetes"
364
370
configvar CSI_PROW_E2E_ALPHA_GATES " $( get_versioned_variable CSI_PROW_E2E_ALPHA_GATES " ${csi_prow_kubernetes_version_suffix} " ) " " alpha E2E feature gates"
365
371
@@ -379,8 +385,12 @@ default_csi_snapshotter_version () {
379
385
echo " v4.0.0"
380
386
fi
381
387
}
388
+ export CSI_SNAPSHOTTER_HACK_VERSION=" master"
382
389
configvar CSI_SNAPSHOTTER_VERSION " $( default_csi_snapshotter_version) " " external-snapshotter version tag"
383
390
391
+ # Enable installing VolumeGroupSnapshot CRDs (off by default, can be set to true in prow jobs)
392
+ configvar CSI_PROW_ENABLE_GROUP_SNAPSHOT " true" " Enable the VolumeGroupSnapshot tests"
393
+
384
394
# Some tests are known to be unusable in a KinD cluster. For example,
385
395
# stopping kubelet with "ssh <node IP> systemctl stop kubelet" simply
386
396
# doesn't work. Such tests should be written in a way that they verify
@@ -772,7 +782,7 @@ install_csi_driver () {
772
782
# Installs all necessary snapshotter CRDs
773
783
install_snapshot_crds () {
774
784
# Wait until volumesnapshot CRDs are in place.
775
- CRD_BASE_DIR=" https://raw.githubusercontent.com/kubernetes-csi/external-snapshotter/${CSI_SNAPSHOTTER_VERSION } /client/config/crd"
785
+ CRD_BASE_DIR=" https://raw.githubusercontent.com/kubernetes-csi/external-snapshotter/${CSI_SNAPSHOTTER_HACK_VERSION } /client/config/crd"
776
786
if [[ ${REPO_DIR} == * " external-snapshotter" * ]]; then
777
787
CRD_BASE_DIR=" ${REPO_DIR} /client/config/crd"
778
788
fi
@@ -792,11 +802,32 @@ install_snapshot_crds() {
792
802
cnt=$(( cnt + 1 ))
793
803
sleep 2
794
804
done
805
+
806
+ if ${CSI_PROW_ENABLE_GROUP_SNAPSHOT} ; then
807
+ echo " Installing VolumeGroupSnapshot CRDs from ${CRD_BASE_DIR} "
808
+ kubectl apply -f " ${CRD_BASE_DIR} /groupsnapshot.storage.k8s.io_volumegroupsnapshotclasses.yaml" --validate=false
809
+ kubectl apply -f " ${CRD_BASE_DIR} /groupsnapshot.storage.k8s.io_volumegroupsnapshotcontents.yaml" --validate=false
810
+ kubectl apply -f " ${CRD_BASE_DIR} /groupsnapshot.storage.k8s.io_volumegroupsnapshots.yaml" --validate=false
811
+
812
+ local cnt=0
813
+ until kubectl get volumegroupsnapshotclasses.groupsnapshot.storage.k8s.io \
814
+ && kubectl get volumegroupsnapshots.groupsnapshot.storage.k8s.io \
815
+ && kubectl get volumegroupsnapshotcontents.groupsnapshot.storage.k8s.io; do
816
+ if [ $cnt -gt 30 ]; then
817
+ echo >&2 " ERROR: VolumeGroupSnapshot CRDs not ready after 60s"
818
+ exit 1
819
+ fi
820
+ echo " $( date +%H:%M:%S) " " waiting for VolumeGroupSnapshot CRDs, attempt #$cnt "
821
+ cnt=$(( cnt + 1 ))
822
+ sleep 2
823
+ done
824
+ echo " VolumeGroupSnapshot CRDs installed and ready"
825
+ fi
795
826
}
796
827
797
828
# Install snapshot controller and associated RBAC, retrying until the pod is running.
798
829
install_snapshot_controller () {
799
- CONTROLLER_DIR=" https://raw.githubusercontent.com/kubernetes-csi/external-snapshotter/${CSI_SNAPSHOTTER_VERSION } "
830
+ CONTROLLER_DIR=" https://raw.githubusercontent.com/kubernetes-csi/external-snapshotter/${CSI_SNAPSHOTTER_HACK_VERSION } "
800
831
if [[ ${REPO_DIR} == * " external-snapshotter" * ]]; then
801
832
CONTROLLER_DIR=" ${REPO_DIR} "
802
833
fi
@@ -859,6 +890,14 @@ install_snapshot_controller() {
859
890
line=" $( echo " $nocomments " | sed -e " s;$image ;${name} :${NEW_TAG} ;" ) "
860
891
echo " using $line " >&2
861
892
fi
893
+ if ${CSI_PROW_ENABLE_GROUP_SNAPSHOT} ; then
894
+ # inject feature gate after leader election arg
895
+ if echo " $nocomments " | grep -q ' ^[[:space:]]*- "--leader-election=true"' ; then
896
+ echo " $line "
897
+ echo " - \" --feature-gates=CSIVolumeGroupSnapshot=true\" "
898
+ continue
899
+ fi
900
+ fi
862
901
echo " $line "
863
902
done)"
864
903
if ! echo " $modified " | kubectl apply -f -; then
@@ -880,8 +919,15 @@ install_snapshot_controller() {
880
919
exit 1
881
920
fi
882
921
else
883
- echo " kubectl apply -f $SNAPSHOT_CONTROLLER_YAML "
884
- kubectl apply -f " $SNAPSHOT_CONTROLLER_YAML "
922
+ if ${CSI_PROW_ENABLE_GROUP_SNAPSHOT} ; then
923
+ echo " Deploying snapshot-controller with CSIVolumeGroupSnapshot feature gate enabled"
924
+ curl -s " $SNAPSHOT_CONTROLLER_YAML " | \
925
+ awk '/--leader-election=true/ {print; print " - \" --feature-gates=CSIVolumeGroupSnapshot=true\" " ; next}1' | \
926
+ kubectl apply -f - || die " failed to deploy snapshot-controller with feature gate"
927
+ else
928
+ echo " kubectl apply -f $SNAPSHOT_CONTROLLER_YAML "
929
+ kubectl apply -f " $SNAPSHOT_CONTROLLER_YAML "
930
+ fi
885
931
fi
886
932
887
933
cnt=0
@@ -1028,6 +1074,7 @@ run_e2e () (
1028
1074
# Rename, merge and filter JUnit files. Necessary in case that we run the E2E suite again
1029
1075
# and to avoid the large number of "skipped" tests that we get from using
1030
1076
# the full Kubernetes E2E testsuite while only running a few tests.
1077
+ # shellcheck disable=SC2329
1031
1078
move_junit () {
1032
1079
if ls " ${ARTIFACTS} " /junit_[0-9]* .xml 2> /dev/null > /dev/null; then
1033
1080
mkdir -p " ${ARTIFACTS} /junit/${name} " &&
@@ -1038,6 +1085,11 @@ run_e2e () (
1038
1085
}
1039
1086
trap move_junit EXIT
1040
1087
1088
+ if ${CSI_PROW_ENABLE_GROUP_SNAPSHOT} ; then
1089
+ yq -i ' .DriverInfo.Capabilities.groupSnapshot = true' " ${CSI_PROW_WORK} " /test-driver.yaml
1090
+ cat " ${CSI_PROW_WORK} " /test-driver.yaml
1091
+ fi
1092
+
1041
1093
if [ " ${name} " == " local" ]; then
1042
1094
cd " ${GOPATH} /src/${CSI_PROW_SIDECAR_E2E_PATH} " &&
1043
1095
run_with_loggers env KUBECONFIG=" $KUBECONFIG " KUBE_TEST_REPO_LIST=" $( if [ -e " ${CSI_PROW_WORK} /e2e-repo-list" ]; then echo " ${CSI_PROW_WORK} /e2e-repo-list" ; fi) " ginkgo --timeout=" ${CSI_PROW_GINKGO_TIMEOUT} " -v " $@ " " ${CSI_PROW_WORK} /e2e-local.test" -- -report-dir " ${ARTIFACTS} " -report-prefix local
@@ -1323,6 +1375,17 @@ main () {
1323
1375
if ${CSI_PROW_DRIVER_INSTALL} " $images " ; then
1324
1376
collect_cluster_info
1325
1377
1378
+ # Temporarily hack will handle it in e2e golang codes later
1379
+ if ${CSI_PROW_ENABLE_GROUP_SNAPSHOT} ; then
1380
+ kubectl patch sts csi-hostpathplugin -n default --type=' json' -p=' [{
1381
+ "op": "add",
1382
+ "path": "/spec/template/spec/containers/5/args/-",
1383
+ "value": "--feature-gates=CSIVolumeGroupSnapshot=true"
1384
+ }]'
1385
+ kubectl rollout status sts/csi-hostpathplugin -n default
1386
+ fi
1387
+
1388
+
1326
1389
if sanity_enabled; then
1327
1390
if ! run_sanity; then
1328
1391
ret=1
0 commit comments