@@ -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).
@@ -466,40 +498,51 @@ start_cluster () {
466498 image=" kindest/node:v${CSI_PROW_KUBERNETES_VERSION} "
467499 fi
468500 cat > " ${CSI_PROW_WORK} /kind-config.yaml" << EOF
469- kind: Config
470- apiVersion: kind.sigs.k8s.io/v1alpha2
501+ kind: Cluster
502+ apiVersion: kind.sigs.k8s.io/v1alpha3
471503nodes:
472504- role: control-plane
473- kubeadmConfigPatches:
474- - |
475- apiVersion: kubeadm.k8s.io/v1beta1
476- kind: ClusterConfiguration
477- metadata:
478- name: config
479- apiServer:
480- extraArgs:
481- "feature-gates": "$gates "
482- controllerManager:
483- extraArgs:
484- "feature-gates": "$gates "
485- scheduler:
486- extraArgs:
487- "feature-gates": "$gates "
488- - |
489- apiVersion: kubelet.config.k8s.io/v1beta1
490- kind: KubeletConfiguration
491- metadata:
492- name: config
493- featureGates:
494- $( list_gates " $gates " )
495- - |
496- apiVersion: kubeproxy.config.k8s.io/v1alpha1
497- kind: KubeProxyConfiguration
498- metadata:
499- name: config
500- 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:
501542$( list_gates " $gates " )
502543EOF
544+ fi
545+
503546 info " kind-config.yaml:"
504547 cat " ${CSI_PROW_WORK} /kind-config.yaml"
505548 if ! run kind create cluster --name csi-prow --config " ${CSI_PROW_WORK} /kind-config.yaml" --wait 5m --image " $image " ; then
0 commit comments