Skip to content

Commit 96b249c

Browse files
authored
switch kindest/node version to fix linux (#3643)
Signed-off-by: Jordan <[email protected]>
1 parent fa93866 commit 96b249c

File tree

2 files changed

+17
-4
lines changed

2 files changed

+17
-4
lines changed

Makefile

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,6 @@ endif
104104
ENVTEST_KUBE_VERSION ?= $(KUBE_MINOR).x
105105
KUBEBUILDER_ASSETS ?= $(shell $(SETUP_ENVTEST) use -p path $(KUBE_MINOR).x)
106106

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

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

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

230228
.PHONY: deploy
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/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
3+
4+
# Extract the version of kind, by removing the "${GOBIN}/kind-" prefix
5+
KIND=${KIND#${GOBIN}/kind-}
6+
7+
# Get the version of the image
8+
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]+')
9+
10+
# Compare the versions
11+
if [ "${KIND_VER}" != "${K8S_VERSION}" ]; then
12+
echo "kindest/node:${KIND_VER} version does not match k8s ${K8S_VERSION}"
13+
exit 1
14+
fi
15+
exit 0

0 commit comments

Comments
 (0)