forked from hwameistor/hwameistor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
513 lines (410 loc) · 21.1 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
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
include Makefile.variables
.PHONY: debug
debug:
${DOCKER_DEBUG_CMD} ash
.PHONY: apiserver_swag
apiserver_swag:
${DOCKER_MAKE_CMD} swag init -d ./cmd/${APISERVER_MODULE_NAME} -o ./pkg/${APISERVER_MODULE_NAME}/docs --parseVendor --parseDependency --parseInternal --propertyStrategy pascalcase --parseDepth 5
.PHONY: apiserver_run
apiserver_run: apiserver_swag
echo "Please browse at http://127.0.0.1/swagger/index.html"
GIN_MODE=debug go run ${BUILD_OPTIONS} ${APISERVER_BUILD_INPUT}
.PHONY: compile
compile: compile_ldm compile_ls compile_scheduler compile_admission compile_evictor compile_exporter compile_apiserver compile_failover compile_auditor compile_pvc-autoresizer compile_lda
.PHONY: image
image: build_ldm_image build_ls_image build_scheduler_image build_admission_image build_evictor_image build_exporter_image build_apiserver_image build_failover_image build_auditor_image build_pvc-autoresizer_image build_lda_image
.PHONY: arm-image
arm-image: build_ldm_image_arm64 build_ls_image_arm64 build_scheduler_image_arm64 build_admission_image_arm64 build_evictor_image_arm64 build_exporter_image_arm64 build_apiserver_image_arm64 build_failover_image_arm64 build_auditor_image_arm64 build_pvc-autoresizer_image_arm64 build_lda_image_arm64
.PHONY: release
release: release_ldm release_ls release_scheduler release_admission release_evictor release_exporter release_apiserver release_failover release_auditor release_pvc-autoresizer release_lda
.PHONY: unit-test
unit-test:
go test -race -coverprofile=coverage.txt -covermode=atomic `go list ./pkg/... | grep -v -E './pkg/local-storage/member|./pkg/scheduler|./pkg/evictor|./pkg/apiserver'`
curl -s https://codecov.io/bash | bash
.PHONY: vendor
vendor:
go mod tidy -compat=1.18
go mod vendor
#### for LDM #########
LDM_MODULE_NAME = local-disk-manager
LDM_BUILD_INPUT = ${CMDS_DIR}/${LDM_MODULE_NAME}/diskmanager.go
.PHONY: compile_ldm
compile_ldm:
GOARCH=amd64 ${BUILD_ENVS} ${BUILD_CMD} ${BUILD_OPTIONS} -o ${LDM_BUILD_OUTPUT} ${LDM_BUILD_INPUT}
.PHONY: compile_ldm_arm64
compile_ldm_arm64:
GOARCH=arm64 ${BUILD_ENVS} ${BUILD_CMD} ${BUILD_OPTIONS} -o ${LDM_BUILD_OUTPUT} ${LDM_BUILD_INPUT}
.PHONY: build_ldm_image
build_ldm_image:
@echo "Build local-disk-manager image ${LDM_IMAGE_NAME}:${IMAGE_TAG}"
${DOCKER_MAKE_CMD} make compile_ldm
docker build -t ${LDM_IMAGE_NAME}:${IMAGE_TAG} -f ${LDM_IMAGE_DOCKERFILE} ${PROJECT_SOURCE_CODE_DIR}
.PHONY: build_ldm_image_arm64
build_ldm_image_arm64:
@echo "Build local-disk-manager image ${LDM_IMAGE_NAME}:${IMAGE_TAG}"
${DOCKER_MAKE_CMD} make compile_ldm_arm64
${DOCKER_BUILDX_CMD_ARM64} -t ${LDM_IMAGE_NAME}:${IMAGE_TAG} -f ${LDM_IMAGE_DOCKERFILE} ${PROJECT_SOURCE_CODE_DIR}
.PHONY: release_ldm
release_ldm:
# build for amd64 version
${DOCKER_MAKE_CMD} make compile_ldm
${DOCKER_BUILDX_CMD_AMD64} -t ${LDM_IMAGE_NAME}:${RELEASE_TAG}-amd64 -f ${LDM_IMAGE_DOCKERFILE} ${PROJECT_SOURCE_CODE_DIR}
# build for arm64 version
${DOCKER_MAKE_CMD} make compile_ldm_arm64
${DOCKER_BUILDX_CMD_ARM64} -t ${LDM_IMAGE_NAME}:${RELEASE_TAG}-arm64 -f ${LDM_IMAGE_DOCKERFILE} ${PROJECT_SOURCE_CODE_DIR}
# push to a public registry
${MUILT_ARCH_PUSH_CMD} -i ${LDM_IMAGE_NAME}:${RELEASE_TAG}
#### for LS ##########
LS_MODULE_NAME = local-storage
LS_BUILD_INPUT = ${CMDS_DIR}/${LS_MODULE_NAME}/storage.go
.PHONY: compile_ls
compile_ls:
GOARCH=amd64 ${BUILD_ENVS} ${BUILD_CMD} ${BUILD_OPTIONS} -o ${LS_BUILD_OUTPUT} ${LS_BUILD_INPUT}
.PHONY: compile_ls_arm64
compile_ls_arm64:
GOARCH=arm64 ${BUILD_ENVS} ${BUILD_CMD} ${BUILD_OPTIONS} -o ${LS_BUILD_OUTPUT} ${LS_BUILD_INPUT}
.PHONY: build_ls_image
build_ls_image:
@echo "Build local-storage image ${LS_IMAGE_NAME}:${IMAGE_TAG}"
${DOCKER_MAKE_CMD} make compile_ls
docker build -t ${LS_IMAGE_NAME}:${IMAGE_TAG} -f ${LS_IMAGE_DOCKERFILE} ${PROJECT_SOURCE_CODE_DIR}
.PHONY: build_ls_image_arm64
build_ls_image_arm64:
@echo "Build local-storage image ${LS_IMAGE_NAME}:${IMAGE_TAG}"
${DOCKER_MAKE_CMD} make compile_ls_arm64
${DOCKER_BUILDX_CMD_ARM64} -t ${LS_IMAGE_NAME}:${IMAGE_TAG} -f ${LS_IMAGE_DOCKERFILE} ${PROJECT_SOURCE_CODE_DIR}
.PHONY: release_ls
release_ls:
# build for amd64 version
${DOCKER_MAKE_CMD} make compile_ls
${DOCKER_BUILDX_CMD_AMD64} -t ${LS_IMAGE_NAME}:${RELEASE_TAG}-amd64 -f ${LS_IMAGE_DOCKERFILE} ${PROJECT_SOURCE_CODE_DIR}
# build for arm64 version
${DOCKER_MAKE_CMD} make compile_ls_arm64
${DOCKER_BUILDX_CMD_ARM64} -t ${LS_IMAGE_NAME}:${RELEASE_TAG}-arm64 -f ${LS_IMAGE_DOCKERFILE} ${PROJECT_SOURCE_CODE_DIR}
# push to a public registry
${MUILT_ARCH_PUSH_CMD} -i ${LS_IMAGE_NAME}:${RELEASE_TAG}
#### for Scheduler ##########
SCHEDULER_MODULE_NAME = scheduler
SCHEDULER_BUILD_INPUT = ${CMDS_DIR}/${SCHEDULER_MODULE_NAME}/scheduler.go
.PHONY: compile_scheduler
compile_scheduler:
GOARCH=amd64 ${BUILD_ENVS} ${BUILD_CMD} ${BUILD_OPTIONS} -o ${SCHEDULER_BUILD_OUTPUT} ${SCHEDULER_BUILD_INPUT}
.PHONY: compile_scheduler_arm64
compile_scheduler_arm64:
GOARCH=arm64 ${BUILD_ENVS} ${BUILD_CMD} ${BUILD_OPTIONS} -o ${SCHEDULER_BUILD_OUTPUT} ${SCHEDULER_BUILD_INPUT}
.PHONY: build_scheduler_image
build_scheduler_image:
@echo "Build scheduler image ${SCHEDULER_IMAGE_NAME}:${IMAGE_TAG}"
${DOCKER_MAKE_CMD} make compile_scheduler
docker build -t ${SCHEDULER_IMAGE_NAME}:${IMAGE_TAG} -f ${SCHEDULER_IMAGE_DOCKERFILE} ${PROJECT_SOURCE_CODE_DIR}
.PHONY: build_scheduler_image_arm64
build_scheduler_image_arm64:
@echo "Build scheduler image ${SCHEDULER_IMAGE_NAME}:${IMAGE_TAG}"
${DOCKER_MAKE_CMD} make compile_scheduler_arm64
${DOCKER_BUILDX_CMD_ARM64} -t ${SCHEDULER_IMAGE_NAME}:${IMAGE_TAG} -f ${SCHEDULER_IMAGE_DOCKERFILE} ${PROJECT_SOURCE_CODE_DIR}
.PHONY: release_scheduler
release_scheduler:
# build for amd64 version
${DOCKER_MAKE_CMD} make compile_scheduler
${DOCKER_BUILDX_CMD_AMD64} -t ${SCHEDULER_IMAGE_NAME}:${RELEASE_TAG}-amd64 -f ${SCHEDULER_IMAGE_DOCKERFILE} ${PROJECT_SOURCE_CODE_DIR}
# build for arm64 version
${DOCKER_MAKE_CMD} make compile_scheduler_arm64
${DOCKER_BUILDX_CMD_ARM64} -t ${SCHEDULER_IMAGE_NAME}:${RELEASE_TAG}-arm64 -f ${SCHEDULER_IMAGE_DOCKERFILE} ${PROJECT_SOURCE_CODE_DIR}
# push to a public registry
${MUILT_ARCH_PUSH_CMD} -i ${SCHEDULER_IMAGE_NAME}:${RELEASE_TAG}
#### for Admission Controller ##########
ADMISSION_MODULE_NAME = admission
ADMISSION_BUILD_INPUT = ${CMDS_DIR}/${ADMISSION_MODULE_NAME}/admission.go
.PHONY: compile_admission
compile_admission:
GOARCH=amd64 ${BUILD_ENVS} ${BUILD_CMD} ${BUILD_OPTIONS} -o ${ADMISSION_BUILD_OUTPUT} ${ADMISSION_BUILD_INPUT}
.PHONY: compile_admission_arm64
compile_admission_arm64:
GOARCH=arm64 ${BUILD_ENVS} ${BUILD_CMD} ${BUILD_OPTIONS} -o ${ADMISSION_BUILD_OUTPUT} ${ADMISSION_BUILD_INPUT}
.PHONY: build_admission_image
build_admission_image:
@echo "Build admission image ${ADMISSION_IMAGE_NAME}:${IMAGE_TAG}"
${DOCKER_MAKE_CMD} make compile_admission
docker build -t ${ADMISSION_IMAGE_NAME}:${IMAGE_TAG} -f ${ADMISSION_IMAGE_DOCKERFILE} ${PROJECT_SOURCE_CODE_DIR}
.PHONY: build_admission_image_arm64
build_admission_image_arm64:
@echo "Build admission image ${ADMISSION_IMAGE_NAME}:${IMAGE_TAG}"
${DOCKER_MAKE_CMD} make compile_admission_arm64
${DOCKER_BUILDX_CMD_ARM64} -t ${ADMISSION_IMAGE_NAME}:${IMAGE_TAG} -f ${ADMISSION_IMAGE_DOCKERFILE} ${PROJECT_SOURCE_CODE_DIR}
.PHONY: release_admission
release_admission:
# build for amd64 version
${DOCKER_MAKE_CMD} make compile_admission
${DOCKER_BUILDX_CMD_AMD64} -t ${ADMISSION_IMAGE_NAME}:${RELEASE_TAG}-amd64 -f ${ADMISSION_IMAGE_DOCKERFILE} ${PROJECT_SOURCE_CODE_DIR}
# build for arm64 version
${DOCKER_MAKE_CMD} make compile_admission_arm64
${DOCKER_BUILDX_CMD_ARM64} -t ${ADMISSION_IMAGE_NAME}:${RELEASE_TAG}-arm64 -f ${ADMISSION_IMAGE_DOCKERFILE} ${PROJECT_SOURCE_CODE_DIR}
# push to a public registry
${MUILT_ARCH_PUSH_CMD} -i ${ADMISSION_IMAGE_NAME}:${RELEASE_TAG}
#### for Evitor ##########
EVICTOR_MODULE_NAME = evictor
EVICTOR_BUILD_INPUT = ${CMDS_DIR}/${EVICTOR_MODULE_NAME}/main.go
.PHONY: compile_evictor
compile_evictor:
GOARCH=amd64 ${BUILD_ENVS} ${BUILD_CMD} ${BUILD_OPTIONS} -o ${EVICTOR_BUILD_OUTPUT} ${EVICTOR_BUILD_INPUT}
.PHONY: compile_evictor_arm64
compile_evictor_arm64:
GOARCH=arm64 ${BUILD_ENVS} ${BUILD_CMD} ${BUILD_OPTIONS} -o ${EVICTOR_BUILD_OUTPUT} ${EVICTOR_BUILD_INPUT}
.PHONY: build_evictor_image
build_evictor_image:
@echo "Build evictor image ${EVICTOR_IMAGE_NAME}:${IMAGE_TAG}"
${DOCKER_MAKE_CMD} make compile_evictor
docker build -t ${EVICTOR_IMAGE_NAME}:${IMAGE_TAG} -f ${EVICTOR_IMAGE_DOCKERFILE} ${PROJECT_SOURCE_CODE_DIR}
.PHONY: build_evictor_image_arm64
build_evictor_image_arm64:
@echo "Build evictor image ${EVICTOR_IMAGE_NAME}:${IMAGE_TAG}"
${DOCKER_MAKE_CMD} make compile_evictor_arm64
${DOCKER_BUILDX_CMD_ARM64} -t ${EVICTOR_IMAGE_NAME}:${IMAGE_TAG} -f ${EVICTOR_IMAGE_DOCKERFILE} ${PROJECT_SOURCE_CODE_DIR}
.PHONY: release_evictor
release_evictor:
# build for amd64 version
${DOCKER_MAKE_CMD} make compile_evictor
${DOCKER_BUILDX_CMD_AMD64} -t ${EVICTOR_IMAGE_NAME}:${RELEASE_TAG}-amd64 -f ${EVICTOR_IMAGE_DOCKERFILE} ${PROJECT_SOURCE_CODE_DIR}
# build for arm64 version
${DOCKER_MAKE_CMD} make compile_evictor_arm64
${DOCKER_BUILDX_CMD_ARM64} -t ${EVICTOR_IMAGE_NAME}:${RELEASE_TAG}-arm64 -f ${EVICTOR_IMAGE_DOCKERFILE} ${PROJECT_SOURCE_CODE_DIR}
# push to a public registry
${MUILT_ARCH_PUSH_CMD} -i ${EVICTOR_IMAGE_NAME}:${RELEASE_TAG}
#### for Exporter ##########
EXPORTER_MODULE_NAME = exporter
EXPORTER_BUILD_INPUT = ${CMDS_DIR}/${EXPORTER_MODULE_NAME}/main.go
.PHONY: compile_exporter
compile_exporter:
GOARCH=amd64 ${BUILD_ENVS} ${BUILD_CMD} ${BUILD_OPTIONS} -o ${EXPORTER_BUILD_OUTPUT} ${EXPORTER_BUILD_INPUT}
.PHONY: compile_exporter_arm64
compile_exporter_arm64:
GOARCH=arm64 ${BUILD_ENVS} ${BUILD_CMD} ${BUILD_OPTIONS} -o ${EXPORTER_BUILD_OUTPUT} ${EXPORTER_BUILD_INPUT}
.PHONY: build_exporter_image
build_exporter_image:
@echo "Build exporter image ${EXPORTER_IMAGE_NAME}:${IMAGE_TAG}"
${DOCKER_MAKE_CMD} make compile_exporter
docker build -t ${EXPORTER_IMAGE_NAME}:${IMAGE_TAG} -f ${EXPORTER_IMAGE_DOCKERFILE} ${PROJECT_SOURCE_CODE_DIR}
.PHONY: build_exporter_image_arm64
build_exporter_image_arm64:
@echo "Build exporter image ${EXPORTER_IMAGE_NAME}:${IMAGE_TAG}"
${DOCKER_MAKE_CMD} make compile_exporter_arm64
${DOCKER_BUILDX_CMD_ARM64} -t ${EXPORTER_IMAGE_NAME}:${IMAGE_TAG} -f ${EXPORTER_IMAGE_DOCKERFILE} ${PROJECT_SOURCE_CODE_DIR}
.PHONY: release_exporter
release_exporter:
# build for amd64 version
${DOCKER_MAKE_CMD} make compile_exporter
${DOCKER_BUILDX_CMD_AMD64} -t ${EXPORTER_IMAGE_NAME}:${RELEASE_TAG}-amd64 -f ${EXPORTER_IMAGE_DOCKERFILE} ${PROJECT_SOURCE_CODE_DIR}
# build for arm64 version
${DOCKER_MAKE_CMD} make compile_exporter_arm64
${DOCKER_BUILDX_CMD_ARM64} -t ${EXPORTER_IMAGE_NAME}:${RELEASE_TAG}-arm64 -f ${EXPORTER_IMAGE_DOCKERFILE} ${PROJECT_SOURCE_CODE_DIR}
# push to a public registry
${MUILT_ARCH_PUSH_CMD} -i ${EXPORTER_IMAGE_NAME}:${RELEASE_TAG}
#### for APIServer ##########
APISERVER_MODULE_NAME = apiserver
APISERVER_BUILD_INPUT = ${CMDS_DIR}/${APISERVER_MODULE_NAME}/main.go
.PHONY: compile_apiserver
compile_apiserver:
GOARCH=amd64 ${BUILD_ENVS} ${BUILD_CMD} ${BUILD_OPTIONS} -o ${APISERVER_BUILD_OUTPUT} ${APISERVER_BUILD_INPUT}
.PHONY: compile_apiserver_arm64
compile_apiserver_arm64:
GOARCH=arm64 ${BUILD_ENVS} ${BUILD_CMD} ${BUILD_OPTIONS} -o ${APISERVER_BUILD_OUTPUT} ${APISERVER_BUILD_INPUT}
.PHONY: build_apiserver_image
build_apiserver_image:
@echo "Build hwameistor apiserver image ${APISERVER_IMAGE_NAME}:${IMAGE_TAG}"
${DOCKER_MAKE_CMD} make compile_apiserver
docker build -t ${APISERVER_IMAGE_NAME}:${IMAGE_TAG} -f ${APISERVER_IMAGE_DOCKERFILE} ${PROJECT_SOURCE_CODE_DIR}
.PHONY: build_apiserver_image_arm64
build_apiserver_image_arm64:
@echo "Build apiserver image ${APISERVER_IMAGE_NAME}:${IMAGE_TAG}"
${DOCKER_MAKE_CMD} make compile_apiserver_arm64
${DOCKER_BUILDX_CMD_ARM64} -t ${APISERVER_IMAGE_NAME}:${IMAGE_TAG} -f ${APISERVER_IMAGE_DOCKERFILE} ${PROJECT_SOURCE_CODE_DIR}
.PHONY: release_apiserver
release_apiserver:
# build for amd64 version
${DOCKER_MAKE_CMD} make compile_apiserver
${DOCKER_BUILDX_CMD_AMD64} -t ${APISERVER_IMAGE_NAME}:${RELEASE_TAG}-amd64 -f ${APISERVER_IMAGE_DOCKERFILE} ${PROJECT_SOURCE_CODE_DIR}
# build for arm64 version
${DOCKER_MAKE_CMD} make compile_apiserver_arm64
${DOCKER_BUILDX_CMD_ARM64} -t ${APISERVER_IMAGE_NAME}:${RELEASE_TAG}-arm64 -f ${APISERVER_IMAGE_DOCKERFILE} ${PROJECT_SOURCE_CODE_DIR}
# push to a public registry
${MUILT_ARCH_PUSH_CMD} -i ${APISERVER_IMAGE_NAME}:${RELEASE_TAG}
#### for Failover ##########
FAILOVER_MODULE_NAME = failover-assistant
FAILOVER_BUILD_INPUT = ${CMDS_DIR}/${FAILOVER_MODULE_NAME}/main.go
.PHONY: compile_failover
compile_failover:
GOARCH=amd64 ${BUILD_ENVS} ${BUILD_CMD} ${BUILD_OPTIONS} -o ${FAILOVER_BUILD_OUTPUT} ${FAILOVER_BUILD_INPUT}
.PHONY: compile_failover_arm64
compile_failover_arm64:
GOARCH=arm64 ${BUILD_ENVS} ${BUILD_CMD} ${BUILD_OPTIONS} -o ${FAILOVER_BUILD_OUTPUT} ${FAILOVER_BUILD_INPUT}
.PHONY: build_failover_image
build_failover_image:
@echo "Build hwameistor failover image ${FAILOVER_IMAGE_NAME}:${IMAGE_TAG}"
${DOCKER_MAKE_CMD} make compile_failover
docker build -t ${FAILOVER_IMAGE_NAME}:${IMAGE_TAG} -f ${FAILOVER_IMAGE_DOCKERFILE} ${PROJECT_SOURCE_CODE_DIR}
.PHONY: build_failover_image_arm64
build_failover_image_arm64:
@echo "Build failover image ${FAILOVER_IMAGE_NAME}:${IMAGE_TAG}"
${DOCKER_MAKE_CMD} make compile_failover_arm64
${DOCKER_BUILDX_CMD_ARM64} -t ${FAILOVER_IMAGE_NAME}:${IMAGE_TAG} -f ${FAILOVER_IMAGE_DOCKERFILE} ${PROJECT_SOURCE_CODE_DIR}
.PHONY: release_failover
release_failover:
# build for amd64 version
${DOCKER_MAKE_CMD} make compile_failover
${DOCKER_BUILDX_CMD_AMD64} -t ${FAILOVER_IMAGE_NAME}:${RELEASE_TAG}-amd64 -f ${FAILOVER_IMAGE_DOCKERFILE} ${PROJECT_SOURCE_CODE_DIR}
# build for arm64 version
${DOCKER_MAKE_CMD} make compile_failover_arm64
${DOCKER_BUILDX_CMD_ARM64} -t ${FAILOVER_IMAGE_NAME}:${RELEASE_TAG}-arm64 -f ${FAILOVER_IMAGE_DOCKERFILE} ${PROJECT_SOURCE_CODE_DIR}
# push to a public registry
${MUILT_ARCH_PUSH_CMD} -i ${FAILOVER_IMAGE_NAME}:${RELEASE_TAG}
#### for Auditor ##########
AUDITOR_MODULE_NAME = auditor
AUDITOR_BUILD_INPUT = ${CMDS_DIR}/${AUDITOR_MODULE_NAME}/main.go
.PHONY: compile_auditor
compile_auditor:
GOARCH=amd64 ${BUILD_ENVS} ${BUILD_CMD} ${BUILD_OPTIONS} -o ${AUDITOR_BUILD_OUTPUT} ${AUDITOR_BUILD_INPUT}
.PHONY: compile_auditor_arm64
compile_auditor_arm64:
GOARCH=arm64 ${BUILD_ENVS} ${BUILD_CMD} ${BUILD_OPTIONS} -o ${AUDITOR_BUILD_OUTPUT} ${AUDITOR_BUILD_INPUT}
.PHONY: build_auditor_image
build_auditor_image:
@echo "Build hwameistor auditor image ${AUDITOR_IMAGE_NAME}:${IMAGE_TAG}"
${DOCKER_MAKE_CMD} make compile_auditor
docker build -t ${AUDITOR_IMAGE_NAME}:${IMAGE_TAG} -f ${AUDITOR_IMAGE_DOCKERFILE} ${PROJECT_SOURCE_CODE_DIR}
.PHONY: build_auditor_image_arm64
build_auditor_image_arm64:
@echo "Build auditor image ${AUDITOR_IMAGE_NAME}:${IMAGE_TAG}"
${DOCKER_MAKE_CMD} make compile_auditor_arm64
${DOCKER_BUILDX_CMD_ARM64} -t ${AUDITOR_IMAGE_NAME}:${IMAGE_TAG} -f ${AUDITOR_IMAGE_DOCKERFILE} ${PROJECT_SOURCE_CODE_DIR}
.PHONY: release_auditor
release_auditor:
# build for amd64 version
${DOCKER_MAKE_CMD} make compile_auditor
${DOCKER_BUILDX_CMD_AMD64} -t ${AUDITOR_IMAGE_NAME}:${RELEASE_TAG}-amd64 -f ${AUDITOR_IMAGE_DOCKERFILE} ${PROJECT_SOURCE_CODE_DIR}
# build for arm64 version
${DOCKER_MAKE_CMD} make compile_auditor_arm64
${DOCKER_BUILDX_CMD_ARM64} -t ${AUDITOR_IMAGE_NAME}:${RELEASE_TAG}-arm64 -f ${AUDITOR_IMAGE_DOCKERFILE} ${PROJECT_SOURCE_CODE_DIR}
# push to a public registry
${MUILT_ARCH_PUSH_CMD} -i ${AUDITOR_IMAGE_NAME}:${RELEASE_TAG}
#### for PVC AutoResizer ##########
PVC-AUTORESIZER_MODULE_NAME = pvc-autoresizer
PVC-AUTORESIZER_BUILD_INPUT = ${CMDS_DIR}/${PVC-AUTORESIZER_MODULE_NAME}/main.go
.PHONY: compile_pvc-autoresizer
compile_pvc-autoresizer:
GOARCH=amd64 ${BUILD_ENVS} ${BUILD_CMD} ${BUILD_OPTIONS} -o ${PVC-AUTORESIZER_BUILD_OUTPUT} ${PVC-AUTORESIZER_BUILD_INPUT}
.PHONY: compile_pvc-autoresizer_arm64
compile_pvc-autoresizer_arm64:
GOARCH=arm64 ${BUILD_ENVS} ${BUILD_CMD} ${BUILD_OPTIONS} -o ${PVC-AUTORESIZER_BUILD_OUTPUT} ${PVC-AUTORESIZER_BUILD_INPUT}
.PHONY: build_pvc-autoresizer_image
build_pvc-autoresizer_image:
@echo "Build hwameistor pvc-autoresizer image ${PVC-AUTORESIZER_IMAGE_NAME}:${IMAGE_TAG}"
${DOCKER_MAKE_CMD} make compile_pvc-autoresizer
docker build -t ${PVC-AUTORESIZER_IMAGE_NAME}:${IMAGE_TAG} -f ${PVC-AUTORESIZER_IMAGE_DOCKERFILE} ${PROJECT_SOURCE_CODE_DIR}
.PHONY: build_pvc-autoresizer_image_arm64
build_pvc-autoresizer_image_arm64:
@echo "Build hwameistor pvc-autoresizer image ${PVC-AUTORESIZER_IMAGE_NAME}:${IMAGE_TAG}"
${DOCKER_MAKE_CMD} make compile_pvc-autoresizer_arm64
${DOCKER_BUILDX_CMD_ARM64} -t ${PVC-AUTORESIZER_IMAGE_NAME}:${IMAGE_TAG} -f ${PVC-AUTORESIZER_IMAGE_DOCKERFILE} ${PROJECT_SOURCE_CODE_DIR}
.PHONY: release_pvc-autoresizer
release_pvc-autoresizer:
# build for amd64 version
${DOCKER_MAKE_CMD} make compile_pvc-autoresizer
${DOCKER_BUILDX_CMD_AMD64} -t ${PVC-AUTORESIZER_IMAGE_NAME}:${RELEASE_TAG}-amd64 -f ${PVC-AUTORESIZER_IMAGE_DOCKERFILE} ${PROJECT_SOURCE_CODE_DIR}
# build for arm64 version
${DOCKER_MAKE_CMD} make compile_pvc-autoresizer_arm64
${DOCKER_BUILDX_CMD_ARM64} -t ${PVC-AUTORESIZER_IMAGE_NAME}:${RELEASE_TAG}-arm64 -f ${PVC-AUTORESIZER_IMAGE_DOCKERFILE} ${PROJECT_SOURCE_CODE_DIR}
# push to a public registry
${MUILT_ARCH_PUSH_CMD} -i ${PVC-AUTORESIZER_IMAGE_NAME}:${RELEASE_TAG}
#### for LocalDiskAction controller ##########
LDA_CONTROLLER_MODULE_NAME = local-disk-action-controller
LDA_CONTROLLER_BUILD_INPUT = ${CMDS_DIR}/${LDA_CONTROLLER_MODULE_NAME}/main.go
.PHONY: compile_lda
compile_lda:
GOARCH=amd64 ${BUILD_ENVS} ${BUILD_CMD} ${BUILD_OPTIONS} -o ${LDA_CONTROLLER_BUILD_OUTPUT} ${LDA_CONTROLLER_BUILD_INPUT}
.PHONY: compile_lda_arm64
compile_lda_arm64:
GOARCH=arm64 ${BUILD_ENVS} ${BUILD_CMD} ${BUILD_OPTIONS} -o ${LDA_CONTROLLER_BUILD_OUTPUT} ${LDA_CONTROLLER_BUILD_INPUT}
.PHONY: build_lda_image
build_lda_image:
@echo "Build local-disk-action-controller image ${LDA_CONTROLLER_IMAGE_NAME}:${IMAGE_TAG}"
${DOCKER_MAKE_CMD} make compile_lda
docker build -t ${LDA_CONTROLLER_IMAGE_NAME}:${IMAGE_TAG} -f ${LDA_CONTROLLER_IMAGE_DOCKERFILE} ${PROJECT_SOURCE_CODE_DIR}
.PHONY: build_lda_image_arm64
build_lda_image_arm64:
@echo "Build local-disk-action-controller image ${LDA_CONTROLLER_IMAGE_NAME}:${IMAGE_TAG}"
${DOCKER_MAKE_CMD} make compile_lda_arm64
${DOCKER_BUILDX_CMD_ARM64} -t ${LDA_CONTROLLER_IMAGE_NAME}:${IMAGE_TAG} -f ${LDA_CONTROLLER_IMAGE_DOCKERFILE} ${PROJECT_SOURCE_CODE_DIR}
.PHONY: release_lda
release_lda:
# build for amd64 version
${DOCKER_MAKE_CMD} make compile_lda
${DOCKER_BUILDX_CMD_AMD64} -t ${LDA_CONTROLLER_IMAGE_NAME}:${RELEASE_TAG}-amd64 -f ${LDA_CONTROLLER_IMAGE_DOCKERFILE} ${PROJECT_SOURCE_CODE_DIR}
# build for arm64 version
${DOCKER_MAKE_CMD} make compile_lda_arm64
${DOCKER_BUILDX_CMD_ARM64} -t ${LDA_CONTROLLER_IMAGE_NAME}:${RELEASE_TAG}-arm64 -f ${LDA_CONTROLLER_IMAGE_DOCKERFILE} ${PROJECT_SOURCE_CODE_DIR}
# push to a public registry
${MUILT_ARCH_PUSH_CMD} -i ${LDA_CONTROLLER_IMAGE_NAME}:${RELEASE_TAG}
### for hwameictl ###
HWAMEICTL_BUILD_INPUT = ${CMDS_DIR}/hwameictl/hwameictl.go
# Example:
# make build_hwameictl OS=linux ARCH=amd64
# make build_hwameictl OS=darwin ARCH=arm64
.PHONY: build_hwameictl
build_hwameictl:
@echo "Building for OS: ${OS}, ARCH: ${ARCH}"
ifeq ("$(OS)", "windows")
CGO_ENABLED=0 GOOS=${OS} GOARCH=${ARCH} ${BUILD_CMD} -o "_build/hwameictl/hwameictl-${OS}-${ARCH}.exe" ${BUILD_OPTIONS} ${HWAMEICTL_BUILD_INPUT}
else
CGO_ENABLED=0 GOOS=${OS} GOARCH=${ARCH} ${BUILD_CMD} -o "_build/hwameictl/hwameictl-${OS}-${ARCH}" ${BUILD_OPTIONS} ${HWAMEICTL_BUILD_INPUT}
endif
.PHONY: apis
apis:
${DOCKER_MAKE_CMD} make _gen-apis
.PHONY: builder
builder:
docker build -t ${BUILDER_NAME}:${BUILDER_TAG} -f ${BUILDER_DOCKERFILE} ${PROJECT_SOURCE_CODE_DIR}
docker push ${BUILDER_NAME}:${BUILDER_TAG}
.PHONY: tools
tools: juicesync
.PHONY: juicesync
juicesync:
${DOCKER_BUILDX_CMD_AMD64} -t ${JUICESYNC_NAME}:${JUICESYNC_TAG}-amd64 -f ${JUICESYNC_DOCKERFILE}.amd64 ${PROJECT_SOURCE_CODE_DIR}
# build for arm64 version
${DOCKER_BUILDX_CMD_ARM64} -t ${JUICESYNC_NAME}:${JUICESYNC_TAG}-arm64 -f ${JUICESYNC_DOCKERFILE}.arm64 ${PROJECT_SOURCE_CODE_DIR}
# push to a public registry
${MUILT_ARCH_PUSH_CMD} -i ${JUICESYNC_NAME}:${JUICESYNC_TAG}
.PHONY: _gen-apis
_gen-apis:
${OPERATOR_CMD} generate k8s
${OPERATOR_CMD} generate crds
GOPROXY=https://goproxy.cn,direct /code-generator/generate-groups.sh all github.com/hwameistor/hwameistor/pkg/apis/client github.com/hwameistor/hwameistor/pkg/apis "hwameistor:v1alpha1" --go-header-file /go/src/github.com/hwameistor/hwameistor/build/boilerplate.go.txt
.PHONY: e2e-test
e2e-test:
bash test/e2e-test.sh
.PHONY: pr-test
pr-test:
bash test/pr-test.sh
.PHONY: relok8s-test
relok8s-test:
bash test/relok8s-test.sh
.PHONY: shutdownvm
shutdownvm:
bash test/shutdownvm.sh
.PHONY: render-chart-values
render-chart-values:
${RENDER_CHART_VALUES}
.PHONY: lint
lint: golangci-lint
$(GOLANGLINT_BIN) run
.PHONY: lint-fix
lint-fix: golangci-lint
$(GOLANGLINT_BIN) run --fix
.PHONY: golangci-lint
golangci-lint:
ifeq (, $(shell command -v golangci-lint))
@echo "Installing golangci-lint"
GO111MODULE=on go install github.com/golangci/golangci-lint/cmd/[email protected]
GOLANGLINT_BIN=$(shell go env GOPATH)/bin/golangci-lint
else
GOLANGLINT_BIN=$(shell which golangci-lint)
endif