diff --git a/demo/clusters/kind/scripts/build-kind-image.sh b/demo/clusters/kind/scripts/build-kind-image.sh index 9b8e4ce7f..361178594 100755 --- a/demo/clusters/kind/scripts/build-kind-image.sh +++ b/demo/clusters/kind/scripts/build-kind-image.sh @@ -29,6 +29,11 @@ if [ "${EXISTING_IMAGE_ID}" != "" ]; then exit 0 fi +PREBUILT_IMAGE="$( ( docker manifest inspect ${KIND_IMAGE} > /dev/null && echo "available" ) || ( echo "not-available" ) )" +if [ "${PREBUILT_IMAGE}" = "available" ] && [ "${KIND_IMAGE_BASE}" = "" ]; then + exit 0 +fi + # Create a temorary directory to hold all the artifacts we need for building the image TMP_DIR="$(mktemp -d)" cleanup() { @@ -43,5 +48,14 @@ KIND_K8S_DIR="${TMP_DIR}/kubernetes-${KIND_K8S_TAG}" # Checkout the version of kubernetes we want to build our kind image from git clone --depth 1 --branch ${KIND_K8S_TAG} ${KIND_K8S_REPO} ${KIND_K8S_DIR} -# Build the kind base image -kind build node-image --base-image "${KIND_IMAGE_BASE}" --image "${KIND_IMAGE}" "${KIND_K8S_DIR}" +# Build the kind node image. +# The default base image will be used unless it is specified using the +# KIND_BASE_IMAGE environment variable. +# This could be needed if new container runtime features are required. +# Examples are: +# gcr.io/k8s-staging-kind/base:v20240213-749005b2 +# docker.io/kindest/base:v20240202-8f1494ea +kind build node-image \ + ${KIND_IMAGE_BASE:+--base-image "${KIND_IMAGE_BASE}"} \ + --image "${KIND_IMAGE}" \ + "${KIND_K8S_DIR}" diff --git a/demo/clusters/kind/scripts/common.sh b/demo/clusters/kind/scripts/common.sh index 2398ed455..1f41090e4 100644 --- a/demo/clusters/kind/scripts/common.sh +++ b/demo/clusters/kind/scripts/common.sh @@ -37,7 +37,8 @@ DRIVER_IMAGE_VERSION=$(from_versions_mk "VERSION") # The kubernetes tag to build the kind cluster from # From https://github.com/kubernetes/kubernetes/tags -: ${KIND_K8S_TAG:="v1.27.1"} +# See also https://hub.docker.com/r/kindest/node/tags +: ${KIND_K8S_TAG:="v1.29.1"} # The name of the kind cluster to create : ${KIND_CLUSTER_NAME:="${DRIVER_NAME}-cluster"} @@ -45,8 +46,6 @@ DRIVER_IMAGE_VERSION=$(from_versions_mk "VERSION") # The path to kind's cluster configuration file : ${KIND_CLUSTER_CONFIG_PATH:="${SCRIPTS_DIR}/kind-cluster-config.yaml"} -# The derived name of the kind image to build -: ${KIND_IMAGE_BASE_TAG:="v20230515-01914134-containerd_v1.7.1"} -: ${KIND_IMAGE_BASE:="gcr.io/k8s-staging-kind/base:${KIND_IMAGE_BASE_TAG}"} -: ${KIND_IMAGE:="kindest/node:${KIND_K8S_TAG}-${KIND_IMAGE_BASE_TAG}"} +# The kind image to use. This image will be built if it is not available. +: ${KIND_IMAGE:="kindest/node:${KIND_K8S_TAG}"}