-
Notifications
You must be signed in to change notification settings - Fork 58
/
Makefile
132 lines (105 loc) · 4.14 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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
include ./.bingo/Variables.mk
SHELL = /bin/bash
# This build tag is currently leveraged by tooling/image-sync
# https://github.com/containers/image?tab=readme-ov-file#building
GOTAGS?='containers_image_openpgp'
TOOLS_BIN_DIR := tooling/bin
DEPLOY_ENV ?= personal-dev
.DEFAULT_GOAL := all
all: test lint
.PHONY: all
# There is currently no convenient way to run tests against a whole Go workspace
# https://github.com/golang/go/issues/50745
test:
go list -f '{{.Dir}}/...' -m |RUN_TEMPLATIZE_E2E=true xargs go test -timeout 1200s -tags=$(GOTAGS) -cover
.PHONY: test
# There is currently no convenient way to run golangci-lint against a whole Go workspace
# https://github.com/golang/go/issues/50745
MODULES := $(shell go list -f '{{.Dir}}/...' -m | xargs)
lint: $(GOLANGCI_LINT)
$(GOLANGCI_LINT) run -v --build-tags=$(GOTAGS) $(MODULES)
.PHONY: lint
fmt: $(GOIMPORTS)
$(GOIMPORTS) -w -local github.com/Azure/ARO-HCP $(shell go list -f '{{.Dir}}' -m | xargs)
.PHONY: fmt
#
# Infra
#
infra.region:
@cd dev-infrastructure && DEPLOY_ENV=$(DEPLOY_ENV) make region
.PHONY: infra.region
infra.svc:
@cd dev-infrastructure && DEPLOY_ENV=$(DEPLOY_ENV) make svc.init
.PHONY: infra.svc
infra.svc.aks.kubeconfigfile:
@cd dev-infrastructure && DEPLOY_ENV=$(DEPLOY_ENV) make -s svc.aks.kubeconfigfile
.PHONY: infra.svc.aks.kubeconfigfile
infra.mgmt:
@cd dev-infrastructure && DEPLOY_ENV=$(DEPLOY_ENV) make mgmt.init
.PHONY: infra.mgmt
infra.mgmt.aks.kubeconfigfile:
@cd dev-infrastructure && DEPLOY_ENV=$(DEPLOY_ENV) make -s mgmt.aks.kubeconfigfile
.PHONY: infra.mgmt.aks.kubeconfigfile
infra.imagesync:
@cd dev-infrastructure && DEPLOY_ENV=$(DEPLOY_ENV) make imagesync
.PHONY: infra.imagesync
infra.all:
@cd dev-infrastructure && DEPLOY_ENV=$(DEPLOY_ENV) make infra
.PHONY: infra.all
infra.svc.clean:
@cd dev-infrastructure && DEPLOY_ENV=$(DEPLOY_ENV) make svc.clean
.PHONY: infra.svc.clean
infra.mgmt.clean:
@cd dev-infrastructure && DEPLOY_ENV=$(DEPLOY_ENV) make mgmt.clean
.PHONY: infra.mgmt.clean
infra.region.clean:
@cd dev-infrastructure && DEPLOY_ENV=$(DEPLOY_ENV) make region.clean
.PHONY: infra.region.clean
infra.imagesync.clean:
@cd dev-infrastructure && DEPLOY_ENV=$(DEPLOY_ENV) make imagesync.clean
.PHONY: infra.imagesync.clean
infra.clean:
@cd dev-infrastructure && DEPLOY_ENV=$(DEPLOY_ENV) make clean
.PHONY: infra.clean
#
# Services
#
# Service Deployment Conventions:
#
# - Services are deployed in aks clusters (either svc or mgmt), which are
# provisioned via infra section above
# - Makefile targets to deploy services ends with ".deploy" suffix
# - To deploy all services on svc or mgmt cluster, we have special targets
# `svc.deployall` and `mgmt.deployall`, and `deployall` deploys everithing.
# - Placement of a service is controlled via services_svc and services_mgmt
# variables
# - If the name of the service contains a dot, it's interpreted as directory
# separator "/" (used for maestro only).
# Services deployed on "svc" aks cluster
services_svc = istio metrics maestro.server maestro.registration cluster-service frontend backend
# Services deployed on "mgmt" aks cluster(s)
services_mgmt = acm maestro.agent pko hypershiftoperator
# List of all services
services_all = $(join services_svc,services_mgmt)
.PHONY: $(addsuffix .deploy, $(services_all)) deployall svc.deployall mgmt.deployall listall list clean
# Service deployment on either svc or mgmt aks cluster, a service name
# needs to be listed either in services_svc or services_mgmt variable (wich
# defines where it will be deployed).
%.deploy:
$(eval export dirname=$(subst .,/,$(basename $@)))
@if [ $(words $(filter $(basename $@), $(services_svc))) = 1 ]; then\
./svc-deploy.sh $(DEPLOY_ENV) $(dirname) svc;\
elif [ $(words $(filter $(basename $@), $(services_mgmt))) = 1 ]; then\
./svc-deploy.sh $(DEPLOY_ENV) $(dirname) mgmt;\
else\
echo "'$(basename $@)' is not to be deployed on neither svc nor mgmt cluster";\
exit 1;\
fi
svc.deployall: $(addsuffix .deploy, $(services_svc))
mgmt.deployall: $(addsuffix .deploy, $(services_mgmt))
deployall: svc.deployall mgmt.deployall
listall:
@echo svc: ${services_svc}
@echo mgmt: ${services_mgmt}
list:
@grep '^[^#[:space:]].*:' Makefile