Skip to content

Commit 3ba53ce

Browse files
authored
fix: pin the E2E Kind node image to .settings.yaml (#2284)
1 parent 4130a48 commit 3ba53ce

1 file changed

Lines changed: 20 additions & 5 deletions

File tree

Makefile

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,13 @@ CTLPTL_CONFIG_FILE = .ctlptl.yaml
3434
REGISTRY_PORT = 5001
3535
REGISTRY_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
3845
all: 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)
854873
ifeq ($(KWOK_VERSION),)
855874
KWOK_VERSION := v0.7.0
856875
endif
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
861876
CTLPTL_KWOK_CONFIG_FILE := .ctlptl-kwok.yaml
862877

863878
.PHONY: kwok-cluster

0 commit comments

Comments
 (0)