@@ -107,8 +107,7 @@ configvar CSI_PROW_GO_VERSION_GINKGO "${CSI_PROW_GO_VERSION_BUILD}" "Go version
107107# kind version to use. If the pre-installed version is different,
108108# the desired version is downloaded from https://github.com/kubernetes-sigs/kind/releases/download/
109109# (if available), otherwise it is built from source.
110- # TODO: https://github.com/kubernetes-csi/csi-release-tools/issues/39
111- configvar CSI_PROW_KIND_VERSION " 86bc23d84ac12dcb56a0528890736e2c347c2dc3" " kind"
110+ configvar CSI_PROW_KIND_VERSION " v0.6.0" " kind"
112111
113112# ginkgo test runner version to use. If the pre-installed version is
114113# different, the desired version is built from source.
@@ -133,7 +132,7 @@ configvar CSI_PROW_BUILD_JOB true "building code in repo enabled"
133132# use the same settings as for "latest" Kubernetes. This works
134133# as long as there are no breaking changes in Kubernetes, like
135134# deprecating or changing the implementation of an alpha feature.
136- configvar CSI_PROW_KUBERNETES_VERSION 1.15.3 " Kubernetes"
135+ configvar CSI_PROW_KUBERNETES_VERSION 1.17.0 " Kubernetes"
137136
138137# This is a hack to workaround the issue that each version
139138# of kind currently only supports specific patch versions of
@@ -143,7 +142,6 @@ configvar CSI_PROW_KUBERNETES_VERSION 1.15.3 "Kubernetes"
143142#
144143# If the version is prefixed with "release-", then nothing
145144# is overridden.
146- override_k8s_version " 1.14.6"
147145override_k8s_version " 1.15.3"
148146
149147# CSI_PROW_KUBERNETES_VERSION reduced to first two version numbers and
@@ -189,7 +187,7 @@ configvar CSI_PROW_WORK "$(mkdir -p "$GOPATH/pkg" && mktemp -d "$GOPATH/pkg/csip
189187#
190188# When no deploy script is found (nothing in `deploy` directory,
191189# CSI_PROW_HOSTPATH_REPO=none), nothing gets deployed.
192- configvar CSI_PROW_HOSTPATH_VERSION " v1.2.0 " " hostpath driver"
190+ configvar CSI_PROW_HOSTPATH_VERSION " v1.3.0-rc2 " " hostpath driver"
193191configvar CSI_PROW_HOSTPATH_REPO https://github.com/kubernetes-csi/csi-driver-host-path " hostpath repo"
194192configvar CSI_PROW_DEPLOYMENT " " " deployment"
195193configvar CSI_PROW_HOSTPATH_DRIVER_NAME " hostpath.csi.k8s.io" " the hostpath driver name"
@@ -207,9 +205,9 @@ configvar CSI_PROW_HOSTPATH_CANARY "" "hostpath image"
207205#
208206# CSI_PROW_E2E_REPO=none disables E2E testing.
209207# TOOO: remove versioned variables and make e2e version match k8s version
210- configvar CSI_PROW_E2E_VERSION_1_14 v1.14.0 " E2E version for Kubernetes 1.14.x"
211208configvar CSI_PROW_E2E_VERSION_1_15 v1.15.0 " E2E version for Kubernetes 1.15.x"
212209configvar CSI_PROW_E2E_VERSION_1_16 v1.16.0 " E2E version for Kubernetes 1.16.x"
210+ configvar CSI_PROW_E2E_VERSION_1_17 v1.17.0 " E2E version for Kubernetes 1.17.x"
213211# TODO: add new CSI_PROW_E2E_VERSION entry for future Kubernetes releases
214212configvar CSI_PROW_E2E_VERSION_LATEST master " E2E version for Kubernetes master" # testing against Kubernetes master is already tracking a moving target, so we might as well use a moving E2E version
215213configvar CSI_PROW_E2E_REPO_LATEST https://github.com/kubernetes/kubernetes " E2E repo for Kubernetes >= 1.13.x" # currently the same for all versions
@@ -279,6 +277,14 @@ tests_need_alpha_cluster () {
279277 tests_enabled " parallel-alpha" " serial-alpha"
280278}
281279
280+ # Regex for non-alpha, feature-tagged tests that should be run.
281+ #
282+ # Starting with 1.17, snapshots is beta, but the E2E tests still have the
283+ # [Feature:] tag. They need to be explicitly enabled.
284+ configvar CSI_PROW_E2E_FOCUS_1_15 ' ^' " non-alpha, feature-tagged tests for Kubernetes = 1.15" # no tests to run, match nothing
285+ configvar CSI_PROW_E2E_FOCUS_1_16 ' ^' " non-alpha, feature-tagged tests for Kubernetes = 1.16" # no tests to run, match nothing
286+ configvar CSI_PROW_E2E_FOCUS_LATEST ' \[Feature:VolumeSnapshotDataSource\]' " non-alpha, feature-tagged tests for Kubernetes >= 1.17"
287+ configvar CSI_PROW_E2E_FOCUS " $( get_versioned_variable CSI_PROW_E2E_FOCUS " ${csi_prow_kubernetes_version_suffix} " ) " " non-alpha, feature-tagged tests"
282288
283289# Serial vs. parallel is always determined by these regular expressions.
284290# Individual regular expressions are seperated by spaces for readability
@@ -314,21 +320,27 @@ configvar CSI_PROW_E2E_ALPHA "$(get_versioned_variable CSI_PROW_E2E_ALPHA "${csi
314320# kubernetes-csi components must be updated, either by disabling
315321# the failing test for "latest" or by updating the test and not running
316322# it anymore for older releases.
317- configvar CSI_PROW_E2E_ALPHA_GATES_1_14 ' VolumeSnapshotDataSource=true,ExpandCSIVolumes=true' " alpha feature gates for Kubernetes 1.14"
318323configvar CSI_PROW_E2E_ALPHA_GATES_1_15 ' VolumeSnapshotDataSource=true,ExpandCSIVolumes=true' " alpha feature gates for Kubernetes 1.15"
319324configvar CSI_PROW_E2E_ALPHA_GATES_1_16 ' VolumeSnapshotDataSource=true' " alpha feature gates for Kubernetes 1.16"
320325# TODO: add new CSI_PROW_ALPHA_GATES_xxx entry for future Kubernetes releases and
321326# add new gates to CSI_PROW_E2E_ALPHA_GATES_LATEST.
322- configvar CSI_PROW_E2E_ALPHA_GATES_LATEST ' VolumeSnapshotDataSource=true ' " alpha feature gates for latest Kubernetes"
327+ configvar CSI_PROW_E2E_ALPHA_GATES_LATEST ' ' " alpha feature gates for latest Kubernetes"
323328configvar CSI_PROW_E2E_ALPHA_GATES " $( get_versioned_variable CSI_PROW_E2E_ALPHA_GATES " ${csi_prow_kubernetes_version_suffix} " ) " " alpha E2E feature gates"
324329
330+ # Which external-snapshotter tag to use for the snapshotter CRD and snapshot-controller deployment
331+ configvar CSI_SNAPSHOTTER_VERSION ' v2.0.0' " external-snapshotter version tag"
332+
325333# Some tests are known to be unusable in a KinD cluster. For example,
326334# stopping kubelet with "ssh <node IP> systemctl stop kubelet" simply
327335# doesn't work. Such tests should be written in a way that they verify
328336# whether they can run with the current cluster provider, but until
329337# they are, we filter them out by name. Like the other test selection
330338# variables, this is again a space separated list of regular expressions.
331- configvar CSI_PROW_E2E_SKIP ' Disruptive' " tests that need to be skipped"
339+ #
340+ # "different node" test skips can be removed once
341+ # https://github.com/kubernetes/kubernetes/pull/82678 has been backported
342+ # to all the K8s versions we test against
343+ configvar CSI_PROW_E2E_SKIP ' Disruptive|different\s+node' " tests that need to be skipped"
332344
333345# This is the directory for additional result files. Usually set by Prow, but
334346# if not (for example, when invoking manually) it defaults to the work directory.
@@ -524,6 +536,7 @@ apiVersion: kind.sigs.k8s.io/v1alpha3
524536nodes:
525537- role: control-plane
526538- role: worker
539+ - role: worker
527540EOF
528541
529542 # kubeadm has API dependencies between apiVersion and Kubernetes version
576589 die " Cluster creation failed again, giving up. See the 'kind-cluster' artifact directory for additional logs."
577590 fi
578591 fi
579- KUBECONFIG=" $( kind get kubeconfig-path --name=csi-prow) "
580- export KUBECONFIG
592+ export KUBECONFIG=" ${HOME} /.kube/config"
581593}
582594
583595# Deletes kind cluster inside a prow job
@@ -670,6 +682,60 @@ install_hostpath () {
670682 fi
671683}
672684
685+ # Installs all nessesary snapshotter CRDs
686+ install_snapshot_crds () {
687+ # Wait until volumesnapshot CRDs are in place.
688+ CRD_BASE_DIR=" https://raw.githubusercontent.com/kubernetes-csi/external-snapshotter/${CSI_SNAPSHOTTER_VERSION} /config/crd"
689+ kubectl apply -f " ${CRD_BASE_DIR} /snapshot.storage.k8s.io_volumesnapshotclasses.yaml" --validate=false
690+ kubectl apply -f " ${CRD_BASE_DIR} /snapshot.storage.k8s.io_volumesnapshots.yaml" --validate=false
691+ kubectl apply -f " ${CRD_BASE_DIR} /snapshot.storage.k8s.io_volumesnapshotcontents.yaml" --validate=false
692+ cnt=0
693+ until kubectl get volumesnapshotclasses.snapshot.storage.k8s.io \
694+ && kubectl get volumesnapshots.snapshot.storage.k8s.io \
695+ && kubectl get volumesnapshotcontents.snapshot.storage.k8s.io; do
696+ if [ $cnt -gt 30 ]; then
697+ echo >&2 " ERROR: snapshot CRDs not ready after over 1 min"
698+ exit 1
699+ fi
700+ echo " $( date +%H:%M:%S) " " waiting for snapshot CRDs, attempt #$cnt "
701+ cnt=$(( cnt + 1 ))
702+ sleep 2
703+ done
704+ }
705+
706+ # Install snapshot controller and associated RBAC, retrying until the pod is running.
707+ install_snapshot_controller () {
708+ kubectl apply -f " https://raw.githubusercontent.com/kubernetes-csi/external-snapshotter/${CSI_SNAPSHOTTER_VERSION} /deploy/kubernetes/snapshot-controller/rbac-snapshot-controller.yaml"
709+ cnt=0
710+ until kubectl get clusterrolebinding snapshot-controller-role; do
711+ if [ $cnt -gt 30 ]; then
712+ echo " Cluster role bindings:"
713+ kubectl describe clusterrolebinding
714+ echo >&2 " ERROR: snapshot controller RBAC not ready after over 5 min"
715+ exit 1
716+ fi
717+ echo " $( date +%H:%M:%S) " " waiting for snapshot RBAC setup complete, attempt #$cnt "
718+ cnt=$(( cnt + 1 ))
719+ sleep 10
720+ done
721+
722+
723+ kubectl apply -f " https://raw.githubusercontent.com/kubernetes-csi/external-snapshotter/${CSI_SNAPSHOTTER_VERSION} /deploy/kubernetes/snapshot-controller/setup-snapshot-controller.yaml"
724+ cnt=0
725+ expected_running_pods=$( curl https://raw.githubusercontent.com/kubernetes-csi/external-snapshotter/" ${CSI_SNAPSHOTTER_VERSION} " /deploy/kubernetes/snapshot-controller/setup-snapshot-controller.yaml | grep replicas | cut -d ' :' -f 2-)
726+ while [ " $( kubectl get pods -l app=snapshot-controller | grep ' Running' -c) " -lt " $expected_running_pods " ]; do
727+ if [ $cnt -gt 30 ]; then
728+ echo " snapshot-controller pod status:"
729+ kubectl describe pods -l app=snapshot-controller
730+ echo >&2 " ERROR: snapshot controller not ready after over 5 min"
731+ exit 1
732+ fi
733+ echo " $( date +%H:%M:%S) " " waiting for snapshot controller deployment to complete, attempt #$cnt "
734+ cnt=$(( cnt + 1 ))
735+ sleep 10
736+ done
737+ }
738+
673739# collect logs and cluster status (like the version of all components, Kubernetes version, test version)
674740collect_cluster_info () {
675741 cat << EOF
@@ -786,10 +852,6 @@ run_e2e () (
786852 install_e2e || die " building e2e.test failed"
787853 install_ginkgo || die " installing ginkgo failed"
788854
789- # TODO (?): multi-node cluster (depends on https://github.com/kubernetes-csi/csi-driver-host-path/pull/14).
790- # When running on a multi-node cluster, we need to figure out where the
791- # hostpath driver was deployed and set ClientNodeName accordingly.
792-
793855 generate_test_driver > " ${CSI_PROW_WORK} /test-driver.yaml" || die " generating test-driver.yaml failed"
794856
795857 # Rename, merge and filter JUnit files. Necessary in case that we run the E2E suite again
@@ -940,6 +1002,34 @@ make_test_to_junit () {
9401002 fi
9411003}
9421004
1005+ # version_gt returns true if arg1 is greater than arg2.
1006+ #
1007+ # This function expects versions to be one of the following formats:
1008+ # X.Y.Z, release-X.Y.Z, vX.Y.Z
1009+ #
1010+ # where X,Y, and Z are any number.
1011+ #
1012+ # Partial versions (1.2, release-1.2) work as well.
1013+ # The follow substrings are stripped before version comparison:
1014+ # - "v"
1015+ # - "release-"
1016+ # - "kubernetes-"
1017+ #
1018+ # Usage:
1019+ # version_gt release-1.3 v1.2.0 (returns true)
1020+ # version_gt v1.1.1 v1.2.0 (returns false)
1021+ # version_gt 1.1.1 v1.2.0 (returns false)
1022+ # version_gt 1.3.1 v1.2.0 (returns true)
1023+ # version_gt 1.1.1 release-1.2.0 (returns false)
1024+ # version_gt 1.2.0 1.2.2 (returns false)
1025+ function version_gt() {
1026+ versions=$( for ver in " $@ " ; do ver=${ver# release-} ; ver=${ver# kubernetes-} ; echo " ${ver# v} " ; done)
1027+ greaterVersion=${1# " release-" } ;
1028+ greaterVersion=${greaterVersion# " kubernetes-" } ;
1029+ greaterVersion=${greaterVersion# " v" } ;
1030+ test " $( printf ' %s' " $versions " | sort -V | head -n 1) " ! = " $greaterVersion "
1031+ }
1032+
9431033main () {
9441034 local images ret
9451035 ret=0
@@ -1000,6 +1090,16 @@ main () {
10001090 if tests_need_non_alpha_cluster; then
10011091 start_cluster || die " starting the non-alpha cluster failed"
10021092
1093+ # Install necessary snapshot CRDs and snapshot controller
1094+ # For Kubernetes 1.17+, we will install the CRDs and snapshot controller.
1095+ if version_gt " ${CSI_PROW_KUBERNETES_VERSION} " " 1.16.255" || " ${CSI_PROW_KUBERNETES_VERSION} " == " latest" ; then
1096+ info " Version ${CSI_PROW_KUBERNETES_VERSION} , installing CRDs and snapshot controller"
1097+ install_snapshot_crds
1098+ install_snapshot_controller
1099+ else
1100+ info " Version ${CSI_PROW_KUBERNETES_VERSION} , skipping CRDs and snapshot controller"
1101+ fi
1102+
10031103 # Installing the driver might be disabled.
10041104 if install_hostpath " $images " ; then
10051105 collect_cluster_info
@@ -1019,6 +1119,16 @@ main () {
10191119 warn " E2E parallel failed"
10201120 ret=1
10211121 fi
1122+
1123+ # Run tests that are feature tagged, but non-alpha
1124+ # Ignore: Double quote to prevent globbing and word splitting.
1125+ # shellcheck disable=SC2086
1126+ if ! run_e2e parallel-features ${CSI_PROW_GINKO_PARALLEL} \
1127+ -focus=" External.Storage.*($( regex_join " ${CSI_PROW_E2E_FOCUS} " ) )" \
1128+ -skip=" $( regex_join " ${CSI_PROW_E2E_SERIAL} " ) " ; then
1129+ warn " E2E parallel features failed"
1130+ ret=1
1131+ fi
10221132 fi
10231133
10241134 if tests_enabled " serial" ; then
@@ -1037,6 +1147,16 @@ main () {
10371147 # Need to (re)create the cluster.
10381148 start_cluster " ${CSI_PROW_E2E_ALPHA_GATES} " || die " starting alpha cluster failed"
10391149
1150+ # Install necessary snapshot CRDs and snapshot controller
1151+ # For Kubernetes 1.17+, we will install the CRDs and snapshot controller.
1152+ if version_gt " ${CSI_PROW_KUBERNETES_VERSION} " " 1.16.255" || " ${CSI_PROW_KUBERNETES_VERSION} " == " latest" ; then
1153+ info " Version ${CSI_PROW_KUBERNETES_VERSION} , installing CRDs and snapshot controller"
1154+ install_snapshot_crds
1155+ install_snapshot_controller
1156+ else
1157+ info " Version ${CSI_PROW_KUBERNETES_VERSION} , skipping CRDs and snapshot controller"
1158+ fi
1159+
10401160 # Installing the driver might be disabled.
10411161 if install_hostpath " $images " ; then
10421162 collect_cluster_info
0 commit comments