-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
83 lines (67 loc) · 2.08 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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
SHELL:=/bin/bash
MAKEFLAGS += --no-print-directory
COMPONENTS = community-controller cpu-monitoring simple-dispatcher simple-dispatcher-of system-controller dispatcher
ifeq (,$(shell go env GOBIN))
GOBIN=$(shell go env GOPATH)/bin
else
GOBIN=$(shell go env GOBIN)
endif
CRD_OPTIONS ?= "crd:trivialVersions=true"
.PHONY: all build cluster clean coverage controller-gen e2e fmt install install-crds install-rbac manifests release test vet
all: build coverage clean manifests test
build:
$(call action, build)
coverage:
$(call action, coverage)
clean:
$(call action, clean)
test:
$(call action, test)
install: install-crds install-rbac
install-crds: manifests
@echo "install CRDs manifests"
@kubectl apply -f config/crd/bases
@echo "install openfaas CRDs manifests"
@kubectl apply -f ./config/openfaas
@kubectl apply -f ./config/cluster-conf/openfaas-fn-namespace.yaml
e2e: install
@echo "run e2e tests"
@kubectl apply -f ./config/cluster-conf/e2e-namespace.yaml
$(call action, e2e)
@kubectl delete -f ./config/cluster-conf/e2e-namespace.yaml
install-rbac:
@echo "install RBAC"
@kubectl apply -f config/permissions
metric-db:
@cd ./config/metric-db
@docker build -t systemautoscaler/database .
@docker push -t systemautoscaler/database
# Generate manifests e.g. CRD, RBAC etc.
manifests: controller-gen
$(CONTROLLER_GEN) $(CRD_OPTIONS) rbac:roleName=edgeautoscaler-role webhook paths="./..." output:crd:artifacts:config=config/crd/bases crd:crdVersions={v1}
@rm config/edgeautoscaler.polimi.it_communityschedules.yaml
@rm config/edgeautoscaler.polimi.it_communityconfigurations.yaml
controller-gen:
ifeq (, $(shell which controller-gen))
@{ \
set -e ;\
CONTROLLER_GEN_TMP_DIR=$$(mktemp -d) ;\
cd $$CONTROLLER_GEN_TMP_DIR ;\
go mod init tmp ;\
go get sigs.k8s.io/controller-tools/cmd/[email protected] ;\
rm -rf $$CONTROLLER_GEN_TMP_DIR ;\
}
CONTROLLER_GEN=$(GOBIN)/controller-gen
else
CONTROLLER_GEN=$(shell which controller-gen)
endif
define action
@for c in $(COMPONENTS); \
do \
$(MAKE) $(1) -C pkg/$$c; \
if [[ $$? -ne 0 ]]; \
then \
exit 1; \
fi; \
done;
endef