Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .bingo/Variables.mk
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,11 @@ $(HELM): $(BINGO_DIR)/helm.mod
@echo "(re)installing $(GOBIN)/helm-v3.18.4"
@cd $(BINGO_DIR) && GOWORK=off $(GO) build -mod=mod -modfile=helm.mod -o=$(GOBIN)/helm-v3.18.4 "helm.sh/helm/v3/cmd/helm"

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

KUBE_SCORE := $(GOBIN)/kube-score-v1.20.0
$(KUBE_SCORE): $(BINGO_DIR)/kube-score.mod
Expand Down
2 changes: 1 addition & 1 deletion .bingo/kind.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ module _ // Auto generated by https://github.com/bwplotka/bingo. DO NOT EDIT

go 1.24.6

require sigs.k8s.io/kind v0.31.0
require sigs.k8s.io/kind v0.32.0
2 changes: 2 additions & 0 deletions .bingo/kind.sum
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,7 @@ sigs.k8s.io/kind v0.30.0 h1:2Xi1KFEfSMm0XDcvKnUt15ZfgRPCT0OnCBbpgh8DztY=
sigs.k8s.io/kind v0.30.0/go.mod h1:FSqriGaoTPruiXWfRnUXNykF8r2t+fHtK0P0m1AbGF8=
sigs.k8s.io/kind v0.31.0 h1:UcT4nzm+YM7YEbqiAKECk+b6dsvc/HRZZu9U0FolL1g=
sigs.k8s.io/kind v0.31.0/go.mod h1:FSqriGaoTPruiXWfRnUXNykF8r2t+fHtK0P0m1AbGF8=
sigs.k8s.io/kind v0.32.0 h1:p9hscbj98u/qyrjVpjId86LI70nQmbSsipV7wCG10Xk=
sigs.k8s.io/kind v0.32.0/go.mod h1:FSqriGaoTPruiXWfRnUXNykF8r2t+fHtK0P0m1AbGF8=
sigs.k8s.io/yaml v1.4.0 h1:Mk1wCc2gy/F0THH0TAp1QYyJNzRm2KCLy3o5ASXVI5E=
sigs.k8s.io/yaml v1.4.0/go.mod h1:Ejl7/uTz7PSA4eKMyQCUTnhZYNmLIl+5c2lQPGR2BPY=
2 changes: 1 addition & 1 deletion .bingo/variables.env
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ GORELEASER="${GOBIN}/goreleaser-v2.11.2"

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

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

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

Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/tilt.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ jobs:
run: |
cd operator-controller
make kind-cluster
# Symlink bingo-managed kind binary so tilt can find it as 'kind'
ln -sf "$(make --no-print-directory --eval='print-kind: ; @echo $(KIND)' print-kind)" /usr/local/bin/kind
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a bit leery on this. However, it's a github workflow, so it won't impact someone's environment.

Is there no way to tell tilt to use kind-v0.32.0 vs kind?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tilt hardcodes exec.Command("kind", "load", ...) in its source — there's no configuration option to specify a different binary name. The symlink is CI-only and doesn't affect anyone's local environment. The alternative would be installing kind without the version suffix, but that conflicts with how bingo manages tool versions.

- name: Test Tilt
run: |
cd operator-controller
Expand Down
19 changes: 13 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -444,20 +444,27 @@ kind-deploy-experimental: manifests
cp $(CATALOGS_MANIFEST) $(DEFAULT_CATALOG)
envsubst '$$DEFAULT_CATALOG,$$CERT_MGR_VERSION,$$INSTALL_DEFAULT_CATALOGS,$$MANIFEST' < scripts/install.tpl.sh | bash -s

VALIDATE_KINDEST_NODE_SCRIPT := hack/tools/validate_kindest_node.sh

.PHONY: kind-cluster
kind-cluster: $(KIND) kind-verify-versions #EXHELP Standup a kind cluster.
-$(KIND) delete cluster --name $(KIND_CLUSTER_NAME)
$(KIND) create cluster --name $(KIND_CLUSTER_NAME) --config $(KIND_CONFIG)
$(KIND) export kubeconfig --name $(KIND_CLUSTER_NAME)
kind-cluster: $(KIND) #EXHELP Standup a kind cluster.
@KIND_NODE_IMAGE=$$(K8S_VERSION=$(K8S_VERSION) $(VALIDATE_KINDEST_NODE_SCRIPT)) || exit 1; \
$(KIND) delete cluster --name $(KIND_CLUSTER_NAME) 2>/dev/null || true; \
$(KIND) create cluster --name $(KIND_CLUSTER_NAME) --config $(KIND_CONFIG) --image "$$KIND_NODE_IMAGE"; \
$(KIND) export kubeconfig --name $(KIND_CLUSTER_NAME); \
kubectl wait --for=condition=Ready nodes --all --timeout=2m

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

