@@ -2,9 +2,17 @@ PROJECT_DIR := $(shell dirname $(abspath $(lastword $(MAKEFILE_LIST))))
2
2
CONTROLLER_GEN = $(PROJECT_DIR ) /bin/controller-gen
3
3
KO = $(PROJECT_DIR ) /bin/ko
4
4
ENVTEST = $(PROJECT_DIR ) /bin/setup-envtest
5
+ TOOLCHAIN = \
6
+ $(CONTROLLER_GEN ) \
7
+ $(KO ) \
8
+ $(ENVTEST )
5
9
HELM_BASE_OPTS ?= --set serviceAccount.annotations.eks\\.amazonaws\\.com/role-arn=${NTHV2_IAM_ROLE_ARN}
6
10
GINKGO_BASE_OPTS ?= --coverpkg $(shell head -n 1 $(PROJECT_DIR ) /go.mod | cut -s -d ' ' -f 2) /pkg/...
7
-
11
+ KODATA = \
12
+ cmd/controller/kodata/HEAD \
13
+ cmd/controller/kodata/refs \
14
+ cmd/webhook/kodata/HEAD \
15
+ cmd/webhook/kodata/refs
8
16
9
17
# Image URL to use all building/pushing image targets
10
18
IMG ?= controller:latest
@@ -41,14 +49,13 @@ SHELL = /usr/bin/env bash -o pipefail
41
49
help : # # Display this help.
42
50
@awk ' BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\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 )
43
51
44
- .PHONY : toolchain
45
- toolchain : # # Download additional tools.
52
+ $(TOOLCHAIN ) & :
46
53
@./scripts/toolchain.sh -d " $( PROJECT_DIR) /bin"
47
54
48
55
# #@ Development
49
56
50
57
.PHONY : generate
51
- generate : # # Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations.
58
+ generate : $( CONTROLLER_GEN ) # # Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations.
52
59
$(CONTROLLER_GEN ) object:headerFile=" hack/boilerplate.go.txt" paths=" ./..."
53
60
54
61
.PHONY : verify
@@ -69,8 +76,12 @@ run: ## Run a controller from your host.
69
76
70
77
# #@ Deployment
71
78
79
+ $(KODATA ) :
80
+ mkdir -p $(@D )
81
+ cd $(@D ) && ln -s ` git rev-parse --git-path $( @F) ` $(@F )
82
+
72
83
.PHONY : apply
73
- apply : # # Deploy the controller into the current kubernetes cluster.
84
+ apply : $( KO ) $( KODATA ) # # Deploy the controller into the current kubernetes cluster.
74
85
helm upgrade --install dev charts/aws-node-termination-handler-2 --namespace nthv2 --create-namespace \
75
86
$(HELM_BASE_OPTS ) \
76
87
$(HELM_OPTS ) \
0 commit comments