This repository has been archived by the owner on Apr 1, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
/
Makefile
238 lines (204 loc) · 8.41 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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
# MIT License
# Copyright(c) 2022 Futurewei Cloud
# Permission is hereby granted,
# free of charge, to any person obtaining a copy of this software and associated documentation files(the "Software"), to deal in the Software without restriction,
# including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and / or sell copies of the Software, and to permit persons
# to whom the Software is furnished to do so, subject to the following conditions:
# The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
modules := services
-include $(patsubst %, %/module.mk, $(modules))
.DEFAULT_GOAL := all
GFLAGS = CGO_ENABLED=0 GOOS=linux GOARCH=amd64
.PHONY: all
all:: proto services
proto:
mkdir -p api/proto/v1/compute
protoc --go_out=api/proto/v1/compute \
--go_opt=paths=source_relative \
--go-grpc_out=api/proto/v1/compute \
--go-grpc_opt=paths=source_relative \
-I api/proto/v1/ api/proto/v1/compute.proto
mkdir -p api/proto/v1/common
protoc --go_out=api/proto/v1/common \
--go_opt=paths=source_relative \
--go-grpc_out=api/proto/v1/common \
--go-grpc_opt=paths=source_relative \
-I api/proto/v1/ api/proto/v1/common.proto
mkdir -p api/proto/v1/network
protoc --go_out=api/proto/v1/network \
--go_opt=paths=source_relative \
--go-grpc_out=api/proto/v1/network \
--go-grpc_opt=paths=source_relative \
-I api/proto/v1/ api/proto/v1/network.proto
mkdir -p api/proto/v1/topology
protoc --go_out=api/proto/v1/topology \
--go_opt=paths=source_relative \
--go-grpc_out=api/proto/v1/topology \
--go-grpc_opt=paths=source_relative \
-I api/proto/v1/ api/proto/v1/topology.proto
mkdir -p api/proto/v1/agent
protoc --go_out=api/proto/v1/agent \
--go_opt=paths=source_relative \
--go-grpc_out=api/proto/v1/agent \
--go-grpc_opt=paths=source_relative \
-I api/proto/v1/ api/proto/v1/agent.proto
mkdir -p api/proto/v1/ntest
protoc --go_out=api/proto/v1/ntest \
--go_opt=paths=source_relative \
--go-grpc_out=api/proto/v1/ntest \
--go-grpc_opt=paths=source_relative \
-I api/proto/v1/ api/proto/v1/ntest.proto
.PHONY: unit-tests
unit-tests:
go test -v github.com/futurewei-cloud/merak/services/merak-compute/entities/ -coverprofile=cov_entities.out
go test -v github.com/futurewei-cloud/merak/services/common/ -coverprofile=cov_common.out
go test -v github.com/futurewei-cloud/merak/services/merak-agent/...-coverprofile=cov_merakagent.out
go tool cover -func=cov_entities.out
go tool cover -func=cov_common.out
go tool cover -func=cov_merakagent.out
rm cov_common.out
rm cov_entities.out
rm cov_merakagent.out
.PHONY: docker-scenario
docker-scenario:
# Scenario-Manager
make proto
make scenario
docker build -t meraksim/scenario-manager:dev -f docker/scenario.Dockerfile .
docker push meraksim/scenario-manager:dev
.PHONY: docker-compute
docker-compute:
make proto
make compute
make vm-worker
docker build -t meraksim/merak-compute:dev -f docker/compute.Dockerfile .
docker build -t meraksim/merak-compute-vm-worker:dev -f docker/compute-vm-worker.Dockerfile .
docker push meraksim/merak-compute:dev
docker push meraksim/merak-compute-vm-worker:dev
.PHONY: docker-compute-test
docker-compute-test:
make proto
make compute
make vm-worker
make docker-test-driver-compute
docker build -t meraksim/merak-compute:test -f docker/compute.Dockerfile .
docker push meraksim/merak-compute:test
docker build -t meraksim/merak-compute-vm-worker:test -f docker/compute-vm-worker.Dockerfile .
docker push meraksim/merak-compute-vm-worker:test
.PHONY: docker-agent
docker-agent:
make proto
make agent
docker build -t meraksim/merak-agent:dev -f docker/agent.Dockerfile .
docker push meraksim/merak-agent:dev
.PHONY: docker-agent-test
docker-agent-test:
make proto
make agent
docker build -t meraksim/merak-agent:test -f docker/agent.Dockerfile .
docker push meraksim/merak-agent:test
.PHONY: docker-network
docker-network:
make proto
make network
docker build -t meraksim/merak-network:dev -f docker/network.Dockerfile .
docker push meraksim/merak-network:dev
.PHONY: docker-topo
docker-topo:
make proto
make topo
docker build -t meraksim/merak-topo:dev -f docker/topo.Dockerfile .
docker push meraksim/merak-topo:dev
.PHONY: docker-test-driver-compute
docker-test-driver-compute:
docker build -t meraksim/test-merak-compute:test -f docker/test.merak.Dockerfile .
docker push meraksim/test-merak-compute:test
.PHONY: docker-prometheus
docker-prometheus:
docker build -t meraksim/prometheus:dev -f docker/prometheus.Dockerfile .
docker push meraksim/prometheus:dev
.PHONY: docker-all
docker-all:
make
docker build -t meraksim/merak-compute:dev -f docker/compute.Dockerfile .
docker build -t meraksim/merak-compute-vm-worker:dev -f docker/compute-vm-worker.Dockerfile .
docker build -t meraksim/merak-agent:dev -f docker/agent.Dockerfile .
docker build -t meraksim/merak-topo:dev -f docker/topo.Dockerfile .
docker build -t meraksim/merak-network:dev -f docker/network.Dockerfile .
docker build -t meraksim/scenario-manager:dev -f docker/scenario.Dockerfile .
docker build -t meraksim/prometheus:dev -f docker/prometheus.Dockerfile .
docker push meraksim/merak-compute:dev
docker push meraksim/merak-compute-vm-worker:dev
docker push meraksim/merak-agent:dev
docker push meraksim/scenario-manager:dev
docker push meraksim/merak-network:dev
docker push meraksim/merak-topo:dev
docker push meraksim/prometheus:dev
.PHONY: docker-all-ci
docker-all-ci:
make
docker build -t meraksim/merak-compute:ci -f docker/compute.Dockerfile .
docker build -t meraksim/merak-compute-vm-worker:ci -f docker/compute-vm-worker.Dockerfile .
docker build -t meraksim/merak-topo:ci -f docker/topo.Dockerfile .
docker build -t meraksim/merak-network:ci -f docker/network.Dockerfile .
docker build -t meraksim/scenario-manager:ci -f docker/scenario.Dockerfile .
docker build -t meraksim/merak-agent:ci -f docker/agent.Dockerfile .
docker push meraksim/merak-agent:ci
docker push meraksim/merak-compute:ci
docker push meraksim/merak-compute-vm-worker:ci
docker push meraksim/merak-network:ci
docker push meraksim/merak-topo:ci
docker push meraksim/scenario-manager:ci
.PHONY: docker-all-test
docker-all-test:
make
docker build -t meraksim/merak-compute:test -f docker/compute.Dockerfile .
docker build -t meraksim/merak-compute-vm-worker:test -f docker/compute-vm-worker.Dockerfile .
docker build -t meraksim/merak-topo:test -f docker/topo.Dockerfile .
docker build -t meraksim/merak-network:test -f docker/network.Dockerfile .
docker build -t meraksim/scenario-manager:test -f docker/scenario.Dockerfile .
docker build -t meraksim/merak-agent:test -f docker/agent.Dockerfile .
docker push meraksim/merak-agent:test
docker push meraksim/merak-compute:test
docker push meraksim/merak-compute-vm-worker:test
docker push meraksim/merak-network:test
docker push meraksim/merak-topo:test
docker push meraksim/scenario-manager:test
.PHONY: kind-base
kind-base:
kind delete cluster
kind create cluster --config=configs/kind.yaml
linkerd install --crds | kubectl apply -f -
linkerd install | kubectl apply -f -
linkerd check
.PHONY: kind-alcor
kind-alcor:
make kind-base
kubectl kustomize deployments/kubernetes/alcor --enable-helm | kubectl apply -f -
.PHONY: kind-test
kind-test:
make kind-base
kubectl kustomize deployments/kubernetes/test --enable-helm | kubectl apply -f -
.PHONY: kind-ci
kind-ci:
make kind-base
kubectl kustomize deployments/kubernetes/ci --enable-helm | kubectl apply -f -
.PHONY: kind-standalone
kind-standalone:
kind delete cluster
kind create cluster --config=configs/kind.yaml
kubectl kustomize deployments/kubernetes/standalone --enable-helm | kubectl apply -f -
.PHONY: deploy
deploy:
./tools/deploy-kubeadm.sh
.PHONY: clean
clean:
rm -rf api/proto/v1/merak/*.pb.go
rm -rf services/merak-compute/build/*
rm -rf services/merak-agent/build/*
rm -rf services/scenario-manager/build/*
rm -rf services/merak-network/build/*
rm -rf services/merak-topo/build/*