Skip to content

Commit ba8a3ef

Browse files
committed
Use kind 0.14 to test Kubernetes 1.24
kind 0.13 and 0.14 add support for Kubernetes 1.24, but the non-1.24 Kubernetes images used with these versions currently embed containerd 1.6.4, which breaks Weave (see weaveworks/weave#3942 for details). To allow testing Kubernetes 1.24, install kind 0.14, while preserving kind 0.12; kind 0.12 is installed as "kind", kind 0.14 as "kind-0.14" (we need a "kind" binary because other parts of our CI expect it). When Kubernetes 1.24 is requested, deploy it with kind 0.14, otherwise rely on 0.12. See https://github.com/kubernetes-sigs/kind/releases/tag/v0.13.0 and https://github.com/kubernetes-sigs/kind/releases/tag/v0.14.0 for details. This will break OVN on K8s 1.24 since the OVN deployment script drives kind directly. Signed-off-by: Stephen Kitt <[email protected]>
1 parent c2b1f0b commit ba8a3ef

File tree

2 files changed

+31
-10
lines changed

2 files changed

+31
-10
lines changed

package/Dockerfile.shipyard-dapper-base

+4-1
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,13 @@ ENV LINT_VERSION=v1.46.0 \
6161
YQ_VERSION=4.20.2
6262

6363
# This layer's versioning is determined by us, and thus could be rebuilt more frequently to test different versions
64+
# We temporarily install kind-0.12 and kind-0.14; kind-0.12 is the default, and kind-0.14 is used for K8s 1.24, until
65+
# all kind images are available with containerd 1.6.5 or later
6466
RUN curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin -d ${LINT_VERSION} && \
6567
i=0; until curl "https://get.helm.sh/helm-${HELM_VERSION}-linux-${ARCH}.tar.gz" | tar -xzf -; do if ((++i > 5)); then break; fi; sleep 1; done && \
6668
mv linux-${ARCH}/helm /go/bin/ && chmod a+x /go/bin/helm && rm -rf linux-${ARCH} && \
67-
curl -Lo /go/bin/kind "https://github.com/kubernetes-sigs/kind/releases/download/${KIND_VERSION}/kind-linux-${ARCH}" && chmod a+x /go/bin/kind && \
69+
curl -Lo /go/bin/kind "https://github.com/kubernetes-sigs/kind/releases/download/v0.12.0/kind-linux-${ARCH}" && chmod a+x /go/bin/kind-0.12 && \
70+
curl -Lo /go/bin/kind-0.14 "https://github.com/kubernetes-sigs/kind/releases/download/v0.14.0/kind-linux-${ARCH}" && chmod a+x /go/bin/kind-0.14 && \
6871
GOFLAGS="" go install -v github.com/onsi/ginkgo/ginkgo@latest && \
6972
GOFLAGS="" go install -v github.com/mikefarah/yq/v4@v${YQ_VERSION} && \
7073
mkdir -p /usr/local/libexec/docker/cli-plugins && \

scripts/shared/clusters.sh

+27-9
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,31 @@
33
## Kubernetes version mapping, as supported by kind ##
44
# See the release notes of the kind version in use
55
DEFAULT_K8S_VERSION=1.23
6-
declare -A kind_k8s_versions
6+
declare -A kind_k8s_versions kind_kind_binaries
7+
# kind-0.12 hashes
78
kind_k8s_versions[1.17]=1.17.17@sha256:e477ee64df5731aa4ef4deabbafc34e8d9a686b49178f726563598344a3898d5
89
kind_k8s_versions[1.18]=1.18.20@sha256:e3dca5e16116d11363e31639640042a9b1bd2c90f85717a7fc66be34089a8169
910
kind_k8s_versions[1.19]=1.19.16@sha256:81f552397c1e6c1f293f967ecb1344d8857613fb978f963c30e907c32f598467
1011
kind_k8s_versions[1.20]=1.20.15@sha256:393bb9096c6c4d723bb17bceb0896407d7db581532d11ea2839c80b28e5d8deb
1112
kind_k8s_versions[1.21]=1.21.10@sha256:84709f09756ba4f863769bdcabe5edafc2ada72d3c8c44d6515fc581b66b029c
1213
kind_k8s_versions[1.22]=1.22.7@sha256:1dfd72d193bf7da64765fd2f2898f78663b9ba366c2aa74be1fd7498a1873166
1314
kind_k8s_versions[1.23]=1.23.4@sha256:0e34f0d0fd448aa2f2819cfd74e99fe5793a6e4938b328f657c8e3f81ee0dfb9
15+
# kind-0.14 hashes
16+
#kind_k8s_versions[1.18]=1.18.20@sha256:738cdc23ed4be6cc0b7ea277a2ebcc454c8373d7d8fb991a7fcdbd126188e6d7
17+
#kind_k8s_versions[1.19]=1.19.16@sha256:d9c819e8668de8d5030708e484a9fdff44d95ec4675d136ef0a0a584e587f65c
18+
#kind_k8s_versions[1.20]=1.20.15@sha256:6f2d011dffe182bad80b85f6c00e8ca9d86b5b8922cdf433d53575c4c5212248
19+
#kind_k8s_versions[1.21]=1.21.12@sha256:f316b33dd88f8196379f38feb80545ef3ed44d9197dca1bfd48bcb1583210207
20+
#kind_k8s_versions[1.22]=1.22.9@sha256:8135260b959dfe320206eb36b3aeda9cffcb262f4b44cda6b33f7bb73f453105
21+
#kind_k8s_versions[1.23]=1.23.6@sha256:b1fa224cc6c7ff32455e0b1fd9cbfd3d3bc87ecaa8fcb06961ed1afb3db0f9ae
22+
kind_k8s_versions[1.24]=1.24.2@sha256:a3220cefdf4f9be6681c871da35521eaaf59fadd7d509613a9e1881c5f74b587
23+
kind_kind_binaries[1.17]='kind'
24+
kind_kind_binaries[1.18]='kind'
25+
kind_kind_binaries[1.19]='kind'
26+
kind_kind_binaries[1.20]='kind'
27+
kind_kind_binaries[1.21]='kind'
28+
kind_kind_binaries[1.22]='kind'
29+
kind_kind_binaries[1.23]='kind'
30+
kind_kind_binaries[1.24]='kind-0.14'
1431

1532
## Process command line flags ##
1633

@@ -29,6 +46,7 @@ eval set -- "${FLAGS_ARGV}"
2946
k8s_version="${FLAGS_k8s_version}"
3047
olm_version="${FLAGS_olm_version}"
3148
[[ -z "${k8s_version}" ]] && k8s_version="${DEFAULT_K8S_VERSION}"
49+
kind="${kind_kind_binaries[$k8s_version]}"
3250
[[ -n "${kind_k8s_versions[$k8s_version]}" ]] && k8s_version="${kind_k8s_versions[$k8s_version]}"
3351
[[ "${FLAGS_olm}" = "${FLAGS_TRUE}" ]] && olm=true || olm=false
3452
[[ "${FLAGS_prometheus}" = "${FLAGS_TRUE}" ]] && prometheus=true || prometheus=false
@@ -37,7 +55,7 @@ olm_version="${FLAGS_olm_version}"
3755
settings="${FLAGS_settings}"
3856
timeout="${FLAGS_timeout}"
3957

40-
echo "Running with: k8s_version=${k8s_version}, olm_version=${olm_version}, olm=${olm}, globalnet=${globalnet}, prometheus=${prometheus}, registry_inmemory=${registry_inmemory}, settings=${settings}, timeout=${timeout}"
58+
echo "Running with: kind=${kind}, k8s_version=${k8s_version}, olm_version=${olm_version}, olm=${olm}, globalnet=${globalnet}, prometheus=${prometheus}, registry_inmemory=${registry_inmemory}, settings=${settings}, timeout=${timeout}"
4159

4260
set -em
4361

@@ -118,9 +136,9 @@ function create_kind_cluster() {
118136
export KUBECONFIG=${KUBECONFIGS_DIR}/kind-config-${cluster}
119137
rm -f "$KUBECONFIG"
120138

121-
if kind get clusters | grep -q "^${cluster}$"; then
139+
if ${kind} get clusters | grep -q "^${cluster}$"; then
122140
echo "KIND cluster already exists, skipping its creation..."
123-
kind export kubeconfig --name="${cluster}"
141+
${kind} export kubeconfig --name="${cluster}"
124142
kind_fixup_config
125143
return
126144
fi
@@ -137,16 +155,16 @@ function create_kind_cluster() {
137155
image_flag="--image=kindest/node:v${k8s_version}"
138156
fi
139157

140-
kind version
158+
${kind} version
141159
cat "${RESOURCES_DIR}/${cluster}-config.yaml"
142-
kind create cluster ${image_flag:+"$image_flag"} --name="${cluster}" --config="${RESOURCES_DIR}/${cluster}-config.yaml"
160+
${kind} create cluster ${image_flag:+"$image_flag"} --name="${cluster}" --config="${RESOURCES_DIR}/${cluster}-config.yaml"
143161
kind_fixup_config
144162

145163
( deploy_cluster_capabilities; ) &
146164
if ! wait $! ; then
147165
echo "Failed to deploy cluster capabilities, removing the cluster"
148166
kubectl cluster-info dump 1>&2
149-
kind delete cluster --name="${cluster}"
167+
${kind} delete cluster --name="${cluster}"
150168
return 1
151169
fi
152170
}
@@ -249,14 +267,14 @@ function deploy_kind_ovn(){
249267
( ./ovn-kubernetes/contrib/kind.sh -ov "$OVN_IMAGE" -cn "${KIND_CLUSTER_NAME}" -ric -lr -dd "${KIND_CLUSTER_NAME}.local"; ) &
250268
if ! wait $! ; then
251269
echo "Failed to install kind with OVN"
252-
kind delete cluster --name="${cluster}"
270+
${kind} delete cluster --name="${cluster}"
253271
return 1
254272
fi
255273

256274
( deploy_cluster_capabilities; ) &
257275
if ! wait $! ; then
258276
echo "Failed to deploy cluster capabilities, removing the cluster"
259-
kind delete cluster --name="${cluster}"
277+
${kind} delete cluster --name="${cluster}"
260278
return 1
261279
fi
262280
}

0 commit comments

Comments
 (0)