Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dynamically download toolchain and build symlinks #622

Merged
merged 2 commits into from
Apr 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions BUILD.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,6 @@ git clone --branch v2 https://github.com/aws/aws-node-termination-handler.git
cd aws-node-termination-handler
```

## Install build tools

```sh
make toolchain
```

## Set environment variables

```sh
Expand Down
2 changes: 2 additions & 0 deletions src/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,5 @@ testbin/*
*.swp
*.swo
*~
cmd/**/kodata/

21 changes: 16 additions & 5 deletions src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,17 @@ PROJECT_DIR := $(shell dirname $(abspath $(lastword $(MAKEFILE_LIST))))
CONTROLLER_GEN = $(PROJECT_DIR)/bin/controller-gen
KO = $(PROJECT_DIR)/bin/ko
ENVTEST = $(PROJECT_DIR)/bin/setup-envtest
TOOLCHAIN = \
$(CONTROLLER_GEN) \
$(KO) \
$(ENVTEST)
HELM_BASE_OPTS ?= --set serviceAccount.annotations.eks\\.amazonaws\\.com/role-arn=${NTHV2_IAM_ROLE_ARN}
GINKGO_BASE_OPTS ?= --coverpkg $(shell head -n 1 $(PROJECT_DIR)/go.mod | cut -s -d ' ' -f 2)/pkg/...

KODATA = \
cmd/controller/kodata/HEAD \
cmd/controller/kodata/refs \
cmd/webhook/kodata/HEAD \
cmd/webhook/kodata/refs

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

.PHONY: toolchain
toolchain: ## Download additional tools.
$(TOOLCHAIN) &:
@./scripts/toolchain.sh -d "$(PROJECT_DIR)/bin"

##@ Development

.PHONY: generate
generate: ## Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations.
generate: $(CONTROLLER_GEN) ## Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations.
$(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./..."

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

##@ Deployment

$(KODATA):
mkdir -p $(@D)
cd $(@D) && ln -s `git rev-parse --git-path $(@F)` $(@F)

.PHONY: apply
apply: ## Deploy the controller into the current kubernetes cluster.
apply: $(KO) $(KODATA) ## Deploy the controller into the current kubernetes cluster.
helm upgrade --install dev charts/aws-node-termination-handler-2 --namespace nthv2 --create-namespace \
$(HELM_BASE_OPTS) \
$(HELM_OPTS) \
Expand Down
1 change: 0 additions & 1 deletion src/cmd/controller/kodata/HEAD

This file was deleted.

1 change: 0 additions & 1 deletion src/cmd/controller/kodata/refs

This file was deleted.

1 change: 0 additions & 1 deletion src/cmd/webhook/kodata/HEAD

This file was deleted.

1 change: 0 additions & 1 deletion src/cmd/webhook/kodata/refs

This file was deleted.