-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
61 lines (44 loc) · 1.42 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set)
ifeq (,$(shell go env GOBIN))
GOBIN=$(shell go env GOPATH)/bin
else
GOBIN=$(shell go env GOBIN)
endif
.PHONY: all
all: help
##@ General
.PHONY: help
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)
##@ Cluster
KIND_IMAGE ?= kindest/node:v1.26.0
CLUSTER ?= harbor
.PHONY: cluster
cluster: kind ## Create the kind cluster.
$(KIND) create cluster --name $(CLUSTER) --image $(KIND_IMAGE)
.PHONY: cluster-delete
cluster-delete: kind ## Delete the kind cluster.
$(KIND) delete cluster --name $(CLUSTER)
.PHONY: cluster-ctx
cluster-ctx: ## Sets cluster context.
@kubectl config use-context kind-$(CLUSTER)
##@ Networking
LB_IP ?= 172.18.0.100
HARBOR_HOST ?= harbor.local
.PHONY: add-host
add-host: ## Add harbor host to /etc/hosts.
@./hack/add_host.sh $(LB_IP) $(HARBOR_HOST)
##@ Tooling
KIND ?= $(LOCALBIN)/kind
KIND_VERSION ?= v0.17.0
## Location to install dependencies to
LOCALBIN ?= $(shell pwd)/bin
$(LOCALBIN):
mkdir -p $(LOCALBIN)
kind: $(KIND) ## Download kind locally if necessary.
$(KIND): $(LOCALBIN)
GOBIN=$(LOCALBIN) go install sigs.k8s.io/kind@$(KIND_VERSION)
##@ Harbor
.PHONY: install
install: ## Install Harbor.
@./hack/install.sh