-
Notifications
You must be signed in to change notification settings - Fork 59
/
Copy pathMakefile
executable file
·514 lines (451 loc) · 21 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
514
GOCMD=go
SHELL=/bin/bash -o pipefail -e
GOBUILD=$(GOCMD) build -buildvcs=false
GOCLEAN=$(GOCMD) clean
GOGET=$(GOCMD) get
GOTEST=$(GOCMD) test
BINARY_NAME_AKO=ako
BINARY_NAME_AKO_INFRA=ako-infra
BINARY_NAME_AKO_GATEWAY_API=ako-gateway-api
PACKAGE_PATH_AKO=github.com/vmware/load-balancer-and-ingress-services-for-kubernetes
REL_PATH_AKO=$(PACKAGE_PATH_AKO)/cmd/ako-main
REL_PATH_AKO_INFRA=$(PACKAGE_PATH_AKO)/cmd/infra-main
REL_PATH_AKO_GATEWAY_API=$(PACKAGE_PATH_AKO)/cmd/gateway-api
AKO_OPERATOR_IMAGE=ako-operator
ENDPOINTSLICES_ENABLED?="false"
INFORMERS_PACKAGES := $(shell go list ./tests/... | grep informers)
define GetSupportabilityMatrix
$(shell node -p "require('./buildsettings.json').$(1)")
endef
AVI_MIN_VERSION:=$(call GetSupportabilityMatrix,avi.minVersion)
AVI_MAX_VERSION:=$(call GetSupportabilityMatrix,avi.maxVersion)
K8S_MIN_VERSION:=$(call GetSupportabilityMatrix,kubernetes.minVersion)
K8S_MAX_VERSION:=$(call GetSupportabilityMatrix,kubernetes.maxVersion)
AKO_VERSION:=v$(call GetSupportabilityMatrix,version)
AKO_LDFLAGS:="-X 'main.version=$(AKO_VERSION)' \
-X '$(PACKAGE_PATH_AKO)/internal/lib.aviMinVersion=$(AVI_MIN_VERSION)' \
-X '$(PACKAGE_PATH_AKO)/internal/lib.aviMaxVersion=$(AVI_MAX_VERSION)' \
-X '$(PACKAGE_PATH_AKO)/internal/lib.k8sMinVersion=$(K8S_MIN_VERSION)' \
-X '$(PACKAGE_PATH_AKO)/internal/lib.k8sMaxVersion=$(K8S_MAX_VERSION)'"
ifdef GOLANG_SRC_REPO
BUILD_GO_IMG=$(GOLANG_SRC_REPO)
else
BUILD_GO_IMG=golang:latest
endif
GO_IMG_TEST=golang:bullseye
.PHONY: glob-vars
glob-vars:
$(eval BUILD_ARG_AKO_LDFLAGS=--build-arg AKO_LDFLAGS=$(AKO_LDFLAGS))
ifndef BUILD_TAG
$(eval BUILD_TAG=$(shell ./hack/jenkins/get_build_version.sh "dummy" 0))
endif
ifndef BUILD_TIME
$(eval BUILD_TIME=$(shell date +%Y-%m-%d_%H:%M:%S_%Z))
endif
ifdef GOLANG_SRC_REPO
$(eval BUILD_ARG_GOLANG=--build-arg golang_src_repo=$(GOLANG_SRC_REPO))
else
$(eval BUILD_ARG_GOLANG=)
endif
ifdef PHOTON_SRC_REPO
$(eval BUILD_ARG_PHOTON=--build-arg photon_src_repo=$(PHOTON_SRC_REPO))
else
$(eval BUILD_ARG_PHOTON=)
endif
ifdef UBI_SRC_REPO
$(eval BUILD_ARG_UBI=--build-arg ubi_src_repo=$(UBI_SRC_REPO))
else
$(eval BUILD_ARG_UBI=)
endif
.PHONY: all
all: build docker
.PHONY: sync-crd-files
sync-crd-files:
cp ./helm/ako/crds/* ./ako-operator/helm/ako-operator/crds/
.PHONY: pre-build
pre-build: sync-crd-files
# builds
.PHONY: build
build: pre-build glob-vars
sudo docker run \
-w=/go/src/$(PACKAGE_PATH_AKO) \
-v $(PWD):/go/src/$(PACKAGE_PATH_AKO) $(BUILD_GO_IMG) \
$(GOBUILD) \
-o /go/src/$(PACKAGE_PATH_AKO)/bin/$(BINARY_NAME_AKO) \
-ldflags $(AKO_LDFLAGS) \
-mod=vendor \
/go/src/$(REL_PATH_AKO)
.PHONY: build-infra
build-infra: pre-build glob-vars
sudo docker run \
-w=/go/src/$(PACKAGE_PATH_AKO) \
-v $(PWD):/go/src/$(PACKAGE_PATH_AKO) $(BUILD_GO_IMG) \
$(GOBUILD) \
-o /go/src/$(PACKAGE_PATH_AKO)/bin/$(BINARY_NAME_AKO_INFRA) \
-ldflags $(AKO_LDFLAGS) \
-mod=vendor \
/go/src/$(REL_PATH_AKO_INFRA)
.PHONY: build-gateway-api
build-gateway-api: glob-vars
sudo docker run \
-w=/go/src/$(PACKAGE_PATH_AKO) \
-v $(PWD):/go/src/$(PACKAGE_PATH_AKO) $(BUILD_GO_IMG) \
$(GOBUILD) \
-o /go/src/$(PACKAGE_PATH_AKO)/bin/$(BINARY_NAME_AKO_GATEWAY_API) \
-ldflags $(AKO_LDFLAGS) \
-mod=vendor \
/go/src/$(REL_PATH_AKO_GATEWAY_API)
.PHONY: build-local
build-local: pre-build
$(GOBUILD) \
-o bin/$(BINARY_NAME_AKO) \
-ldflags $(AKO_LDFLAGS) \
-mod=vendor \
./cmd/ako-main
.PHONY: build-local-infra
build-local-infra: pre-build
$(GOBUILD) \
-o bin/$(BINARY_NAME_AKO_INFRA) \
-ldflags $(AKO_LDFLAGS) \
-mod=vendor \
./cmd/infra-main
.PHONY: clean
clean:
$(GOCLEAN) -mod=vendor $(REL_PATH_AKO)
rm -f bin/$(BINARY_NAME_AKO)
.PHONY: deps
deps:
dep ensure -v
# docker images
.PHONY: docker
docker: glob-vars
sudo docker build \
-t $(BINARY_NAME_AKO):latest \
--label "BUILD_TAG=$(BUILD_TAG)" \
--label "BUILD_TIME=$(BUILD_TIME)" \
$(BUILD_ARG_GOLANG) $(BUILD_ARG_PHOTON) $(BUILD_ARG_AKO_LDFLAGS) \
-f Dockerfile.ako .
.PHONY: ako-infra-docker
ako-infra-docker: glob-vars
sudo docker build \
-t $(BINARY_NAME_AKO_INFRA):latest \
--label "BUILD_TAG=$(BUILD_TAG)" \
--label "BUILD_TIME=$(BUILD_TIME)" \
$(BUILD_ARG_GOLANG) $(BUILD_ARG_PHOTON) $(BUILD_ARG_AKO_LDFLAGS) \
-f Dockerfile.ako-infra .
.PHONY: ako-operator-docker
ako-operator-docker: glob-vars
sudo docker build \
-t $(AKO_OPERATOR_IMAGE):latest \
--label "BUILD_TAG=$(BUILD_TAG)" \
--label "BUILD_TIME=$(BUILD_TIME)" \
$(BUILD_ARG_GOLANG) $(BUILD_ARG_UBI) \
-f Dockerfile.ako-operator .
.PHONY: ako-gateway-api-docker
ako-gateway-api-docker: glob-vars
sudo docker build \
-t $(BINARY_NAME_AKO_GATEWAY_API):latest \
--label "BUILD_TAG=$(BUILD_TAG)" \
--label "BUILD_TIME=$(BUILD_TIME)" \
$(BUILD_ARG_GOLANG) $(BUILD_ARG_PHOTON) $(BUILD_ARG_AKO_LDFLAGS) \
-f Dockerfile.ako-gateway-api .
# tests
.PHONY: k8stest
k8stest:
@> k8s_test.log
(sudo docker run \
-e ENDPOINTSLICES_ENABLED=$(ENDPOINTSLICES_ENABLED) \
-w=/go/src/$(PACKAGE_PATH_AKO) \
-v $(PWD):/go/src/$(PACKAGE_PATH_AKO) $(GO_IMG_TEST) \
$(GOTEST) -v -mod=vendor $(PACKAGE_PATH_AKO)/tests/k8stest -failfast -timeout 0 \
-coverprofile cover-1.out -coverpkg=./... > k8s_test.log 2>&1 && echo "k8stest passed") || (echo "k8stest failed" && cat k8s_test.log && exit 1 )
.PHONY: integrationtest
integrationtest:
@> integrationtest.log
(sudo docker run \
-e ENDPOINTSLICES_ENABLED=$(ENDPOINTSLICES_ENABLED) \
-w=/go/src/$(PACKAGE_PATH_AKO) \
-v $(PWD):/go/src/$(PACKAGE_PATH_AKO) $(GO_IMG_TEST) \
$(GOTEST) -v -mod=vendor $(PACKAGE_PATH_AKO)/tests/integrationtest -failfast -coverprofile cover-2.out -coverpkg=./... > integrationtest.log 2>&1 && echo "integrationtest passed") || (echo "integrationtest failed" && cat integrationtest.log && exit 1)
.PHONY: ingresstests
ingresstests:
@> ingresstests.log
(sudo docker run \
-e ENDPOINTSLICES_ENABLED=$(ENDPOINTSLICES_ENABLED) \
-w=/go/src/$(PACKAGE_PATH_AKO) \
-v $(PWD):/go/src/$(PACKAGE_PATH_AKO) $(GO_IMG_TEST) \
$(GOTEST) -v -mod=vendor $(PACKAGE_PATH_AKO)/tests/ingresstests -failfast -timeout 0 -coverprofile cover-3.out -coverpkg=./... > ingresstests.log 2>&1 && echo "ingresstests passed") || (echo "ingresstests failed" && cat ingresstests.log && exit 1)
.PHONY: oshiftroutetests
oshiftroutetests:
@> oshiftroutetests.log
(sudo docker run \
-e ENDPOINTSLICES_ENABLED=$(ENDPOINTSLICES_ENABLED) \
-w=/go/src/$(PACKAGE_PATH_AKO) \
-v $(PWD):/go/src/$(PACKAGE_PATH_AKO) $(GO_IMG_TEST) \
$(GOTEST) -v -mod=vendor $(PACKAGE_PATH_AKO)/tests/oshiftroutetests -failfast -timeout 0 \
-coverprofile cover-4.out -coverpkg=./... > oshiftroutetests.log 2>&1 && echo "oshiftroutetests passed") || (echo "oshiftroutetests failed" && cat oshiftroutetests.log && exit 1)
.PHONY: bootuptests
bootuptests:
@> bootuptests.log
(sudo docker run \
-e ENDPOINTSLICES_ENABLED=$(ENDPOINTSLICES_ENABLED) \
-w=/go/src/$(PACKAGE_PATH_AKO) \
-v $(PWD):/go/src/$(PACKAGE_PATH_AKO) $(GO_IMG_TEST) \
$(GOTEST) -v -mod=vendor $(PACKAGE_PATH_AKO)/tests/bootuptests -failfast -timeout 0 \
-coverprofile cover-5.out -coverpkg=./... > bootuptests.log 2>&1 && echo "bootuptests passed") || (echo "bootuptests failed" && cat bootuptests.log && exit 1)
.PHONY: multicloudtests
multicloudtests:
@> multicloudtests.log
(sudo docker run \
-e ENDPOINTSLICES_ENABLED=$(ENDPOINTSLICES_ENABLED) \
-w=/go/src/$(PACKAGE_PATH_AKO) \
-v $(PWD):/go/src/$(PACKAGE_PATH_AKO) $(GO_IMG_TEST) \
$(GOTEST) -v -mod=vendor $(PACKAGE_PATH_AKO)/tests/multicloudtests -failfast -timeout 0 \
-coverprofile cover-6.out -coverpkg=./... > multicloudtests.log 2>&1 && echo "multicloudtests passed") || (echo "multicloudtests failed" && cat multicloudtests.log && exit 1)
.PHONY: servicesapitests
servicesapitests:
@> servicesapitests.log
(sudo docker run \
-e ENDPOINTSLICES_ENABLED=$(ENDPOINTSLICES_ENABLED) \
-w=/go/src/$(PACKAGE_PATH_AKO) \
-v $(PWD):/go/src/$(PACKAGE_PATH_AKO) $(GO_IMG_TEST) \
$(GOTEST) -v -mod=vendor $(PACKAGE_PATH_AKO)/tests/servicesapitests -failfast -timeout 0 \
-coverprofile cover-7.out -coverpkg=./... > servicesapitests.log 2>&1 && echo "servicesapitests passed") || (echo "servicesapitests failed" && cat servicesapitests.log && exit 1)
.PHONY: advl4tests
advl4tests:
@> advl4tests.log
(sudo docker run \
-e ENDPOINTSLICES_ENABLED=$(ENDPOINTSLICES_ENABLED) \
-w=/go/src/$(PACKAGE_PATH_AKO) \
-v $(PWD):/go/src/$(PACKAGE_PATH_AKO) $(GO_IMG_TEST) \
$(GOTEST) -v -mod=vendor $(PACKAGE_PATH_AKO)/tests/advl4tests -failfast -timeout 0 \
-coverprofile cover-8.out -coverpkg=./... > advl4tests.log 2>&1 && echo "advl4tests passed") || (echo "advl4tests failed" && cat advl4tests.log && exit 1)
.PHONY: namespacesynctests
namespacesynctests:
@> namespacesynctests.log
(sudo docker run \
-e ENDPOINTSLICES_ENABLED=$(ENDPOINTSLICES_ENABLED) \
-w=/go/src/$(PACKAGE_PATH_AKO) \
-v $(PWD):/go/src/$(PACKAGE_PATH_AKO) $(GO_IMG_TEST) \
$(GOTEST) -v -mod=vendor $(PACKAGE_PATH_AKO)/tests/namespacesynctests -failfast -timeout 0 \
-coverprofile cover-9.out -coverpkg=./... > namespacesynctests.log 2>&1 && echo "namespacesynctests passed") || (echo "namespacesynctests failed" && cat namespacesynctests.log && exit 1)
.PHONY: misc
temp:
@> misc.log
(sudo docker run \
-e ENDPOINTSLICES_ENABLED=$(ENDPOINTSLICES_ENABLED) \
-w=/go/src/$(PACKAGE_PATH_AKO) \
-v $(PWD):/go/src/$(PACKAGE_PATH_AKO) $(GO_IMG_TEST) \
$(GOTEST) -v -mod=vendor $(PACKAGE_PATH_AKO)/tests/temp -failfast > misc.log 2>&1 && echo "misc passed") || (echo "misc failed" && cat misc.log && exit 1)
.PHONY: npltests
npltests:
@> npltests.log
(sudo docker run \
-e ENDPOINTSLICES_ENABLED=$(ENDPOINTSLICES_ENABLED) \
-w=/go/src/$(PACKAGE_PATH_AKO) \
-v $(PWD):/go/src/$(PACKAGE_PATH_AKO) $(GO_IMG_TEST) \
$(GOTEST) -v -mod=vendor $(PACKAGE_PATH_AKO)/tests/npltests -failfast -timeout 0 \
-coverprofile cover-10.out -coverpkg=./... > npltests.log 2>&1 && echo "npltests passed") || (echo "npltests failed" && cat npltests.log && exit 1)
.PHONY: evhtests
evhtests:
@> evhtests.log
(sudo docker run \
-e ENDPOINTSLICES_ENABLED=$(ENDPOINTSLICES_ENABLED) \
-w=/go/src/$(PACKAGE_PATH_AKO) \
-v $(PWD):/go/src/$(PACKAGE_PATH_AKO) $(GO_IMG_TEST) \
$(GOTEST) -v -mod=vendor $(PACKAGE_PATH_AKO)/tests/evhtests -failfast -timeout 0 \
-coverprofile cover-11.out -coverpkg=./... > evhtests.log 2>&1 && echo "evhtests passed") || (echo "evhtests failed" && cat evhtests.log && exit 1)
.PHONY: vippernstests
vippernstests:
@> vippernstests.log
(sudo docker run \
-e ENDPOINTSLICES_ENABLED=$(ENDPOINTSLICES_ENABLED) \
-w=/go/src/$(PACKAGE_PATH_AKO) \
-v $(PWD):/go/src/$(PACKAGE_PATH_AKO) $(GO_IMG_TEST) \
$(GOTEST) -v -mod=vendor $(PACKAGE_PATH_AKO)/tests/evhtests -failfast -timeout 0 -isVipPerNS=true \
-coverprofile cover-12.out -coverpkg=./... > vippernstests.log 2>&1 && echo "vippernstests passed") || (echo "vippernstests failed" && cat vippernstests.log && exit 1)
.PHONY: dedicatedevhtests
dedicatedevhtests:
@> dedicatedevhtests.log
(sudo docker run \
-e ENDPOINTSLICES_ENABLED=$(ENDPOINTSLICES_ENABLED) \
-w=/go/src/$(PACKAGE_PATH_AKO) \
-v $(PWD):/go/src/$(PACKAGE_PATH_AKO) $(GO_IMG_TEST) \
$(GOTEST) -v -mod=vendor $(PACKAGE_PATH_AKO)/tests/dedicatedevhtests -failfast -timeout 0 \
-coverprofile cover-13.out -coverpkg=./... > dedicatedevhtests.log 2>&1 && echo "dedicatedevhtests passed") || (echo "dedicatedevhtests failed" && cat dedicatedevhtests.log && exit 1)
.PHONY: dedicatedvippernstests
dedicatedvippernstests:
@> dedicatedvippernstests.log
(sudo docker run \
-e ENDPOINTSLICES_ENABLED=$(ENDPOINTSLICES_ENABLED) \
-w=/go/src/$(PACKAGE_PATH_AKO) \
-v $(PWD):/go/src/$(PACKAGE_PATH_AKO) $(GO_IMG_TEST) \
$(GOTEST) -v -mod=vendor $(PACKAGE_PATH_AKO)/tests/dedicatedevhtests -failfast -timeout 0 -isVipPerNS=true \
-coverprofile cover-14.out -coverpkg=./... > dedicatedvippernstests.log 2>&1 && echo "dedicatedvippernstests passed") || (echo "dedicatedvippernstests failed" && cat dedicatedvippernstests.log && exit 1)
.PHONY: dedicatedvstests
dedicatedvstests:
@> dedicatedvstests.log
(sudo docker run \
-e ENDPOINTSLICES_ENABLED=$(ENDPOINTSLICES_ENABLED) \
-w=/go/src/$(PACKAGE_PATH_AKO) \
-v $(PWD):/go/src/$(PACKAGE_PATH_AKO) $(GO_IMG_TEST) \
$(GOTEST) -v -mod=vendor $(PACKAGE_PATH_AKO)/tests/dedicatedvstests -failfast -timeout 0 \
-coverprofile cover-15.out -coverpkg=./... > dedicatedvstests.log 2>&1 && echo "dedicatedvstests passed") || (echo "dedicatedvstests failed" && cat dedicatedvstests.log && exit 1)
.PHONY: infratests
infratests:
@> infratests.log
(sudo docker run \
-e ENDPOINTSLICES_ENABLED=$(ENDPOINTSLICES_ENABLED) \
-w=/go/src/$(PACKAGE_PATH_AKO) \
-v $(PWD):/go/src/$(PACKAGE_PATH_AKO) $(GO_IMG_TEST) \
$(GOTEST) -v -mod=vendor $(PACKAGE_PATH_AKO)/tests/infratests -failfast -timeout 0 > infratests.log 2>&1 && echo "infratests passed") || (echo "infratests failed" && cat infratests.log && exit 1)
# .PHONY: multiclusteringresstests
# multiclusteringresstests:
# sudo docker run \
# -w=/go/src/$(PACKAGE_PATH_AKO) \
# -v $(PWD):/go/src/$(PACKAGE_PATH_AKO) $(BUILD_GO_IMG) \
# $(GOTEST) -v -mod=vendor $(PACKAGE_PATH_AKO)/tests/multiclusteringresstests -failfast -coverprofile cover-16.out -coverpkg=./...
.PHONY: hatests
hatests:
@> hatests.log
(sudo docker run \
-e ENDPOINTSLICES_ENABLED=$(ENDPOINTSLICES_ENABLED) \
-w=/go/src/$(PACKAGE_PATH_AKO) \
-v $(PWD):/go/src/$(PACKAGE_PATH_AKO) $(GO_IMG_TEST) \
$(GOTEST) -v -mod=vendor $(PACKAGE_PATH_AKO)/tests/hatests -failfast -timeout 0 \
-coverprofile cover-17.out -coverpkg=./... > hatests.log 2>&1 && echo "hatests passed") || (echo "hatests failed" && cat hatests.log && exit 1)
.PHONY: calicotests
calicotests:
@> calicotests.log
(sudo docker run \
-e ENDPOINTSLICES_ENABLED=$(ENDPOINTSLICES_ENABLED) \
-w=/go/src/$(PACKAGE_PATH_AKO) \
-v $(PWD):/go/src/$(PACKAGE_PATH_AKO) $(GO_IMG_TEST) \
$(GOTEST) -v -mod=vendor $(PACKAGE_PATH_AKO)/tests/cnitests -failfast -timeout 0 -cniPlugin=calico \
-coverprofile cover-18.out -coverpkg=./... > calicotests.log 2>&1 && echo "calicotests passed") || (echo "calicotests failed" && cat calicotests.log && exit 1)
.PHONY: ciliumtests
ciliumtests:
@> ciliumtests.log
(sudo docker run \
-e ENDPOINTSLICES_ENABLED=$(ENDPOINTSLICES_ENABLED) \
-w=/go/src/$(PACKAGE_PATH_AKO) \
-v $(PWD):/go/src/$(PACKAGE_PATH_AKO) $(GO_IMG_TEST) \
$(GOTEST) -v -mod=vendor $(PACKAGE_PATH_AKO)/tests/cnitests -failfast -timeout 0 -cniPlugin=cilium \
-coverprofile cover-19.out -coverpkg=./... > ciliumtests.log 2>&1 && echo "ciliumtests passed") || (echo "ciliumtests failed" && cat ciliumtests.log && exit 1)
.PHONY: helmtests
helmtests:
@> helmtests.log
(sudo docker run \
-u root:root \
-v $(PWD)/helm/ako:/apps \
-v $(PWD)/tests/helmtests:/apps/tests \
avi-buildops-docker-registry-02-lv.avilb.broadcom.net:8080/avi-buildops/helmunittest/helm-unittest:3.11.1-0.3.0 . > helmtests.log 2>&1 && echo "helmtests passed") || (echo "helmtests failed" && cat helmtests.log && exit 1)
.PHONY: gatewayapi_ingestiontests
gatewayapi_ingestiontests:
@> gatewayapi_ingestiontests.log
(sudo docker run \
-e ENDPOINTSLICES_ENABLED=$(ENDPOINTSLICES_ENABLED) \
-w=/go/src/$(PACKAGE_PATH_AKO) \
-v $(PWD):/go/src/$(PACKAGE_PATH_AKO) $(GO_IMG_TEST) \
$(GOTEST) -v -mod=vendor $(PACKAGE_PATH_AKO)/tests/gatewayapitests/ingestion -failfast -timeout 0 \
-coverprofile cover-20.out -coverpkg=./ako-gateway-api/k8s/... > gatewayapi_ingestiontests.log 2>&1 && echo "gatewayapi_ingestiontests passed") || (echo "gatewayapi_ingestiontests failed" && cat gatewayapi_ingestiontests.log && exit 1)
.PHONY: gatewayapi_graphlayertests
gatewayapi_graphlayertests:
@> gatewayapi_graphlayertests.log
(sudo docker run \
-e ENDPOINTSLICES_ENABLED=$(ENDPOINTSLICES_ENABLED) \
-w=/go/src/$(PACKAGE_PATH_AKO) \
-v $(PWD):/go/src/$(PACKAGE_PATH_AKO) $(GO_IMG_TEST) \
$(GOTEST) -v -mod=vendor $(PACKAGE_PATH_AKO)/tests/gatewayapitests/graphlayer -failfast -timeout 0 \
-coverprofile cover-21.out -coverpkg=./ako-gateway-api/nodes/...,./ako-gateway-api/lib/...,./ako-gateway-api/objects/... > gatewayapi_graphlayertests.log 2>&1 && echo "gatewayapi_graphlayertests passed") || (echo "gatewayapi_graphlayertests failed" && cat gatewayapi_graphlayertests.log && exit 1)
.PHONY: gatewayapi_statustests
gatewayapi_statustests:
@> gatewayapi_statustests.log
(sudo docker run \
-e ENDPOINTSLICES_ENABLED=$(ENDPOINTSLICES_ENABLED) \
-w=/go/src/$(PACKAGE_PATH_AKO) \
-v $(PWD):/go/src/$(PACKAGE_PATH_AKO) $(GO_IMG_TEST) \
$(GOTEST) -v -mod=vendor $(PACKAGE_PATH_AKO)/tests/gatewayapitests/status -failfast -timeout 0 \
-coverprofile cover-22.out -coverpkg=./ako-gateway-api/status/... > gatewayapi_statustests.log 2>&1 && echo "gatewayapi_statustests passed") || (echo "gatewayapi_statustests failed" && cat gatewayapi_statustests.log && exit 1)
.PHONY: gatewayapi_npltests
gatewayapi_npltests:
@> gatewayapi_npltests.log
(sudo docker run \
-e ENDPOINTSLICES_ENABLED=$(ENDPOINTSLICES_ENABLED) \
-w=/go/src/$(PACKAGE_PATH_AKO) \
-v $(PWD):/go/src/$(PACKAGE_PATH_AKO) $(GO_IMG_TEST) \
$(GOTEST) -v -mod=vendor $(PACKAGE_PATH_AKO)/tests/gatewayapitests/npltests -failfast -timeout 0 \
-coverprofile cover-23.out -coverpkg=./ako-gateway-api/... > gatewayapi_npltests.log 2>&1 && echo "gatewayapi_npltests passed") || (echo "gatewayapi_npltests failed" && cat gatewayapi_npltests.log && exit 1)
.PHONY: multitenancytests
multitenancytests:
@> multitenancytests.log
(sudo docker run \
-e ENDPOINTSLICES_ENABLED=$(ENDPOINTSLICES_ENABLED) \
-w=/go/src/$(PACKAGE_PATH_AKO) \
-v $(PWD):/go/src/$(PACKAGE_PATH_AKO) $(GO_IMG_TEST) \
$(GOTEST) -v -mod=vendor $(PACKAGE_PATH_AKO)/tests/multitenancytests -failfast -timeout 0 -coverprofile cover-24.out -coverpkg=./... > multitenancytests.log 2>&1 && echo "multitenancytests passed") || (echo "multitenancytests failed" && cat multitenancytests.log && exit 1)
.PHONY: urltests
urltests:
@> urltests.log
(sudo docker run \
-e ENDPOINTSLICES_ENABLED=$(ENDPOINTSLICES_ENABLED) \
-w=/go/src/$(PACKAGE_PATH_AKO) \
-v $(PWD):/go/src/$(PACKAGE_PATH_AKO) $(GO_IMG_TEST) \
$(GOTEST) -v -mod=vendor $(PACKAGE_PATH_AKO)/tests/urltests -failfast -coverprofile cover-25.out -coverpkg=./... > urltests.log 2>&1 && echo "urltests passed") || (echo "urltests failed" && cat urltests.log && exit 1)
.PHONY: gatewayapi_tests
gatewayapi_tests:
@> gatewayapi_tests.log
(make -j 4 --output-sync=target gatewayapi_ingestiontests gatewayapi_graphlayertests gatewayapi_statustests gatewayapi_npltests ENDPOINTSLICES_ENABLED="true" > gatewayapi_tests.log 2>&1 && echo "gatewayapi_tests passed") || (echo "gatewayapi_tests failed" && cat gatewayapi_tests.log && exit 1)
.PHONY: informers_tests
informers_tests:
@> informers_tests.log
(sudo docker run \
-e ENDPOINTSLICES_ENABLED=$(ENDPOINTSLICES_ENABLED) \
-w=/go/src/$(PACKAGE_PATH_AKO) \
-v $(PWD):/go/src/$(PACKAGE_PATH_AKO) $(GO_IMG_TEST) \
$(GOTEST) -v -mod=vendor $(INFORMERS_PACKAGES) -failfast -timeout 0 \
-coverprofile cover-26.out -coverpkg=./... > informers_tests.log 2>&1 && echo "informers_tests passed") || (echo "informers_tests failed" && cat informers_tests.log && exit 1)
.PHONY: int_test
int_test:
@> int_test.log
(make -j 8 --output-sync=target k8stest integrationtest ingresstests \
evhtests vippernstests dedicatedevhtests dedicatedvippernstests \
oshiftroutetests bootuptests multicloudtests advl4tests \
namespacesynctests servicesapitests npltests misc \
dedicatedvstests hatests calicotests ciliumtests \
helmtests infratests urltests multitenancytests gatewayapi_ingestiontests gatewayapi_graphlayertests \
gatewayapi_statustests gatewayapi_npltests informers_tests ENDPOINTSLICES_ENABLED="true" > int_test.log 2>&1 \
&& echo "int_test succeeded" && buffer -i int_test.log -u 1000 -z 1k) \
|| (echo "int_test failed" && (buffer -i int_test.log -u 2000 -z 1b || \
echo "Dumping the whole log failed; here are the last 100 lines" && tail -n100 int_test.log ) && exit 1)
.PHONY: eps_enabled
eps_enabled:
make -j 1 k8stest integrationtest ingresstests evhtests dedicatedevhtests oshiftroutetests npltests dedicatedvstests gatewayapitests ENDPOINTSLICES_ENABLED="true"
.PHONY: scale_test
scale_test:
sudo docker run \
-w=/go/src/$(PACKAGE_PATH_AKO) \
--mount type=bind,source=$(TestbedFilePath),target=$(TestbedFilePath) \
--mount type=bind,source=$(KubeConfigFileName),target=$(KubeConfigFileName) \
-v $(PWD):/go/src/$(PACKAGE_PATH_AKO) $(GO_IMG_TEST) \
$(GOTEST) -v -mod=vendor $(PACKAGE_PATH_AKO)/tests/scaletest -failfast -test.timeout=$(Timeout) \
-kubeConfigFileName=$(KubeConfigFileName) -testbedFileName=$(TestbedFilePath) -numGoRoutines=$(NumGoRoutines) \
-numOfLBSvc=$(NumOfLBSvc) -numOfIng=$(NumOfIng)
# linting and formatting
GO_FILES := $(shell find . -type d -path ./vendor -prune -o -type f -name '*.go' -print)
.PHONY: fmt
fmt:
@echo
@echo "Formatting Go files"
@gofmt -s -l -w $(GO_FILES)
.golangci-bin:
@echo "Installing Golangci-lint"
@curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $@ v1.64.7
.PHONY: golangci
golangci: .golangci-bin
@echo "Running golangci"
@GOOS=linux GOGC=1 .golangci-bin/golangci-lint run -c .golangci.yml
.PHONY: golangci-fix
golangci-fix: .golangci-bin
@echo "Running golangci-fix"
@GOOS=linux GOGC=1 .golangci-bin/golangci-lint run -c .golangci.yml --fix