Skip to content

Commit 313b2c6

Browse files
authored
🌱 Bump kind to v0.32.0 and rework kindest/node image selection (#2744)
Bump kind from v0.31.0 to v0.32.0. Rework validate_kindest_node.sh to embed all released kindest/node images for the pinned kind version (as a case statement), rather than checking strict equality against kind's default image. This allows kind to be bumped independently of k8s dependency upgrades, since kind v0.32.0 supports k8s 1.33 through 1.36. The script now outputs the correct kindest/node image for the project's K8S_VERSION, and kind-cluster passes it via --image. A new make target `kind-update-images` regenerates the image map by querying the kind GitHub release. The tilt CI workflow is updated to symlink the bingo-managed kind binary as `kind` on the PATH, so tilt's `kind load` calls use the correct version.
1 parent ef1f979 commit 313b2c6

8 files changed

Lines changed: 90 additions & 34 deletions

File tree

.bingo/Variables.mk

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,11 @@ $(HELM): $(BINGO_DIR)/helm.mod
6565
@echo "(re)installing $(GOBIN)/helm-v3.18.4"
6666
@cd $(BINGO_DIR) && GOWORK=off $(GO) build -mod=mod -modfile=helm.mod -o=$(GOBIN)/helm-v3.18.4 "helm.sh/helm/v3/cmd/helm"
6767

68-
KIND := $(GOBIN)/kind-v0.31.0
68+
KIND := $(GOBIN)/kind-v0.32.0
6969
$(KIND): $(BINGO_DIR)/kind.mod
7070
@# Install binary/ries using Go 1.14+ build command. This is using bwplotka/bingo-controlled, separate go module with pinned dependencies.
71-
@echo "(re)installing $(GOBIN)/kind-v0.31.0"
72-
@cd $(BINGO_DIR) && GOWORK=off $(GO) build -mod=mod -modfile=kind.mod -o=$(GOBIN)/kind-v0.31.0 "sigs.k8s.io/kind"
71+
@echo "(re)installing $(GOBIN)/kind-v0.32.0"
72+
@cd $(BINGO_DIR) && GOWORK=off $(GO) build -mod=mod -modfile=kind.mod -o=$(GOBIN)/kind-v0.32.0 "sigs.k8s.io/kind"
7373

7474
KUBE_SCORE := $(GOBIN)/kube-score-v1.20.0
7575
$(KUBE_SCORE): $(BINGO_DIR)/kube-score.mod

.bingo/kind.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ module _ // Auto generated by https://github.com/bwplotka/bingo. DO NOT EDIT
22

33
go 1.24.6
44

5-
require sigs.k8s.io/kind v0.31.0
5+
require sigs.k8s.io/kind v0.32.0

.bingo/kind.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,7 @@ sigs.k8s.io/kind v0.30.0 h1:2Xi1KFEfSMm0XDcvKnUt15ZfgRPCT0OnCBbpgh8DztY=
3131
sigs.k8s.io/kind v0.30.0/go.mod h1:FSqriGaoTPruiXWfRnUXNykF8r2t+fHtK0P0m1AbGF8=
3232
sigs.k8s.io/kind v0.31.0 h1:UcT4nzm+YM7YEbqiAKECk+b6dsvc/HRZZu9U0FolL1g=
3333
sigs.k8s.io/kind v0.31.0/go.mod h1:FSqriGaoTPruiXWfRnUXNykF8r2t+fHtK0P0m1AbGF8=
34+
sigs.k8s.io/kind v0.32.0 h1:p9hscbj98u/qyrjVpjId86LI70nQmbSsipV7wCG10Xk=
35+
sigs.k8s.io/kind v0.32.0/go.mod h1:FSqriGaoTPruiXWfRnUXNykF8r2t+fHtK0P0m1AbGF8=
3436
sigs.k8s.io/yaml v1.4.0 h1:Mk1wCc2gy/F0THH0TAp1QYyJNzRm2KCLy3o5ASXVI5E=
3537
sigs.k8s.io/yaml v1.4.0/go.mod h1:Ejl7/uTz7PSA4eKMyQCUTnhZYNmLIl+5c2lQPGR2BPY=

.bingo/variables.env

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ GORELEASER="${GOBIN}/goreleaser-v2.11.2"
2424

2525
HELM="${GOBIN}/helm-v3.18.4"
2626

27-
KIND="${GOBIN}/kind-v0.31.0"
27+
KIND="${GOBIN}/kind-v0.32.0"
2828

2929
KUBE_SCORE="${GOBIN}/kube-score-v1.20.0"
3030

.github/workflows/tilt.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ jobs:
3333
run: |
3434
cd operator-controller
3535
make kind-cluster
36+
# Symlink bingo-managed kind binary so tilt can find it as 'kind'
37+
ln -sf "$(make --no-print-directory --eval='print-kind: ; @echo $(KIND)' print-kind)" /usr/local/bin/kind
3638
- name: Test Tilt
3739
run: |
3840
cd operator-controller

Makefile

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -444,20 +444,27 @@ kind-deploy-experimental: manifests
444444
cp $(CATALOGS_MANIFEST) $(DEFAULT_CATALOG)
445445
envsubst '$$DEFAULT_CATALOG,$$CERT_MGR_VERSION,$$INSTALL_DEFAULT_CATALOGS,$$MANIFEST' < scripts/install.tpl.sh | bash -s
446446

447+
VALIDATE_KINDEST_NODE_SCRIPT := hack/tools/validate_kindest_node.sh
448+
447449
.PHONY: kind-cluster
448-
kind-cluster: $(KIND) kind-verify-versions #EXHELP Standup a kind cluster.
449-
-$(KIND) delete cluster --name $(KIND_CLUSTER_NAME)
450-
$(KIND) create cluster --name $(KIND_CLUSTER_NAME) --config $(KIND_CONFIG)
451-
$(KIND) export kubeconfig --name $(KIND_CLUSTER_NAME)
450+
kind-cluster: $(KIND) #EXHELP Standup a kind cluster.
451+
@KIND_NODE_IMAGE=$$(K8S_VERSION=$(K8S_VERSION) $(VALIDATE_KINDEST_NODE_SCRIPT)) || exit 1; \
452+
$(KIND) delete cluster --name $(KIND_CLUSTER_NAME) 2>/dev/null || true; \
453+
$(KIND) create cluster --name $(KIND_CLUSTER_NAME) --config $(KIND_CONFIG) --image "$$KIND_NODE_IMAGE"; \
454+
$(KIND) export kubeconfig --name $(KIND_CLUSTER_NAME); \
452455
kubectl wait --for=condition=Ready nodes --all --timeout=2m
453456

454457
.PHONY: kind-clean
455458
kind-clean: $(KIND) #EXHELP Delete the kind cluster.
456459
$(KIND) delete cluster --name $(KIND_CLUSTER_NAME)
457460

458461
.PHONY: kind-verify-versions
459-
kind-verify-versions: $(KIND)
460-
env K8S_VERSION=v$(K8S_VERSION) KIND=$(KIND) GOBIN=$(GOBIN) hack/tools/validate_kindest_node.sh
462+
kind-verify-versions:
463+
@K8S_VERSION=$(K8S_VERSION) $(VALIDATE_KINDEST_NODE_SCRIPT) > /dev/null
464+
465+
.PHONY: kind-update-images
466+
kind-update-images: $(KIND) #EXHELP Regenerate the kindest/node image map in validate_kindest_node.sh.
467+
hack/tools/update-kind-images.sh $(KIND)
461468

462469

463470
#SECTION Build

hack/tools/update-kind-images.sh

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
#!/bin/bash
2+
set -euo pipefail
3+
# Regenerates the KIND_IMAGES block in validate_kindest_node.sh
4+
# by fetching released kindest/node images from the kind GitHub release.
5+
#
6+
# Usage: update-kind-images.sh <kind-binary>
7+
8+
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
9+
VALIDATE_SCRIPT="${SCRIPT_DIR}/validate_kindest_node.sh"
10+
11+
KIND="${1:?Usage: $0 <kind-binary>}"
12+
13+
KIND_VER=$(${KIND} version | grep -oE 'v[0-9]+\.[0-9]+\.[0-9]+' || true)
14+
if [ -z "${KIND_VER}" ]; then
15+
echo "Error: could not determine kind version." >&2
16+
exit 1
17+
fi
18+
19+
echo "Fetching kindest/node images for kind ${KIND_VER}..."
20+
RELEASE_BODY=$(curl -sfL "https://api.github.com/repos/kubernetes-sigs/kind/releases/tags/${KIND_VER}")
21+
IMAGES=$(echo "${RELEASE_BODY}" | grep -oE 'kindest/node:v[0-9]+\.[0-9]+\.[0-9]+' | sort -u || true)
22+
if [ -z "${IMAGES}" ]; then
23+
echo "Error: no kindest/node images found for kind ${KIND_VER}." >&2
24+
exit 1
25+
fi
26+
27+
TMP=$(mktemp)
28+
trap 'rm -f "${TMP}"' EXIT
29+
30+
awk -v ver="${KIND_VER}" -v images="${IMAGES}" \
31+
'BEGIN{in_block=0}
32+
/^# --- BEGIN KIND IMAGES ---/{print; in_block=1;
33+
print "# kind " ver
34+
print "case \"${K8S_MINOR}\" in"
35+
n=split(images,a,"\n")
36+
for(i=1;i<=n;i++){if(a[i]=="")continue
37+
minor=a[i]; sub(/.*:v/,"",minor); sub(/\.[0-9]+$/,"",minor)
38+
print " " minor ") IMAGE=\"" a[i] "\" ;;"}
39+
print " *) IMAGE=\"\" ;;"
40+
print "esac"; next}
41+
/^# --- END KIND IMAGES ---/{in_block=0; print; next}
42+
in_block{next}
43+
{print}' "${VALIDATE_SCRIPT}" > "${TMP}"
44+
45+
mv "${TMP}" "${VALIDATE_SCRIPT}"
46+
chmod +x "${VALIDATE_SCRIPT}"
47+
echo "Updated ${VALIDATE_SCRIPT} with images for kind ${KIND_VER}"
Lines changed: 21 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,29 @@
11
#!/bin/bash
2-
# This script verifies that the version of kind used for testing uses a major.minor version of k8s that operator-controller does
2+
set -euo pipefail
3+
# Outputs the kindest/node image for the given K8S_VERSION.
4+
# The KIND_IMAGES block below is regenerated by `make kind-update-images`.
35

