Skip to content

Commit fc4de5f

Browse files
authored
dynamically download toolchain and build symlinks (#622)
1 parent eb9b532 commit fc4de5f

File tree

7 files changed

+18
-15
lines changed

7 files changed

+18
-15
lines changed

BUILD.md

-6
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,6 @@ git clone --branch v2 https://github.com/aws/aws-node-termination-handler.git
77
cd aws-node-termination-handler
88
```
99

10-
## Install build tools
11-
12-
```sh
13-
make toolchain
14-
```
15-
1610
## Set environment variables
1711

1812
```sh

src/.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,5 @@ testbin/*
2323
*.swp
2424
*.swo
2525
*~
26+
cmd/**/kodata/
27+

src/Makefile

+16-5
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,17 @@ PROJECT_DIR := $(shell dirname $(abspath $(lastword $(MAKEFILE_LIST))))
22
CONTROLLER_GEN = $(PROJECT_DIR)/bin/controller-gen
33
KO = $(PROJECT_DIR)/bin/ko
44
ENVTEST = $(PROJECT_DIR)/bin/setup-envtest
5+
TOOLCHAIN = \
6+
$(CONTROLLER_GEN) \
7+
$(KO) \
8+
$(ENVTEST)
59
HELM_BASE_OPTS ?= --set serviceAccount.annotations.eks\\.amazonaws\\.com/role-arn=${NTHV2_IAM_ROLE_ARN}
610
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
816

917
# Image URL to use all building/pushing image targets
1018
IMG ?= controller:latest
@@ -41,14 +49,13 @@ SHELL = /usr/bin/env bash -o pipefail
4149
help: ## Display this help.
4250
@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)
4351

44-
.PHONY: toolchain
45-
toolchain: ## Download additional tools.
52+
$(TOOLCHAIN) &:
4653
@./scripts/toolchain.sh -d "$(PROJECT_DIR)/bin"
4754

4855
##@ Development
4956

5057
.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.
5259
$(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./..."
5360

5461
.PHONY: verify
@@ -69,8 +76,12 @@ run: ## Run a controller from your host.
6976

7077
##@ Deployment
7178

79+
$(KODATA):
80+
mkdir -p $(@D)
81+
cd $(@D) && ln -s `git rev-parse --git-path $(@F)` $(@F)
82+
7283
.PHONY: apply
73-
apply: ## Deploy the controller into the current kubernetes cluster.
84+
apply: $(KO) $(KODATA) ## Deploy the controller into the current kubernetes cluster.
7485
helm upgrade --install dev charts/aws-node-termination-handler-2 --namespace nthv2 --create-namespace \
7586
$(HELM_BASE_OPTS) \
7687
$(HELM_OPTS) \

src/cmd/controller/kodata/HEAD

-1
This file was deleted.

src/cmd/controller/kodata/refs

-1
This file was deleted.

src/cmd/webhook/kodata/HEAD

-1
This file was deleted.

src/cmd/webhook/kodata/refs

-1
This file was deleted.

0 commit comments

Comments
 (0)