Skip to content

Commit 34a4871

Browse files
committed
bump kind to 0.25; simplify using different k8s versions for cluster
1 parent af8344b commit 34a4871

File tree

3 files changed

+75
-20
lines changed

3 files changed

+75
-20
lines changed

hack/create-test-cluster.sh

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,26 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
# Create and configure a kind cluster for running the e2e tests
16-
# Does NOT install mcad
15+
# Create and optionally configure a kind cluster for running the e2e tests
1716

1817
export ROOT_DIR="$(dirname "$(dirname "$(readlink -fn "$0")")")"
1918
CLUSTER_STARTED="false"
19+
CONFIGURE_CLUSTER=${CONFIGURE_CLUSTER:-"true"}
2020

2121
source ${ROOT_DIR}/hack/e2e-util.sh
2222

23-
update_test_host
24-
check_prerequisites
25-
pull_images
23+
if [[ "$CONFIGURE_CLUSTER" == "true" ]]
24+
then
25+
update_test_host
26+
check_prerequisites
27+
pull_images
28+
fi
29+
2630
kind_up_cluster
2731
add_virtual_GPUs
28-
configure_cluster
32+
33+
if [[ "$CONFIGURE_CLUSTER" == "true" ]]
34+
then
35+
kind_load_images
36+
configure_cluster
37+
fi

hack/e2e-util.sh

Lines changed: 60 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,9 @@
1414