4-
# Extract the version of kind, by removing the "${GOBIN}/kind-" prefix
5-
KIND=${KIND#${GOBIN}/kind-}
6-
7-
GOMODCACHE=$(go env GOMODCACHE)
8-
9-
REGEX='v[0-9]+\.[0-9]+'
10-
11-
# Get the version of the image from the local kind build
12-
if [ -d "${GOMODCACHE}" ]; then
13-
KIND_VER=$(grep -Eo "${REGEX}" ${GOMODCACHE}/sigs.k8s.io/kind@${KIND}/pkg/apis/config/defaults/image.go)
6+
if [ -z "${K8S_VERSION:-}" ]; then
7+
echo "Error: K8S_VERSION is not set." >&2
8+
exit 1
149
fi
1510

16-
# Get the version of the image from github
17-
if [ -z "${KIND_VER}" ]; then
18-
KIND_VER=$(curl -L -s https://github.com/kubernetes-sigs/kind/raw/refs/tags/${KIND}/pkg/apis/config/defaults/image.go | grep -Eo "${REGEX}")
19-
fi
11+
K8S_MINOR=$(echo "${K8S_VERSION}" | sed -E 's/^v?([0-9]+\.[0-9]+).*/\1/')
2012

21-
if [ -z "${KIND_VER}" ]; then
22-
echo "Unable to determine kindest/node version"
23-
exit 1
24-
fi
13+
# --- BEGIN KIND IMAGES ---
14+
# kind v0.32.0
15+
case "${K8S_MINOR}" in
16+
1.33) IMAGE="kindest/node:v1.33.12" ;;
17+
1.34) IMAGE="kindest/node:v1.34.8" ;;
18+
1.35) IMAGE="kindest/node:v1.35.5" ;;
19+
1.36) IMAGE="kindest/node:v1.36.1" ;;
20+
*) IMAGE="" ;;
21+
esac
22+
# --- END KIND IMAGES ---
2523

26-
# Compare the versions
27-
if [ "${KIND_VER}" != "${K8S_VERSION}" ]; then
28-
echo "kindest/node:${KIND_VER} version does not match k8s ${K8S_VERSION}"
24+
if [ -z "${IMAGE}" ]; then
25+
echo "Error: no kindest/node image for k8s ${K8S_MINOR}." >&2
26+
echo "Run 'make kind-update-images' after bumping kind." >&2
2927
exit 1
3028
fi
31-
exit 0
29+
echo "${IMAGE}"

0 commit comments

Comments
 (0)