Skip to content

Commit a1e1127

Browse files
authored
Merge pull request #139 from pohly/kind-for-kubernetes-latest
prow.sh: use KinD main for latest Kubernetes
2 parents 1d77cfc + 1c0fb09 commit a1e1127

File tree

1 file changed

+35
-20
lines changed

1 file changed

+35
-20
lines changed

Diff for: prow.sh

+35-20
Original file line numberDiff line numberDiff line change
@@ -91,24 +91,6 @@ configvar CSI_PROW_GO_VERSION_SANITY "${CSI_PROW_GO_VERSION_BUILD}" "Go version
9191
configvar CSI_PROW_GO_VERSION_KIND "${CSI_PROW_GO_VERSION_BUILD}" "Go version for building 'kind'" # depends on CSI_PROW_KIND_VERSION below
9292
configvar CSI_PROW_GO_VERSION_GINKGO "${CSI_PROW_GO_VERSION_BUILD}" "Go version for building ginkgo" # depends on CSI_PROW_GINKGO_VERSION below
9393

94-
# kind version to use. If the pre-installed version is different,
95-
# the desired version is downloaded from https://github.com/kubernetes-sigs/kind/releases
96-
# (if available), otherwise it is built from source.
97-
configvar CSI_PROW_KIND_VERSION "v0.10.0" "kind"
98-
99-
# kind images to use. Must match the kind version.
100-
# The release notes of each kind release list the supported images.
101-
configvar CSI_PROW_KIND_IMAGES "kindest/node:v1.20.2@sha256:8f7ea6e7642c0da54f04a7ee10431549c0257315b3a634f6ef2fecaaedb19bab
102-
kindest/node:v1.19.7@sha256:a70639454e97a4b733f9d9b67e12c01f6b0297449d5b9cbbef87473458e26dca
103-
kindest/node:v1.18.15@sha256:5c1b980c4d0e0e8e7eb9f36f7df525d079a96169c8a8f20d8bd108c0d0889cc4
104-
kindest/node:v1.17.17@sha256:7b6369d27eee99c7a85c48ffd60e11412dc3f373658bc59b7f4d530b7056823e
105-
kindest/node:v1.16.15@sha256:c10a63a5bda231c0a379bf91aebf8ad3c79146daca59db816fb963f731852a99
106-
kindest/node:v1.15.12@sha256:67181f94f0b3072fb56509107b380e38c55e23bf60e6f052fbd8052d26052fb5
107-
kindest/node:v1.14.10@sha256:3fbed72bcac108055e46e7b4091eb6858ad628ec51bf693c21f5ec34578f6180" "kind images"
108-
109-
# Use kind node-image --type=bazel by default, but allow to disable that.
110-
configvar CSI_PROW_USE_BAZEL true "use Bazel during 'kind node-image' invocation"
111-
11294
# ginkgo test runner version to use. If the pre-installed version is
11395
# different, the desired version is built from source.
11496
configvar CSI_PROW_GINKGO_VERSION v1.7.0 "Ginkgo"
@@ -145,6 +127,38 @@ configvar CSI_PROW_KUBERNETES_VERSION 1.17.0 "Kubernetes"
145127
# when a Prow job just defines the Kubernetes version.
146128
csi_prow_kubernetes_version_suffix="$(echo "${CSI_PROW_KUBERNETES_VERSION}" | tr . _ | tr '[:lower:]' '[:upper:]' | sed -e 's/^RELEASE-//' -e 's/\([0-9]*\)_\([0-9]*\).*/\1_\2/')"
147129

