@@ -52,26 +52,6 @@ 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-
7555# Prints the value of a variable + version suffix, falling back to variable + "LATEST".
7656get_versioned_variable () {
7757 local var=" $1 "
@@ -107,9 +87,19 @@ configvar CSI_PROW_GO_VERSION_KIND "${CSI_PROW_GO_VERSION_BUILD}" "Go version fo
10787configvar CSI_PROW_GO_VERSION_GINKGO " ${CSI_PROW_GO_VERSION_BUILD} " " Go version for building ginkgo" # depends on CSI_PROW_GINKGO_VERSION below
10888
10989# kind version to use. If the pre-installed version is different,
110- # the desired version is downloaded from https://github.com/kubernetes-sigs/kind/releases/download/
90+ # the desired version is downloaded from https://github.com/kubernetes-sigs/kind/releases
11191# (if available), otherwise it is built from source.
112- configvar CSI_PROW_KIND_VERSION " v0.6.0" " kind"
92+ configvar CSI_PROW_KIND_VERSION " v0.9.0" " kind"
93+
94+ # kind images to use. Must match the kind version.
95+ # The release notes of each kind release list the supported images.
96+ configvar CSI_PROW_KIND_IMAGES " kindest/node:v1.19.1@sha256:98cf5288864662e37115e362b23e4369c8c4a408f99cbc06e58ac30ddc721600
97+ kindest/node:v1.18.8@sha256:f4bcc97a0ad6e7abaf3f643d890add7efe6ee4ab90baeb374b4f41a4c95567eb
98+ kindest/node:v1.17.11@sha256:5240a7a2c34bf241afb54ac05669f8a46661912eab05705d660971eeb12f6555
99+ kindest/node:v1.16.15@sha256:a89c771f7de234e6547d43695c7ab047809ffc71a0c3b65aa54eda051c45ed20
100+ kindest/node:v1.15.12@sha256:d9b939055c1e852fe3d86955ee24976cab46cba518abcb8b13ba70917e6547a6
101+ kindest/node:v1.14.10@sha256:ce4355398a704fca68006f8a29f37aafb49f8fc2f64ede3ccd0d9198da910146
102+ kindest/node:v1.13.12@sha256:1c1a48c2bfcbae4d5f4fa4310b5ed10756facad0b7a2ca93c7a4b5bae5db29f5" " kind images"
113103
114104# Use kind node-image --type=bazel by default, but allow to disable that.
115105configvar CSI_PROW_USE_BAZEL true " use Bazel during 'kind node-image' invocation"
@@ -127,10 +117,13 @@ configvar CSI_PROW_GINKO_PARALLEL "-p" "Ginko parallelism parameter(s)"
127117configvar CSI_PROW_BUILD_JOB true " building code in repo enabled"
128118
129119# Kubernetes version to test against. This must be a version number
130- # (like 1.13.3) for which there is a pre-built kind image (see
131- # https://hub.docker.com/r/kindest/node/tags), "latest" (builds
132- # Kubernetes from the master branch) or "release-x.yy" (builds
133- # Kubernetes from a release branch).
120+ # (like 1.13.3), "latest" (builds Kubernetes from the master branch)
121+ # or "release-x.yy" (builds Kubernetes from a release branch).
122+ #
123+ # The patch version is only relevant for picking the E2E test suite
124+ # that is used for testing. The script automatically picks
125+ # the kind images for the major/minor version of Kubernetes
126+ # that the kind release supports.
134127#
135128# This can also be a version that was not released yet at the time
136129# that the settings below were chose. The script will then
@@ -139,16 +132,6 @@ configvar CSI_PROW_BUILD_JOB true "building code in repo enabled"
139132# deprecating or changing the implementation of an alpha feature.
140133configvar CSI_PROW_KUBERNETES_VERSION 1.17.0 " Kubernetes"
141134
142- # This is a hack to workaround the issue that each version
143- # of kind currently only supports specific patch versions of
144- # Kubernetes. We need to override CSI_PROW_KUBERNETES_VERSION
145- # passed in by our CI/pull jobs to the versions that
146- # kind v0.5.0 supports.
147- #
148- # If the version is prefixed with "release-", then nothing
149- # is overridden.
150- override_k8s_version " 1.15.3"
151-
152135# CSI_PROW_KUBERNETES_VERSION reduced to first two version numbers and
153136# with underscore (1_13 instead of 1.13.3) and in uppercase (LATEST
154137# instead of latest).
@@ -338,9 +321,7 @@ configvar CSI_PROW_E2E_ALPHA "$(get_versioned_variable CSI_PROW_E2E_ALPHA "${csi
338321# kubernetes-csi components must be updated, either by disabling
339322# the failing test for "latest" or by updating the test and not running
340323# it anymore for older releases.
341- # TODO: add new CSI_PROW_ALPHA_GATES_xxx entry for future Kubernetes releases and
342- # add new gates to CSI_PROW_E2E_ALPHA_GATES_LATEST.
343- configvar CSI_PROW_E2E_ALPHA_GATES_LATEST ' ' " alpha feature gates for latest Kubernetes"
324+ configvar CSI_PROW_E2E_ALPHA_GATES_LATEST ' GenericEphemeralVolume=true,CSIStorageCapacity=true' " alpha feature gates for latest Kubernetes"
344325configvar CSI_PROW_E2E_ALPHA_GATES " $( get_versioned_variable CSI_PROW_E2E_ALPHA_GATES " ${csi_prow_kubernetes_version_suffix} " ) " " alpha E2E feature gates"
345326
346327# Which external-snapshotter tag to use for the snapshotter CRD and snapshot-controller deployment
@@ -504,6 +485,22 @@ list_gates () (
504485 done
505486)
506487
488+ # Turn feature gates in the format foo=true,bar=false into
489+ # a YAML map with the corresponding API groups for use
490+ # with https://kind.sigs.k8s.io/docs/user/configuration/#runtime-config
491+ list_api_groups () (
492+ set -f; IFS=' ,'
493+ # Ignore: Double quote to prevent globbing and word splitting.
494+ # shellcheck disable=SC2086
495+ set -- $1
496+ while [ " $1 " ]; do
497+ if [ " $1 " = ' CSIStorageCapacity=true' ]; then
498+ echo ' "storage.k8s.io/v1alpha1": "true"'
499+ fi
500+ shift
501+ done
502+ )
503+
507504go_version_for_kubernetes () (
508505 local path=" $1 "
509506 local version=" $2 "
@@ -533,8 +530,21 @@ start_cluster () {
533530 run kind delete cluster --name=csi-prow || die " kind delete failed"
534531 fi
535532
536- # Build from source?
537- if [[ " ${CSI_PROW_KUBERNETES_VERSION} " =~ ^release-| ^latest$ ]]; then
533+ # Try to find a pre-built kind image if asked to use a specific version.
534+ if ! [[ " ${CSI_PROW_KUBERNETES_VERSION} " =~ ^release-| ^latest$ ]]; then
535+ # Ignore: See if you can use ${variable//search/replace} instead.
536+ # shellcheck disable=SC2001
537+ major_minor=$( echo " ${CSI_PROW_KUBERNETES_VERSION} " | sed -e ' s/^\([0-9]*\)\.\([0-9]*\).*/\1.\2/' )
538+ for i in ${CSI_PROW_KIND_IMAGES} ; do
539+ if echo " $i " | grep -q " kindest/node:v${major_minor} " ; then
540+ image=" $i "
541+ break
542+ fi
543+ done
544+ fi
545+
546+ # Need to build from source?
547+ if ! [ " $image " ]; then
538548 if ! ${csi_prow_kind_have_kubernetes} ; then
539549 local version=" ${CSI_PROW_KUBERNETES_VERSION} "
540550 if [ " $version " = " latest" ]; then
@@ -552,63 +562,19 @@ start_cluster () {
552562 csi_prow_kind_have_kubernetes=true
553563 fi
554564 image=" csiprow/node:latest"
555- else
556- image=" kindest/node:v${CSI_PROW_KUBERNETES_VERSION} "
557565 fi
558566 cat > " ${CSI_PROW_WORK} /kind-config.yaml" << EOF
559567kind: Cluster
560- apiVersion: kind.sigs. k8s.io/v1alpha3
568+ apiVersion: kind.x- k8s.io/v1alpha4
561569nodes:
562570- role: control-plane
563571- role: worker
564572- role: worker
565- EOF
566-
567- # kubeadm has API dependencies between apiVersion and Kubernetes version
568- # 1.15+ requires kubeadm.k8s.io/v1beta2
569- # We only run alpha tests against master so we don't need to maintain
570- # different patches for different Kubernetes releases.
571- if [[ -n " $gates " ]]; then
572- cat >> " ${CSI_PROW_WORK} /kind-config.yaml" << EOF
573- kubeadmConfigPatches:
574- - |
575- apiVersion: kubeadm.k8s.io/v1beta2
576- kind: ClusterConfiguration
577- metadata:
578- name: config
579- apiServer:
580- extraArgs:
581- "feature-gates": "$gates "
582- controllerManager:
583- extraArgs:
584- "feature-gates": "$gates "
585- scheduler:
586- extraArgs:
587- "feature-gates": "$gates "
588- - |
589- apiVersion: kubeadm.k8s.io/v1beta2
590- kind: InitConfiguration
591- metadata:
592- name: config
593- nodeRegistration:
594- kubeletExtraArgs:
595- "feature-gates": "$gates "
596- - |
597- apiVersion: kubelet.config.k8s.io/v1beta1
598- kind: KubeletConfiguration
599- metadata:
600- name: config
601- featureGates:
602- $( list_gates " $gates " )
603- - |
604- apiVersion: kubeproxy.config.k8s.io/v1alpha1
605- kind: KubeProxyConfiguration
606- metadata:
607- name: config
608- featureGates:
573+ featureGates:
609574$( list_gates " $gates " )
575+ runtimeConfig:
576+ $( list_api_groups " $gates " )
610577EOF
611- fi
612578
613579 info " kind-config.yaml:"
614580 cat " ${CSI_PROW_WORK} /kind-config.yaml"
0 commit comments