.PHONY: kind-verify-versions
kind-verify-versions: $(KIND)
env K8S_VERSION=v$(K8S_VERSION) KIND=$(KIND) GOBIN=$(GOBIN) hack/tools/validate_kindest_node.sh
kind-verify-versions:
@K8S_VERSION=$(K8S_VERSION) $(VALIDATE_KINDEST_NODE_SCRIPT) > /dev/null

.PHONY: kind-update-images
kind-update-images: $(KIND) #EXHELP Regenerate the kindest/node image map in validate_kindest_node.sh.
hack/tools/update-kind-images.sh $(KIND)


#SECTION Build
Expand Down
47 changes: 47 additions & 0 deletions hack/tools/update-kind-images.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#!/bin/bash
set -euo pipefail
# Regenerates the KIND_IMAGES block in validate_kindest_node.sh
# by fetching released kindest/node images from the kind GitHub release.
#
# Usage: update-kind-images.sh <kind-binary>

SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
VALIDATE_SCRIPT="${SCRIPT_DIR}/validate_kindest_node.sh"

KIND="${1:?Usage: $0 <kind-binary>}"

KIND_VER=$(${KIND} version | grep -oE 'v[0-9]+\.[0-9]+\.[0-9]+' || true)
if [ -z "${KIND_VER}" ]; then
echo "Error: could not determine kind version." >&2
exit 1
fi

echo "Fetching kindest/node images for kind ${KIND_VER}..."
RELEASE_BODY=$(curl -sfL "https://api.github.com/repos/kubernetes-sigs/kind/releases/tags/${KIND_VER}")
IMAGES=$(echo "${RELEASE_BODY}" | grep -oE 'kindest/node:v[0-9]+\.[0-9]+\.[0-9]+' | sort -u || true)
if [ -z "${IMAGES}" ]; then
echo "Error: no kindest/node images found for kind ${KIND_VER}." >&2
exit 1
fi
Comment on lines +19 to +25

TMP=$(mktemp)
trap 'rm -f "${TMP}"' EXIT

awk -v ver="${KIND_VER}" -v images="${IMAGES}" \
'BEGIN{in_block=0}
/^# --- BEGIN KIND IMAGES ---/{print; in_block=1;
print "# kind " ver
print "case \"${K8S_MINOR}\" in"
n=split(images,a,"\n")
for(i=1;i<=n;i++){if(a[i]=="")continue
minor=a[i]; sub(/.*:v/,"",minor); sub(/\.[0-9]+$/,"",minor)
print " " minor ") IMAGE=\"" a[i] "\" ;;"}
print " *) IMAGE=\"\" ;;"
print "esac"; next}
/^# --- END KIND IMAGES ---/{in_block=0; print; next}
in_block{next}
{print}' "${VALIDATE_SCRIPT}" > "${TMP}"

mv "${TMP}" "${VALIDATE_SCRIPT}"
chmod +x "${VALIDATE_SCRIPT}"
echo "Updated ${VALIDATE_SCRIPT} with images for kind ${KIND_VER}"
44 changes: 21 additions & 23 deletions hack/tools/validate_kindest_node.sh
Original file line number Diff line number Diff line change
@@ -1,31 +1,29 @@
#!/bin/bash
# This script verifies that the version of kind used for testing uses a major.minor version of k8s that operator-controller does
set -euo pipefail
# Outputs the kindest/node image for the given K8S_VERSION.
# The KIND_IMAGES block below is regenerated by `make kind-update-images`.

# Extract the version of kind, by removing the "${GOBIN}/kind-" prefix
KIND=${KIND#${GOBIN}/kind-}

GOMODCACHE=$(go env GOMODCACHE)

REGEX='v[0-9]+\.[0-9]+'

# Get the version of the image from the local kind build
if [ -d "${GOMODCACHE}" ]; then
KIND_VER=$(grep -Eo "${REGEX}" ${GOMODCACHE}/sigs.k8s.io/kind@${KIND}/pkg/apis/config/defaults/image.go)
if [ -z "${K8S_VERSION:-}" ]; then
echo "Error: K8S_VERSION is not set." >&2
exit 1
fi

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

if [ -z "${KIND_VER}" ]; then
echo "Unable to determine kindest/node version"
exit 1
fi
# --- BEGIN KIND IMAGES ---
# kind v0.32.0
case "${K8S_MINOR}" in
1.33) IMAGE="kindest/node:v1.33.12" ;;
1.34) IMAGE="kindest/node:v1.34.8" ;;
1.35) IMAGE="kindest/node:v1.35.5" ;;
1.36) IMAGE="kindest/node:v1.36.1" ;;
*) IMAGE="" ;;
esac
# --- END KIND IMAGES ---

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