130+
# Only the latest KinD is (eventually) guaranteed to work with the
131+
# latest Kubernetes. For example, KinD 0.10.0 failed with Kubernetes
132+
# 1.21.0-beta1. Therefore the default version of KinD is "main"
133+
# for that, otherwise the latest stable release for which we then
134+
# list the officially supported images below.
135+
kind_version_default () {
136+
case "${CSI_PROW_KUBERNETES_VERSION}" in
137+
latest|master)
138+
echo main;;
139+
*)
140+
echo v0.10.0;;
141+
esac
142+
}
143+
144+
# kind version to use. If the pre-installed version is different,
145+
# the desired version is downloaded from https://github.com/kubernetes-sigs/kind/releases
146+
# (if available), otherwise it is built from source.
147+
configvar CSI_PROW_KIND_VERSION "$(kind_version_default)" "kind"
148+
149+
# kind images to use. Must match the kind version.
150+
# The release notes of each kind release list the supported images.
151+
configvar CSI_PROW_KIND_IMAGES "kindest/node:v1.20.2@sha256:8f7ea6e7642c0da54f04a7ee10431549c0257315b3a634f6ef2fecaaedb19bab
152+
kindest/node:v1.19.7@sha256:a70639454e97a4b733f9d9b67e12c01f6b0297449d5b9cbbef87473458e26dca
153+
kindest/node:v1.18.15@sha256:5c1b980c4d0e0e8e7eb9f36f7df525d079a96169c8a8f20d8bd108c0d0889cc4
154+
kindest/node:v1.17.17@sha256:7b6369d27eee99c7a85c48ffd60e11412dc3f373658bc59b7f4d530b7056823e
155+
kindest/node:v1.16.15@sha256:c10a63a5bda231c0a379bf91aebf8ad3c79146daca59db816fb963f731852a99
156+
kindest/node:v1.15.12@sha256:67181f94f0b3072fb56509107b380e38c55e23bf60e6f052fbd8052d26052fb5
157+
kindest/node:v1.14.10@sha256:3fbed72bcac108055e46e7b4091eb6858ad628ec51bf693c21f5ec34578f6180" "kind images"
158+
159+
# Use kind node-image --type=bazel by default, but allow to disable that.
160+
configvar CSI_PROW_USE_BAZEL true "use Bazel during 'kind node-image' invocation"
161+
148162
# Work directory. It has to allow running executables, therefore /tmp
149163
# is avoided. Cleaning up after the script is intentionally left to
150164
# the caller.
@@ -403,7 +417,7 @@ install_kind () {
403417
chmod u+x "${CSI_PROW_WORK}/bin/kind"
404418
else
405419
git_checkout https://github.com/kubernetes-sigs/kind "${GOPATH}/src/sigs.k8s.io/kind" "${CSI_PROW_KIND_VERSION}" --depth=1 &&
406-
(cd "${GOPATH}/src/sigs.k8s.io/kind" && make install INSTALL_DIR="${CSI_PROW_WORK}/bin")
420+
(cd "${GOPATH}/src/sigs.k8s.io/kind" && run_with_go "$CSI_PROW_GO_VERSION_KIND" make install INSTALL_DIR="${CSI_PROW_WORK}/bin")
407421
fi
408422
}
409423

@@ -569,7 +583,8 @@ start_cluster () {
569583

570584
go_version="$(go_version_for_kubernetes "${CSI_PROW_WORK}/src/kubernetes" "$version")" || die "cannot proceed without knowing Go version for Kubernetes"
571585
# Changing into the Kubernetes source code directory is a workaround for https://github.com/kubernetes-sigs/kind/issues/1910
572-
(cd "${CSI_PROW_WORK}/src/kubernetes" && run_with_go "$go_version" kind build node-image --image csiprow/node:latest --type="$type" --kube-root "${CSI_PROW_WORK}/src/kubernetes") || die "'kind build node-image' failed"
586+
# shellcheck disable=SC2046
587+
(cd "${CSI_PROW_WORK}/src/kubernetes" && run_with_go "$go_version" kind build node-image --image csiprow/node:latest $(if [ "$CSI_PROW_KIND_VERSION" != "main" ]; then echo --type="$type"; fi) --kube-root "${CSI_PROW_WORK}/src/kubernetes") || die "'kind build node-image' failed"
573588
csi_prow_kind_have_kubernetes=true
574589
fi
575590
image="csiprow/node:latest"

0 commit comments

Comments
 (0)