@@ -52,6 +52,26 @@ configvar () {
5252    eval  echo  " \$ 3:" " $1 =\$ {$1 }" 
5353}
5454
55+ #  Takes the minor version of $CSI_PROW_KUBERNETES_VERSION and overrides it to
56+ #  $1 if they are equal minor versions. Ignores versions that begin with
57+ #  "release-".
58+ override_k8s_version  () {
59+     local  current_minor_version
60+     local  override_minor_version
61+ 
62+     #  Ignore: See if you can use ${variable//search/replace} instead.
63+     #  shellcheck disable=SC2001
64+     current_minor_version=" $( echo " ${CSI_PROW_KUBERNETES_VERSION} " |  sed -e ' s/\([0-9]*\)\.\([0-9]*\).*/\1\.\2/' ) " 
65+ 
66+     #  Ignore: See if you can use ${variable//search/replace} instead.
67+     #  shellcheck disable=SC2001
68+     override_minor_version=" $( echo " ${1} " |  sed -e ' s/\([0-9]*\)\.\([0-9]*\).*/\1\.\2/' ) " 
69+     if  [ " ${current_minor_version} " ==  " ${override_minor_version} " ;  then 
70+       CSI_PROW_KUBERNETES_VERSION=" $1 " 
71+       echo  " Overriding CSI_PROW_KUBERNETES_VERSION with $1 : $CSI_PROW_KUBERNETES_VERSION " 
72+     fi 
73+ }
74+ 
5575#  Prints the value of a variable + version suffix, falling back to variable + "LATEST".
5676get_versioned_variable  () {
5777    local  var=" $1 " 
@@ -81,7 +101,7 @@ configvar CSI_PROW_GO_VERSION_GINKGO "${CSI_PROW_GO_VERSION_BUILD}" "Go version
81101#  kind version to use. If the pre-installed version is different,
82102#  the desired version is downloaded from https://github.com/kubernetes-sigs/kind/releases/download/
83103#  (if available), otherwise it is built from source.
84- configvar CSI_PROW_KIND_VERSION 0.2.1  " kind" 
104+ configvar CSI_PROW_KIND_VERSION v0.4.0  " kind" 
85105
86106#  ginkgo test runner version to use. If the pre-installed version is
87107#  different, the desired version is built from source.
@@ -108,6 +128,18 @@ configvar CSI_PROW_BUILD_JOB true "building code in repo enabled"
108128#  deprecating or changing the implementation of an alpha feature.
109129configvar CSI_PROW_KUBERNETES_VERSION 1.13.3 " Kubernetes" 
110130
131+ #  This is a hack to workaround the issue that each version
132+ #  of kind currently only supports specific patch versions of
133+ #  Kubernetes. We need to override CSI_PROW_KUBERNETES_VERSION
134+ #  passed in by our CI/pull jobs to the versions that
135+ #  kind v0.4.0 supports.
136+ # 
137+ #  If the version is prefixed with "release-", then nothing
138+ #  is overridden.
139+ override_k8s_version " 1.13.7" 
140+ override_k8s_version " 1.14.3" 
141+ override_k8s_version " 1.15.0" 
142+ 
111143#  CSI_PROW_KUBERNETES_VERSION reduced to first two version numbers and
112144#  with underscore (1_13 instead of 1.13.3) and in uppercase (LATEST
113145#  instead of latest).
@@ -151,9 +183,10 @@ configvar CSI_PROW_WORK "$(mkdir -p "$GOPATH/pkg" && mktemp -d "$GOPATH/pkg/csip
151183# 
152184#  When no deploy script is found (nothing in `deploy` directory,
153185#  CSI_PROW_HOSTPATH_REPO=none), nothing gets deployed.
154- configvar CSI_PROW_HOSTPATH_VERSION fc52d13ba07922c80555a24616a5b16480350c3f  " hostpath driver"   #  pre-1.1.0 
186+ configvar CSI_PROW_HOSTPATH_VERSION " v1.2.0-rc2 " " hostpath driver" 
155187configvar CSI_PROW_HOSTPATH_REPO https://github.com/kubernetes-csi/csi-driver-host-path " hostpath repo" 
156188configvar CSI_PROW_DEPLOYMENT " " " deployment" 
189+ configvar CSI_PROW_HOSTPATH_DRIVER_NAME " hostpath.csi.k8s.io" " the hostpath driver name" 
157190
158191#  If CSI_PROW_HOSTPATH_CANARY is set (typically to "canary", but also
159192#  "1.0-canary"), then all image versions are replaced with that
@@ -169,6 +202,7 @@ configvar CSI_PROW_HOSTPATH_CANARY "" "hostpath image"
169202#  CSI_PROW_E2E_REPO=none disables E2E testing.
170203configvar CSI_PROW_E2E_VERSION_1_13 v1.14.0 " E2E version for Kubernetes 1.13.x" #  we can't use the one from 1.13.x because it didn't have --storage.testdriver
171204configvar CSI_PROW_E2E_VERSION_1_14 v1.14.0 " E2E version for Kubernetes 1.14.x" 
205+ configvar CSI_PROW_E2E_VERSION_1_15 v1.15.0 " E2E version for Kubernetes 1.15.x" 
172206#  TODO: add new CSI_PROW_E2E_VERSION entry for future Kubernetes releases
173207configvar 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
174208configvar CSI_PROW_E2E_REPO_LATEST https://github.com/kubernetes/kubernetes " E2E repo for Kubernetes >= 1.13.x" #  currently the same for all versions
@@ -276,6 +310,7 @@ configvar CSI_PROW_E2E_ALPHA "$(get_versioned_variable CSI_PROW_E2E_ALPHA "${csi
276310#  it anymore for older releases.
277311configvar CSI_PROW_E2E_ALPHA_GATES_1_13 ' VolumeSnapshotDataSource=true,BlockVolume=true,CSIBlockVolume=true' " alpha feature gates for Kubernetes 1.13" 
278312configvar CSI_PROW_E2E_ALPHA_GATES_1_14 ' VolumeSnapshotDataSource=true,ExpandCSIVolumes=true' " alpha feature gates for Kubernetes 1.14" 
313+ configvar CSI_PROW_E2E_ALPHA_GATES_1_15 ' VolumeSnapshotDataSource=true,ExpandCSIVolumes=true' " alpha feature gates for Kubernetes 1.15" 
279314#  TODO: add new CSI_PROW_ALPHA_GATES_xxx entry for future Kubernetes releases and
280315#  add new gates to CSI_PROW_E2E_ALPHA_GATES_LATEST.
281316configvar CSI_PROW_E2E_ALPHA_GATES_LATEST ' VolumeSnapshotDataSource=true,ExpandCSIVolumes=true' " alpha feature gates for latest Kubernetes" 
@@ -450,7 +485,7 @@ start_cluster () {
450485                    tag=" $( echo " ${CSI_PROW_KUBERNETES_VERSION} " |  sed -e ' s/release-\(.*\)/v\1.0-release./' ) " 
451486                * )
452487                    #  We have to make something up. v1.0.0 did not work for some reasons.
453-                     tag=" v1.14.0 -" 
488+                     tag=" v999.999.999 -" 
454489            esac 
455490            tag=" $tag $( cd " $GOPATH /src/k8s.io/kubernetes" &&  git rev-list --abbrev-commit HEAD) " 
456491            (cd " $GOPATH /src/k8s.io/kubernetes" &&  run git tag -f " $tag " ||  die " git tag failed" 
@@ -463,40 +498,51 @@ start_cluster () {
463498        image=" kindest/node:v${CSI_PROW_KUBERNETES_VERSION} " 
464499    fi 
465500    cat > " ${CSI_PROW_WORK} /kind-config.yaml" << EOF 
466- kind: Config  
467- apiVersion: kind.sigs.k8s.io/v1alpha2  
501+ kind: Cluster  
502+ apiVersion: kind.sigs.k8s.io/v1alpha3  
468503nodes: 
469504- role: control-plane 
470-   kubeadmConfigPatches: 
471-   - | 
472-     apiVersion: kubeadm.k8s.io/v1beta1 
473-     kind: ClusterConfiguration 
474-     metadata: 
475-       name: config 
476-     apiServer: 
477-       extraArgs: 
478-         "feature-gates": "$gates " 
479-     controllerManager: 
480-       extraArgs: 
481-         "feature-gates": "$gates " 
482-     scheduler: 
483-       extraArgs: 
484-         "feature-gates": "$gates " 
485-   - | 
486-     apiVersion: kubelet.config.k8s.io/v1beta1 
487-     kind: KubeletConfiguration 
488-     metadata: 
489-       name: config 
490-     featureGates: 
491- $( list_gates " $gates " ) 
492-   - | 
493-     apiVersion: kubeproxy.config.k8s.io/v1alpha1 
494-     kind: KubeProxyConfiguration 
495-     metadata: 
496-       name: config 
497-     featureGates: 
505+ EOF 
506+ 
507+     #  kubeadm has API dependencies between apiVersion and Kubernetes version
508+     #  1.15+ requires kubeadm.k8s.io/v1beta2
509+     #  We only run alpha tests against master so we don't need to maintain
510+     #  different patches for different Kubernetes releases.
511+     if  [[ -n  " $gates " ;  then 
512+         cat >> " ${CSI_PROW_WORK} /kind-config.yaml" << EOF 
513+ kubeadmConfigPatches: 
514+ - | 
515+   apiVersion: kubeadm.k8s.io/v1beta2 
516+   kind: ClusterConfiguration 
517+   metadata: 
518+     name: config 
519+   apiServer: 
520+     extraArgs: 
521+       "feature-gates": "$gates " 
522+   controllerManager: 
523+     extraArgs: 
524+       "feature-gates": "$gates " 
525+   scheduler: 
526+     extraArgs: 
527+       "feature-gates": "$gates " 
528+ - | 
529+   apiVersion: kubeadm.k8s.io/v1beta2 
530+   kind: InitConfiguration 
531+   metadata: 
532+     name: config 
533+   nodeRegistration: 
534+     kubeletExtraArgs: 
535+       "feature-gates": "$gates " 
536+ - | 
537+   apiVersion: kubeproxy.config.k8s.io/v1alpha1 
538+   kind: KubeProxyConfiguration 
539+   metadata: 
540+     name: config 
541+   featureGates: 
498542$( list_gates " $gates " ) 
499543EOF 
544+     fi 
545+ 
500546    info " kind-config.yaml:" 
501547    cat " ${CSI_PROW_WORK} /kind-config.yaml" 
502548    if  !  run kind create cluster --name csi-prow --config " ${CSI_PROW_WORK} /kind-config.yaml" " $image " ;  then 
@@ -673,6 +719,29 @@ hostpath_supports_block () {
673719    echo "  ${result:- true} " 
674720} 
675721
722+ # The default implementation of this function generates a external 
723+ # driver test configuration for the hostpath driver. 
724+ # 
725+ # The content depends on both what the E2E suite expects and what the 
726+ # installed hostpath driver supports. Generating it here seems prone 
727+ # to breakage, but it is uncertain where a better place might be. 
728+ generate_test_driver () { 
729+     cat <<EOF 
730+ ShortName: csiprow 
731+ StorageClass: 
732+   FromName: true 
733+ SnapshotClass: 
734+   FromName: true 
735+ DriverInfo: 
736+   Name: ${CSI_PROW_HOSTPATH_DRIVER_NAME}  
737+   Capabilities: 
738+     block: $( hostpath_supports_block)  
739+     persistence: true 
740+     dataSource: true 
741+     multipods: true 
742+ EOF 
743+ } 
744+ 
676745# Captures pod output while running some other command. 
677746run_with_loggers () ( 
678747    loggers=$( start_loggers -f)  
@@ -698,23 +767,7 @@ run_e2e () (
698767    # When running on a multi-node cluster, we need to figure out where the 
699768    # hostpath driver was deployed and set ClientNodeName accordingly. 
700769
701-     # The content of this file depends on both what the E2E suite expects and 
702-     # what the installed hostpath driver supports. Generating it here seems 
703-     # prone to breakage, but it is uncertain where a better place might be. 
704-     cat >"  ${CSI_PROW_WORK} /hostpath-test-driver.yaml"  <<EOF
705- ShortName: csiprow 
706- StorageClass: 
707-   FromName: true 
708- SnapshotClass: 
709-   FromName: true 
710- DriverInfo: 
711-   Name: csi-hostpath 
712-   Capabilities: 
713-     block: $( hostpath_supports_block)  
714-     persistence: true 
715-     dataSource: true 
716-     multipods: true 
717- EOF 
770+     generate_test_driver >"  ${CSI_PROW_WORK} /test-driver.yaml"  || die " " 
718771
719772    # Rename, merge and filter JUnit files. Necessary in case that we run the E2E suite again 
720773    # and to avoid the large number of "  skipped"  tests that we get from using
727780    trap move_junit EXIT 
728781
729782    cd "  ${GOPATH} /src/${CSI_PROW_E2E_IMPORT_PATH} "  &&
730-     run_with_loggers ginkgo -v "  $@ "  " ${CSI_PROW_WORK} /e2e.test"  -- -report-dir " ${ARTIFACTS} "  -storage.testdriver=" ${CSI_PROW_WORK} /hostpath- test-driver.yaml" 
783+     run_with_loggers ginkgo -v "  $@ "  " ${CSI_PROW_WORK} /e2e.test"  -- -report-dir " ${ARTIFACTS} "  -storage.testdriver=" ${CSI_PROW_WORK} /test-driver.yaml" 
731784) 
732785
733786# Run csi-sanity against installed CSI driver. 
0 commit comments