@@ -34,6 +34,13 @@ CTLPTL_CONFIG_FILE = .ctlptl.yaml
3434REGISTRY_PORT = 5001
3535REGISTRY_NAME = ctlptl-registry
3636
37+ # Kind node image (single source of truth: .settings.yaml testing.kind_node_image).
38+ # .ctlptl.yaml intentionally does not hardcode this — cluster-create injects it so
39+ # local dev and CI can never pin a second, drifting copy of the version. No
40+ # hardcoded fallback here: cluster-create fails closed on an empty read
41+ # instead of silently degrading to a stale image (see its yq-missing check).
42+ KIND_NODE_IMAGE ?= $(shell yq -r '.testing.kind_node_image' .settings.yaml 2>/dev/null)
43+
3744# Default target
3845all : help
3946
@@ -819,7 +826,19 @@ cluster-create: ## Creates local Kind cluster with registry
819826 echo " or: go install sigs.k8s.io/kind@latest" ; \
820827 exit 1; \
821828 fi
822- ctlptl apply -f $(CTLPTL_CONFIG_FILE )
829+ @if ! command -v yq > /dev/null 2>&1 ; then \
830+ echo " Error: yq is not installed." ; \
831+ echo " Install: brew install yq" ; \
832+ echo " or: go install github.com/mikefarah/yq/v4@latest" ; \
833+ exit 1; \
834+ fi
835+ @if [ -z " $( KIND_NODE_IMAGE) " ]; then \
836+ echo " Error: could not resolve testing.kind_node_image from .settings.yaml." ; \
837+ echo " Check the key exists and .settings.yaml is valid YAML." ; \
838+ exit 1; \
839+ fi
840+ @echo " Pinning Kind node image: $( KIND_NODE_IMAGE) (from .settings.yaml)"
841+ img=" $( KIND_NODE_IMAGE) " yq eval-all ' (select(.kind == "Cluster") | .kindV1Alpha4Cluster.nodes[]).image = strenv(img)' $(CTLPTL_CONFIG_FILE ) | ctlptl apply -f -
823842 @echo " Waiting for nodes to be ready..."
824843 @kubectl wait --for=condition=ready nodes --all --timeout=300s
825844 @echo " Cluster created. Registry at localhost:$( REGISTRY_PORT) "
@@ -854,10 +873,6 @@ KWOK_VERSION ?= $(shell yq -r '.testing_tools.kwok' .settings.yaml 2>/dev/null)
854873ifeq ($(KWOK_VERSION ) ,)
855874KWOK_VERSION := v0.7.0
856875endif
857- KIND_NODE_IMAGE ?= $(shell yq -r '.testing.kind_node_image' .settings.yaml 2>/dev/null)
858- ifeq ($(KIND_NODE_IMAGE ) ,)
859- KIND_NODE_IMAGE := kindest/node:v1.32.0
860- endif
861876CTLPTL_KWOK_CONFIG_FILE := .ctlptl-kwok.yaml
862877
863878.PHONY : kwok-cluster
0 commit comments