Skip to content

Commit

Permalink
bump kind to 0.25; simplify using different k8s versions for cluster
Browse files Browse the repository at this point in the history
  • Loading branch information
dgrove-oss committed Nov 11, 2024
1 parent af8344b commit cd83274
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 15 deletions.
23 changes: 23 additions & 0 deletions hack/create-kind-cluster.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash

# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# Create a kind cluster without loading images or installing operators

export ROOT_DIR="$(dirname "$(dirname "$(readlink -fn "$0")")")"
CLUSTER_STARTED="false"

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

kind_up_cluster
add_virtual_GPUs
1 change: 0 additions & 1 deletion hack/create-test-cluster.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
# limitations under the License.

# Create and configure a kind cluster for running the e2e tests
# Does NOT install mcad

export ROOT_DIR="$(dirname "$(dirname "$(readlink -fn "$0")")")"
CLUSTER_STARTED="false"
Expand Down
33 changes: 27 additions & 6 deletions hack/e2e-util.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@

export LOG_LEVEL=${TEST_LOG_LEVEL:-2}
export CLEANUP_CLUSTER=${CLEANUP_CLUSTER:-"true"}
export CLUSTER_CONTEXT="--name test"
export CLUSTER_CONTEXT=${CLUSTER_CONTEXT:-"--name test"}
export KIND_OPT=${KIND_OPT:=" --config ${ROOT_DIR}/hack/kind-config.yaml"}
export KIND_K8S_VERSION=${KIND_K8S_VERSION:-"1.27"}
export KA_BIN=_output/bin
export WAIT_TIME="20s"
export KUTTL_VERSION=0.15.0
Expand Down Expand Up @@ -61,9 +62,9 @@ function update_test_host {
which kind >/dev/null 2>&1
if [ $? -ne 0 ]
then
# Download kind binary (0.24.0)
echo "Downloading and installing kind v0.24.0...."
sudo curl -o /usr/local/bin/kind -L https://github.com/kubernetes-sigs/kind/releases/download/v0.24.0/kind-linux-${arch} && \
# Download kind binary (0.25.0)
echo "Downloading and installing kind v0.25.0...."
sudo curl -o /usr/local/bin/kind -L https://github.com/kubernetes-sigs/kind/releases/download/v0.25.0/kind-linux-${arch} && \
sudo chmod +x /usr/local/bin/kind
[ $? -ne 0 ] && echo "Failed to download kind" && exit 1
echo "Kind was sucessfully installed."
Expand Down Expand Up @@ -154,15 +155,34 @@ function pull_images {
}

function kind_up_cluster {
echo "Running kind: [kind create cluster ${CLUSTER_CONTEXT} ${KIND_OPT}]"
kind create cluster ${CLUSTER_CONTEXT} ${KIND_OPT} --wait ${WAIT_TIME}
case $KIND_K8S_VERSION in
1.27)
KIND_NODE_TAG=${KIND_NODE_TAG:="v1.27.16@sha256:2d21a61643eafc439905e18705b8186f3296384750a835ad7a005dceb9546d20"}
;;
1.29)
KIND_NODE_TAG=${KIND_NODE_TAG:="v1.29.10@sha256:3b2d8c31753e6c8069d4fc4517264cd20e86fd36220671fb7d0a5855103aa84b"}
;;
1.30)
KIND_NODE_TAG=${KIND_NODE_TAG:="v1.30.6@sha256:b6d08db72079ba5ae1f4a88a09025c0a904af3b52387643c285442afb05ab994"}
;;
1.31)
KIND_NODE_TAG=${KIND_NODE_TAG:="v1.31.2@sha256:18fbefc20a7113353c7b75b5c869d7145a6abd6269154825872dc59c1329912e"}
;;
*)
echo "Unexpected kubernetes version: $KIND_K8S__VERSION"
exit 1
esac
echo "Running kind: [kind create cluster ${CLUSTER_CONTEXT} --image kindest/node:${KIND_NODE_TAG} ${KIND_OPT}]"
kind create cluster ${CLUSTER_CONTEXT} --image kindest/node:${KIND_NODE_TAG} ${KIND_OPT} --wait ${WAIT_TIME}
if [ $? -ne 0 ]
then
echo "Failed to start kind cluster"
exit 1
fi
CLUSTER_STARTED="true"
}

function kind_load_images {
for image in ${IMAGE_ECHOSERVER} ${IMAGE_BUSY_BOX_LATEST} ${IMAGE_KUBEFLOW_OPERATOR} ${IMAGE_KUBERAY_OPERATOR}
do
kind load docker-image ${image} ${CLUSTER_CONTEXT}
Expand All @@ -174,6 +194,7 @@ function kind_up_cluster {
done
}


function configure_cluster {
echo "Installing Kubeflow operator version $KUBEFLOW_VERSION"
kubectl apply -k "github.com/kubeflow/training-operator/manifests/overlays/standalone?ref=$KUBEFLOW_VERSION"
Expand Down
8 changes: 0 additions & 8 deletions hack/kind-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,6 @@ kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
# 1 control plane node and 2 worker nodes
nodes:
# the control plane node config
- role: control-plane
# kubernetes version 1.27.17 from kind v0.24.0
image: kindest/node:v1.27.17@sha256:3fd82731af34efe19cd54ea5c25e882985bafa2c9baefe14f8deab1737d9fabe
# the workers
- role: worker
# kubernetes version 1.27.17 from kind v0.24.0
image: kindest/node:v1.27.17@sha256:3fd82731af34efe19cd54ea5c25e882985bafa2c9baefe14f8deab1737d9fabe
- role: worker
# kubernetes version 1.27.17 from kind v0.24.0
image: kindest/node:v1.27.17@sha256:3fd82731af34efe19cd54ea5c25e882985bafa2c9baefe14f8deab1737d9fabe

0 comments on commit cd83274

Please sign in to comment.