1515
export LOG_LEVEL=${TEST_LOG_LEVEL:-2}
1616
export CLEANUP_CLUSTER=${CLEANUP_CLUSTER:-"true"}
17-
export CLUSTER_CONTEXT="--name test"
17+
export CLUSTER_CONTEXT=${CLUSTER_CONTEXT:-"--name test"}
1818
export KIND_OPT=${KIND_OPT:=" --config ${ROOT_DIR}/hack/kind-config.yaml"}
19+
export KIND_K8S_VERSION=${KIND_K8S_VERSION:-"1.27"}
1920
export KA_BIN=_output/bin
2021
export WAIT_TIME="20s"
2122
export KUTTL_VERSION=0.15.0
@@ -61,9 +62,9 @@ function update_test_host {
6162
which kind >/dev/null 2>&1
6263
if [ $? -ne 0 ]
6364
then
64-
# Download kind binary (0.24.0)
65-
echo "Downloading and installing kind v0.24.0...."
66-
sudo curl -o /usr/local/bin/kind -L https://github.com/kubernetes-sigs/kind/releases/download/v0.24.0/kind-linux-${arch} && \
65+
# Download kind binary (0.25.0)
66+
echo "Downloading and installing kind v0.25.0...."
67+
sudo curl -o /usr/local/bin/kind -L https://github.com/kubernetes-sigs/kind/releases/download/v0.25.0/kind-linux-${arch} && \
6768
sudo chmod +x /usr/local/bin/kind
6869
[ $? -ne 0 ] && echo "Failed to download kind" && exit 1
6970
echo "Kind was sucessfully installed."
@@ -154,15 +155,68 @@ function pull_images {
154155
}
155156

156157
function kind_up_cluster {
157-
echo "Running kind: [kind create cluster ${CLUSTER_CONTEXT} ${KIND_OPT}]"
158-
kind create cluster ${CLUSTER_CONTEXT} ${KIND_OPT} --wait ${WAIT_TIME}
158+
# Determine node image tag based on kind version and desired kubernetes version
159+
KIND_ACTUAL_VERSION=$(kind version | awk '/ /{print $2}')
160+
case $KIND_ACTUAL_VERSION in
161+
v0.25.0)
162+
case $KIND_K8S_VERSION in
163+
1.27)
164+
KIND_NODE_TAG=${KIND_NODE_TAG:="v1.27.16@sha256:2d21a61643eafc439905e18705b8186f3296384750a835ad7a005dceb9546d20"}
165+
;;
166+
1.29)
167+
KIND_NODE_TAG=${KIND_NODE_TAG:="v1.29.10@sha256:3b2d8c31753e6c8069d4fc4517264cd20e86fd36220671fb7d0a5855103aa84b"}
168+
;;
169+
1.30)
170+
KIND_NODE_TAG=${KIND_NODE_TAG:="v1.30.6@sha256:b6d08db72079ba5ae1f4a88a09025c0a904af3b52387643c285442afb05ab994"}
171+
;;
172+
1.31)
173+
KIND_NODE_TAG=${KIND_NODE_TAG:="v1.31.2@sha256:18fbefc20a7113353c7b75b5c869d7145a6abd6269154825872dc59c1329912e"}
174+
;;
175+
*)
176+
echo "Unexpected kubernetes version: $KIND_K8S__VERSION"
177+
exit 1
178+
;;
179+
esac
180+
;;
181+
182+
v0.24.0)
183+
case $KIND_K8S_VERSION in
184+
1.27)
185+
KIND_NODE_TAG=${KIND_NODE_TAG:="v1.27.16@sha256:3fd82731af34efe19cd54ea5c25e882985bafa2c9baefe14f8deab1737d9fabe"}
186+
;;
187+
1.29)
188+
KIND_NODE_TAG=${KIND_NODE_TAG:="v1.29.8@sha256:d46b7aa29567e93b27f7531d258c372e829d7224b25e3fc6ffdefed12476d3aa"}
189+
;;
190+
1.30)
191+
KIND_NODE_TAG=${KIND_NODE_TAG:="v1.30.4@sha256:976ea815844d5fa93be213437e3ff5754cd599b040946b5cca43ca45c2047114"}
192+
;;
193+
1.31)
194+
KIND_NODE_TAG=${KIND_NODE_TAG:="v1.31.0@sha256:53df588e04085fd41ae12de0c3fe4c72f7013bba32a20e7325357a1ac94ba865"}
195+
;;
196+
*)
197+
echo "Unexpected kubernetes version: $KIND_K8S__VERSION"
198+
exit 1
199+
;;
200+
esac
201+
;;
202+
203+
*)
204+
echo "Unexpected kind version: $KIND_ACTUAL_VERSION"
205+
exit 1
206+
;;
207+
esac
208+
209+
echo "Running kind: [kind create cluster ${CLUSTER_CONTEXT} --image kindest/node:${KIND_NODE_TAG} ${KIND_OPT}]"
210+
kind create cluster ${CLUSTER_CONTEXT} --image kindest/node:${KIND_NODE_TAG} ${KIND_OPT} --wait ${WAIT_TIME}
159211
if [ $? -ne 0 ]
160212
then
161213
echo "Failed to start kind cluster"
162214
exit 1
163215
fi
164216
CLUSTER_STARTED="true"
217+
}
165218

219+
function kind_load_images {
166220
for image in ${IMAGE_ECHOSERVER} ${IMAGE_BUSY_BOX_LATEST} ${IMAGE_KUBEFLOW_OPERATOR} ${IMAGE_KUBERAY_OPERATOR}
167221
do
168222
kind load docker-image ${image} ${CLUSTER_CONTEXT}

hack/kind-config.yaml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,6 @@ kind: Cluster
22
apiVersion: kind.x-k8s.io/v1alpha4
33
# 1 control plane node and 2 worker nodes
44
nodes:
5-
# the control plane node config
65
- role: control-plane
7-
# kubernetes version 1.27.17 from kind v0.24.0
8-
image: kindest/node:v1.27.17@sha256:3fd82731af34efe19cd54ea5c25e882985bafa2c9baefe14f8deab1737d9fabe
9-
# the workers
106
- role: worker
11-
# kubernetes version 1.27.17 from kind v0.24.0
12-
image: kindest/node:v1.27.17@sha256:3fd82731af34efe19cd54ea5c25e882985bafa2c9baefe14f8deab1737d9fabe
137
- role: worker
14-
# kubernetes version 1.27.17 from kind v0.24.0
15-
image: kindest/node:v1.27.17@sha256:3fd82731af34efe19cd54ea5c25e882985bafa2c9baefe14f8deab1737d9fabe

0 commit comments

Comments
 (0)