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
6 changes: 2 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,6 @@ endif
ENVTEST_KUBE_VERSION ?= $(KUBE_MINOR).x
KUBEBUILDER_ASSETS ?= $(shell $(SETUP_ENVTEST) use -p path $(KUBE_MINOR).x)

# Kind node image tags are in the format x.y.z we pin to version x.y.0 because patch releases and node images
# are not guaranteed to be available when a new version of the kube apis is released
KIND_CLUSTER_IMAGE := kindest/node:v$(KUBE_MINOR).0
KIND_CLUSTER_NAME ?= kind-olmv0

# Targets #
Expand Down Expand Up @@ -224,7 +221,8 @@ kind-clean: $(KIND) #HELP Delete kind cluster $KIND_CLUSTER_NAME (default: kind-

.PHONY: kind-create
kind-create: kind-clean #HELP Create a new kind cluster $KIND_CLUSTER_NAME (default: kind-olmv0)
$(KIND) create cluster --name $(KIND_CLUSTER_NAME) --image $(KIND_CLUSTER_IMAGE) $(KIND_CREATE_OPTS)
env K8S_VERSION=v$(KUBE_MINOR) KIND=$(KIND) GOBIN=$(GOBIN) hack/tools/validate_kindest_node.sh
$(KIND) create cluster --name $(KIND_CLUSTER_NAME) $(KIND_CREATE_OPTS)
$(KIND) export kubeconfig --name $(KIND_CLUSTER_NAME)

.PHONY: deploy
Expand Down
15 changes: 15 additions & 0 deletions hack/tools/validate_kindest_node.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash
# This script verifies that the version of kind used for testing uses a major.minor version of k8s that operator-controller does

# 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]+')

# Compare the versions
if [ "${KIND_VER}" != "${K8S_VERSION}" ]; then
echo "kindest/node:${KIND_VER} version does not match k8s ${K8S_VERSION}"
exit 1
fi
exit 0