Skip to content
Merged
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
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ kind-clean: $(KIND) #EXHELP Delete the kind cluster.
$(KIND) delete cluster --name $(KIND_CLUSTER_NAME)

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


Expand Down
20 changes: 18 additions & 2 deletions hack/tools/validate_kindest_node.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,24 @@
# Extract the version of kind, by removing the "${GOBIN}/kind-" prefix
KIND=${KIND#${GOBIN}/kind-}

# Get the version of the image
KIND_VER=$(curl -L -s https://github.com/kubernetes-sigs/kind/raw/refs/tags/${KIND}/pkg/apis/config/defaults/image.go | grep -Eo 'v[0-9]+\.[0-9]+')
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)
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
Comment on lines +16 to +19
Copy link
Contributor

Choose a reason for hiding this comment

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

is there a situation when we cannot resolve KIND_VER from the local cache? Can we remove this actually?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the original check that broke when github was down yesterday. It's possible someone may have cleaned up their local cache, so I'd rather just leave it as a "just-in-case".


if [ -z "${KIND_VER}" ]; then
echo "Unable to determine kindest/node version"
exit 1
fi

# Compare the versions
if [ "${KIND_VER}" != "${K8S_VERSION}" ]; then
Expand Down