From eeac9df4e25a9db710d3dc2fcecb078dee49a569 Mon Sep 17 00:00:00 2001 From: Michael McCune Date: Fri, 7 Feb 2025 02:05:02 -0500 Subject: [PATCH] chore: add a binary makefile target (#7704) --- .gitignore | 3 +++ Makefile | 7 +++++++ 2 files changed, 10 insertions(+) diff --git a/.gitignore b/.gitignore index 459ff0ba0a8b..6f94d4d0ef5b 100644 --- a/.gitignore +++ b/.gitignore @@ -14,3 +14,6 @@ go.work.sum # Project Specific *.csv + +# Binary output +karpenter-provider-aws-* diff --git a/Makefile b/Makefile index 6bf08768fb54..2dc6e5e14009 100644 --- a/Makefile +++ b/Makefile @@ -34,6 +34,10 @@ KARPENTER_CORE_DIR = $(shell go list -m -f '{{ .Dir }}' sigs.k8s.io/karpenter) # TEST_SUITE enables you to select a specific test suite directory to run "make e2etests" against TEST_SUITE ?= "..." +# Filename when building the binary controller only +GOARCH ?= $(shell go env GOARCH) +BINARY_FILENAME = karpenter-provider-aws-$(GOARCH) + help: ## Display help @awk 'BEGIN {FS = ":.*##"; printf "Usage:\n make \033[36m\033[0m\n"} /^[a-zA-Z_0-9-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST) @@ -132,6 +136,9 @@ image: ## Build the Karpenter controller images using ko build $(eval IMG_TAG=$(shell echo $(CONTROLLER_IMG) | cut -d "@" -f 1 | cut -d ":" -f 2 -s)) $(eval IMG_DIGEST=$(shell echo $(CONTROLLER_IMG) | cut -d "@" -f 2)) +binary: ## Build the Karpenter controller binary using go build + go build $(GOFLAGS) -o $(BINARY_FILENAME) ./cmd/controller/... + apply: verify image ## Deploy the controller from the current state of your git repository into your ~/.kube/config cluster kubectl apply -f ./pkg/apis/crds/ helm upgrade --install karpenter charts/karpenter --namespace ${KARPENTER_NAMESPACE} \