Skip to content

Commit f766d61

Browse files
feat: prioritize global kind binary over BINGO-managed version
Motivation: This change respects developers' environments and preferences by prioritizing their global setup when kind creates and manages local Kubernetes clusters using Docker container 'nodes' Usage: kind [command] Available Commands: build Build one of [node-image] completion Output shell completion code for the specified shell (bash, zsh or fish) create Creates one of [cluster] delete Deletes one of [cluster] export Exports one of [kubeconfig, logs] get Gets one of [clusters, nodes, kubeconfig] help Help about any command load Loads images into nodes version Prints the kind CLI version Flags: -h, --help help for kind --loglevel string DEPRECATED: see -v instead -q, --quiet silence all stderr output -v, --verbosity int32 info log verbosity, higher value produces more output --version version for kind Use "kind [command] --help" for more information about a command. is already installed. It avoids unnecessary installations and aligns with the principle of minimizing interference in local development environments, enhancing flexibility and user experience.
1 parent e5820ae commit f766d61

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

.bingo/Variables.mk

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ BINGO_DIR := $(dir $(lastword $(MAKEFILE_LIST)))
44
GOPATH ?= $(shell go env GOPATH)
55
GOBIN ?= $(firstword $(subst :, ,${GOPATH}))/bin
66
GO ?= $(shell which go)
7+
LOCAL_KIND := $(shell command -v kind || echo "")
78

89
# Below generated variables ensure that every time a tool under each variable is invoked, the correct version
910
# will be used; reinstalling only if needed.
@@ -47,11 +48,18 @@ $(GORELEASER): $(BINGO_DIR)/goreleaser.mod
4748
@echo "(re)installing $(GOBIN)/goreleaser-v1.26.2"
4849
@cd $(BINGO_DIR) && GOWORK=off $(GO) build -mod=mod -modfile=goreleaser.mod -o=$(GOBIN)/goreleaser-v1.26.2 "github.com/goreleaser/goreleaser"
4950

50-
KIND := $(GOBIN)/kind-v0.24.0
51-
$(KIND): $(BINGO_DIR)/kind.mod
52-
@# Install binary/ries using Go 1.14+ build command. This is using bwplotka/bingo-controlled, separate go module with pinned dependencies.
53-
@echo "(re)installing $(GOBIN)/kind-v0.24.0"
54-
@cd $(BINGO_DIR) && GOWORK=off $(GO) build -mod=mod -modfile=kind.mod -o=$(GOBIN)/kind-v0.24.0 "sigs.k8s.io/kind"
51+
GLOBAL_KIND := $(shell command -v kind || echo "")
52+
# Use global kind if available; otherwise, fall back to BINGO-managed kind.
53+
KIND := $(if $(GLOBAL_KIND),$(GLOBAL_KIND),$(GOBIN)/kind-v0.24.0)
54+
55+
# Define the BINGO-managed kind target only if no global kind is found.
56+
$(GOBIN)/kind-v0.24.0: $(BINGO_DIR)/kind.mod
57+
@if [ -z "$(GLOBAL_KIND)" ]; then \
58+
echo "(re)installing $(GOBIN)/kind-v0.24.0 via BINGO..."; \
59+
cd $(BINGO_DIR) && GOWORK=off $(GO) build -mod=mod -modfile=kind.mod -o=$(GOBIN)/kind-v0.24.0 "sigs.k8s.io/kind"; \
60+
else \
61+
echo "Global kind found at $(GLOBAL_KIND). Skipping BINGO installation."; \
62+
fi
5563

5664
KUSTOMIZE := $(GOBIN)/kustomize-v4.5.7
5765
$(KUSTOMIZE): $(BINGO_DIR)/kustomize.mod

0 commit comments

Comments
 (0)