Skip to content

Commit fd76a65

Browse files
committed
Revise all e2e tests to use the kind cluster with local registry
Signed-off-by: Ye Cao <[email protected]>
1 parent 678cb08 commit fd76a65

File tree

27 files changed

+285
-122
lines changed

27 files changed

+285
-122
lines changed

.github/workflows/vineyard-operator.yaml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,13 @@ jobs:
122122
registry: ghcr.io
123123
username: ${{ github.actor }}
124124
password: ${{ secrets.GITHUB_TOKEN }}
125-
125+
126+
- name: Build a kind cluster with local registry
127+
run: |
128+
touch /tmp/e2e-k8s.config
129+
export KUBECONFIG=/tmp/e2e-k8s.config
130+
bash k8s/test/hack/build-kind-cluster-with-local-registry.sh
131+
126132
- name: Build docker image
127133
run: |
128134
make -C k8s docker-build
@@ -179,7 +185,7 @@ jobs:
179185
e2e-file: k8s/test/e2e/failover/e2e.yaml
180186

181187
- name: e2e-tests-repartition-dask
182-
if: false ## "No space left on device" error on CI. ${{ matrix.job == 'e2e-tests-repartition-dask' }}
188+
if: ${{ matrix.job == 'e2e-tests-repartition-dask' }}
183189
uses: apache/skywalking-infra-e2e@main
184190
with:
185191
e2e-file: k8s/test/e2e/repartition/dask-repartition-e2e.yaml

k8s/Makefile

Lines changed: 96 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ KUSTOMIZE_VERSION ?= [email protected]
4646
CONTROLLER_TOOLS_VERSION ?= v0.9.2
4747
GOLANGCI_LINT_VERSION ?= v1.49.0
4848
HELMIFY_VERSION ?= v0.3.18
49-
E2E_VERSION ?= afdf1cca0519d65bc480d8680b7a27f9b41fc421
49+
E2E_VERSION ?= 2631e76926604c4e30ca170bed916804c86980b6
5050

5151
all: manager
5252

@@ -56,68 +56,116 @@ check: lint e2e-test
5656

5757
# Build a 4-nodes(1 master and 3 workers) kind cluster with local registry
5858
build-local-cluster:
59-
bash test/hack/build-kind-cluster-with-local-registry.sh $(name)
59+
@touch /tmp/e2e-k8s.config
60+
@echo "the kubeconfig path is /tmp/e2e-k8s.config"
61+
@echo "Creating the kind cluster with local registry"
62+
@bash test/hack/build-kind-cluster-with-local-registry.sh
6063
.PHONY: build-local-cluster
6164

62-
# Run e2e tests
63-
e2e-test: e2e prepare-e2e-test vineyardd-e2e-test serialize-e2e-test spill-e2e-test autogenerated-helm-chart-e2e-test local-assembly-e2e-test distributed-assembly-e2e-test repartition-e2e-test sidecar-e2e-test
64-
@echo "All e2e test2 passed!"
65-
.PHONY: e2e-test
65+
delete-local-cluster:
66+
@rm /tmp/e2e-k8s.config
67+
@echo "Deleting the kind cluster with local registry"
68+
@bash test/hack/delete-kind-cluster-with-local-registry.sh
69+
.PHONY: delete-local-cluster
6670

67-
prepare-e2e-test:
71+
prepare-e2e-test: e2e
6872
@echo "Install e2e test dependencies..."
69-
sudo bash test/hack/prepare-e2e.sh
73+
@sudo bash test/hack/prepare-e2e.sh
7074
@echo "Build vineyard operator image..."
71-
make docker-build
75+
@make docker-build
7276
.PHONY: prepare-e2e-test
7377

74-
vineyardd-e2e-test:
75-
@echo "Running vineyardd e2e test..."
76-
cd .. && ${GOBIN}/e2e run --config=k8s/test/e2e/vineyardd/e2e.yaml
77-
@echo "vineyardd e2e test passed."
78-
.PHONY: vineyardd-e2e-test
79-
80-
serialize-e2e-test:
81-
@echo "Running serialize e2e test..."
82-
cd .. && ${GOBIN}/e2e run --config=k8s/test/e2e/serialize/e2e.yaml
83-
@echo "serialize e2e test passed."
84-
.PHONY: serialize-e2e-test
85-
86-
spill-e2e-test:
87-
@echo "Running spill e2e test..."
88-
cd .. && ${GOBIN}/e2e run --config=k8s/test/e2e/spill/e2e.yaml
89-
@echo "spill e2e test passed."
90-
.PHONY: spill-e2e-test
91-
92-
autogenerated-helm-chart-e2e-test:
93-
@echo "Running autogenerated helm chart e2e test..."
94-
cd .. && ${GOBIN}/e2e run --config=k8s/test/e2e/autogenerated-helm-chart/e2e.yaml
95-
@echo "autogenerated helm chart e2e test passed."
96-
.PHONY: autogenerated-helm-chart-e2e-test
97-
98-
local-assembly-e2e-test:
78+
e2e-tests:
79+
80+
e2e-tests-assembly-local: prepare-e2e-test build-local-cluster kustomize
9981
@echo "Running local assembly e2e test..."
100-
cd .. && ${GOBIN}/e2e run --config=k8s/test/e2e/assembly/local-assembly-e2e.yaml
82+
@cd .. && ${GOBIN}/e2e run --config=k8s/test/e2e/assembly/local-assembly-e2e.yaml
10183
@echo "local assembly e2e test passed."
102-
.PHONY: local-assembly-e2e-test
84+
@# the next step is recover the default vineyard operator image(vineyardcloudnative/vineyard-operator)
85+
@cd config/manager && $(KUSTOMIZE) edit set image controller=${IMG}
86+
@make delete-local-cluster
87+
.PHONY: e2e-tests-assembly-local
10388

104-
distributed-assembly-e2e-test:
89+
e2e-tests-assembly-distributed: prepare-e2e-test build-local-cluster
10590
@echo "Running distributed assembly e2e test..."
106-
cd .. && ${GOBIN}/e2e run --config=k8s/test/e2e/assembly/distributed-assembly-e2e.yaml
91+
@cd .. && ${GOBIN}/e2e run --config=k8s/test/e2e/assembly/distributed-assembly-e2e.yaml
10792
@echo "distributed assembly e2e test passed."
108-
.PHONY: distributed-assembly-e2e-test
93+
@# the next step is recover the default vineyard operator image(vineyardcloudnative/vineyard-operator)
94+
@cd config/manager && $(KUSTOMIZE) edit set image controller=${IMG}
95+
@make delete-local-cluster
96+
.PHONY: e2e-tests-assembly-distributed
10997

110-
repartition-e2e-test:
111-
@echo "Running repartition e2e test..."
112-
cd .. && ${GOBIN}/e2e run --config=k8s/test/e2e/repartition/e2e.yaml
113-
@echo "repartition e2e test passed."
114-
.PHONY: repartition-e2e-test
98+
e2e-tests-autogenerated-helm-chart: prepare-e2e-test build-local-cluster
99+
@echo "Running autogenerated helm chart e2e test..."
100+
@cd .. && ${GOBIN}/e2e run --config=k8s/test/e2e/autogenerated-helm-chart/e2e.yaml
101+
@echo "autogenerated helm chart e2e test passed."
102+
@# the next step is recover the default vineyard operator image(vineyardcloudnative/vineyard-operator)
103+
@cd config/manager && $(KUSTOMIZE) edit set image controller=${IMG}
104+
@make delete-local-cluster
105+
.PHONY: e2e-tests-autogenerated-helm-chart
106+
107+
e2e-tests-failover: prepare-e2e-test build-local-cluster
108+
@echo "Running failover e2e test..."
109+
@cd .. && ${GOBIN}/e2e run --config=k8s/test/e2e/failover/e2e.yaml
110+
@echo "failover e2e test passed."
111+
@# the next step is recover the default vineyard operator image(vineyardcloudnative/vineyard-operator)
112+
@cd config/manager && $(KUSTOMIZE) edit set image controller=${IMG}
113+
@make delete-local-cluster
114+
.PHONY: e2e-tests-failover
115+
116+
e2e-tests-repartition-dask: prepare-e2e-test build-local-cluster
117+
@echo "Running repartition dask e2e test..."
118+
@cd .. && ${GOBIN}/e2e run --config=k8s/test/e2e/repartition/dask-repartition-e2e.yaml
119+
@echo "repartition dask e2e test passed."
120+
@# the next step is recover the default vineyard operator image(vineyardcloudnative/vineyard-operator)
121+
@cd config/manager && $(KUSTOMIZE) edit set image controller=${IMG}
122+
@make delete-local-cluster
123+
.PHONY: e2e-tests-repartition-dask
124+
125+
e2e-tests-scheduler-outside-cluster: prepare-e2e-test build-local-cluster
126+
@echo "Running scheduler outside cluster e2e test..."
127+
@cd .. && ${GOBIN}/e2e run --config=k8s/test/e2e/scheduling-outside-cluster/e2e.yaml
128+
@echo "scheduler outside cluster e2e test passed."
129+
@# the next step is recover the default vineyard operator image(vineyardcloudnative/vineyard-operator)
130+
@cd config/manager && $(KUSTOMIZE) edit set image controller=${IMG}
131+
@make delete-local-cluster
132+
.PHONY: e2e-tests-scheduler-outside-cluster
133+
134+
e2e-tests-serialize: prepare-e2e-test build-local-cluster
135+
@echo "Running serialize e2e test..."
136+
@cd .. && ${GOBIN}/e2e run --config=k8s/test/e2e/serialize/e2e.yaml
137+
@echo "serialize e2e test passed."
138+
@# the next step is recover the default vineyard operator image(vineyardcloudnative/vineyard-operator)
139+
@cd config/manager && $(KUSTOMIZE) edit set image controller=${IMG}
140+
@make delete-local-cluster
141+
.PHONY: e2e-tests-serialize
115142

116-
sidecar-e2e-test:
143+
e2e-tests-sidecar: prepare-e2e-test build-local-cluster
117144
@echo "Running sidecar e2e test..."
118-
cd .. && ${GOBIN}/e2e run --config=k8s/test/e2e/sidecar/e2e.yaml
145+
@cd .. && ${GOBIN}/e2e run --config=k8s/test/e2e/sidecar/e2e.yaml
119146
@echo "sidecar e2e test passed."
120-
.PHONY: sidecar-e2e-test
147+
@# the next step is recover the default vineyard operator image(vineyardcloudnative/vineyard-operator)
148+
@cd config/manager && $(KUSTOMIZE) edit set image controller=${IMG}
149+
@make delete-local-cluster
150+
.PHONY: e2e-tests-sidecar
151+
152+
e2e-tests-spill: prepare-e2e-test build-local-cluster
153+
@echo "Running spill e2e test..."
154+
@cd .. && ${GOBIN}/e2e run --config=k8s/test/e2e/spill/e2e.yaml
155+
@echo "spill e2e test passed."
156+
@# the next step is recover the default vineyard operator image(vineyardcloudnative/vineyard-operator)
157+
@cd config/manager && $(KUSTOMIZE) edit set image controller=${IMG}
158+
@make delete-local-cluster
159+
.PHONY: e2e-tests-spill
160+
161+
e2e-tests-workflow: prepare-e2e-test build-local-cluster
162+
@echo "Running workflow e2e test..."
163+
@cd .. && ${GOBIN}/e2e run --config=k8s/test/e2e/workflow/e2e.yaml
164+
@echo "workflow e2e test passed."
165+
@# the next step is recover the default vineyard operator image(vineyardcloudnative/vineyard-operator)
166+
@cd config/manager && $(KUSTOMIZE) edit set image controller=${IMG}
167+
@make delete-local-cluster
168+
.PHONY: e2e-tests-workflow
121169

122170
# Build manager binary
123171
manager: generate fmt
@@ -196,7 +244,7 @@ helmify:
196244
# Install e2e if not exist
197245
e2e:
198246
ifeq (${E2E},)
199-
@echo "helmify not exist, installing it..."
247+
@echo "e2e not exist, installing it..."
200248
go install github.com/apache/skywalking-infra-e2e/cmd/e2e@$(E2E_VERSION)
201249
endif
202250
@echo "e2e installed"

k8s/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,11 @@ To deploy the vineyard operator, run
3434
```bash
3535
make deploy
3636
```
37+
38+
### Test
39+
40+
You could create a default kind cluster and run a specific e2e test locally as follows.
41+
42+
```bash
43+
make -C k8s e2e-tests-assembly-local
44+
```

k8s/pkg/templates/operation/dask-repartition.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ spec:
2525
spec:
2626
containers:
2727
- name: dask-repartition-operation
28-
image: ghcr.io/v6d-io/v6d/dask-repartition
28+
image: localhost:5001/dask-repartition
2929
imagePullPolicy: IfNotPresent
3030
env:
3131
- name: GLOBALOBJECT_ID

k8s/test/e2e/Makefile

Lines changed: 44 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1+
# setup the registry
2+
DEFAULT_REGISTRY := ghcr.io/v6d-io/v6d
13
ifeq ($(REGISTRY),)
2-
REGISTRY := ghcr.io/v6d-io/v6d
4+
REGISTRY := $(DEFAULT_REGISTRY)
35
endif
46

57
TAG ?= latest
@@ -9,15 +11,24 @@ push-%: %
911
docker push $(REGISTRY)/$<
1012
.PHONY: push-%
1113

14+
# the phony is to change the image's registry to the default registry(ghcr.io/v6d-io/v6d)
15+
# as it's hard-coded in the vineyard-operator, such as assembly、repartition、backup、recover etc.
16+
tag-%: %
17+
docker tag $(REGISTRY)/$< $(DEFAULT_REGISTRY)/$<
18+
.PHONY: tag-%
19+
1220
load-%: %
13-
kind load docker-image --name $(KIND) $(REGISTRY)/$<
21+
kind load docker-image --name $(KIND) $(DEFAULT_REGISTRY)/$<
1422
.PHONY: load-%
1523

1624
############# assembly testing ################################################
1725

26+
# build and tag local assembly image, as it's hard-coded in the vineyard operator templates
27+
build-assembly-job: local-assembly tag-local-assembly load-local-assembly
28+
1829
local-assembly-images: local-assembly assembly-job1 assembly-job2
1930
publish-local-assembly-images: push-local-assembly push-assembly-job1 push-assembly-job2
20-
kind-load-local-assembly-images: load-local-assembly load-assembly-job1 load-assembly-job2
31+
e2e-test-assembly: build-assembly-job push-assembly-job1 push-assembly-job2
2132

2233
local-assembly:
2334
docker build assembly-demo/ -f Dockerfile \
@@ -39,9 +50,12 @@ assembly-job2:
3950

4051
############# distributed assembly testing ####################################
4152

53+
# build and tag distributed assembly image, as it's hard-coded in the vineyard operator templates
54+
build-distributed-assembly-job: distributed-assembly tag-distributed-assembly load-distributed-assembly
55+
4256
distributed-assembly-images: distributed-assembly distributed-assembly-job1 distributed-assembly-job2 distributed-assembly-job3
4357
publish-distributed-assembly-images: push-distributed-assembly push-distributed-assembly-job1 push-distributed-assembly-job2 push-distributed-assembly-job3
44-
kind-load-distributed-assembly-images: load-distributed-assembly load-distributed-assembly-job1 load-distributed-assembly-job2 load-distributed-assembly-job3
58+
e2e-test-distributed-assembly: build-distributed-assembly-job push-distributed-assembly-job1 push-distributed-assembly-job2 push-distributed-assembly-job3
4559

4660
distributed-assembly:
4761
docker build assembly-demo/ -f Dockerfile \
@@ -73,7 +87,7 @@ distributed-assembly-job3:
7387

7488
serialize-images: serialize-job
7589
publish-serialize-images: push-serialize-job
76-
kind-load-serialize-images: load-serialize-job
90+
e2e-test-serialize: push-serialize-job
7791

7892
serialize-job:
7993
docker build . -f Dockerfile \
@@ -83,9 +97,14 @@ serialize-job:
8397

8498
############# failover testing ################################################
8599

100+
# build and tag backup image, as it's hard-coded in the vineyard operator templates
101+
build-backup-job: backup-job tag-backup-job load-backup-job
102+
# build and tag recover image, as it's hard-coded in the vineyard operator templates
103+
build-recover-job: recover-job tag-recover-job load-recover-job
104+
86105
failover-images: backup-job recover-job build-local-object build-distributed-object-step1 build-distributed-object-step2 get-local-object get-distributed-object
87106
publish-failover-images: push-backup-job push-recover-job push-build-local-object push-build-distributed-object-step1 push-build-distributed-object-step2 push-get-local-object push-get-distributed-object
88-
kind-load-failover-images: load-backup-job load-recover-job load-build-local-object load-build-distributed-object-step1 load-build-distributed-object-step2 load-get-local-object load-get-distributed-object
107+
e2e-test-failover: build-backup-job build-recover-job push-build-local-object push-build-distributed-object-step1 push-build-distributed-object-step2 push-get-local-object push-get-distributed-object
89108

90109
backup-job:
91110
docker build failover-demo/ -f Dockerfile \
@@ -131,9 +150,12 @@ get-distributed-object:
131150

132151
############# repartition testing #############################################
133152

153+
# build and tag dask repartition image, as it's hard-coded in the vineyard operator templates
154+
build-repartition-job: dask-repartition tag-dask-repartition load-dask-repartition
155+
134156
repartition-images: dask-repartition dask-repartition-job1 dask-repartition-job2 dask-worker-with-vineyard
135157
publish-repartition-images: push-dask-repartition push-dask-repartition-job1 push-dask-repartition-job2 push-dask-worker-with-vineyard
136-
kind-load-repartition-images: load-dask-repartition load-dask-repartition-job1 load-dask-repartition-job2 load-dask-worker-with-vineyard
158+
e2e-test-repartition: build-repartition-job push-dask-repartition-job1 push-dask-repartition-job2 push-dask-worker-with-vineyard
137159

138160
dask-repartition:
139161
docker build repartition-demo/ -f Dockerfile \
@@ -165,7 +187,7 @@ dask-worker-with-vineyard:
165187

166188
sidecar-images: sidecar-job
167189
publish-sidecar-images: push-sidecar-job
168-
kind-load-sidecar-images: load-sidecar-job
190+
e2e-test-sidecar: push-sidecar-job
169191

170192
sidecar-job:
171193
docker build sidecar-demo/ -f Dockerfile \
@@ -177,7 +199,7 @@ sidecar-job:
177199

178200
workflow-images: workflow-job1 workflow-job2
179201
publish-workflow-images: push-workflow-job1 push-workflow-job2
180-
kind-load-workflow-images: load-workflow-job1 load-workflow-job2
202+
e2e-test-workflow: push-workflow-job1 push-workflow-job2
181203

182204
workflow-job1:
183205
docker build workflow-demo/ -f Dockerfile \
@@ -190,3 +212,16 @@ workflow-job2:
190212
--build-arg APP=job2.py \
191213
-t $(REGISTRY)/workflow-job2:$(TAG)
192214
.PHONY: workflow-job2
215+
216+
# publish all images to ghcr registry
217+
ALL-IMAGES ?= \
218+
publish-local-assembly-images \
219+
publish-distributed-assembly-images \
220+
publish-serialize-images \
221+
publish-failover-images \
222+
publish-repartition-images \
223+
publish-sidecar-images \
224+
publish-workflow-images
225+
226+
publish-all-images: $(ALL-IMAGES)
227+
.PHONY: publish-all-images

k8s/test/e2e/assembly-demo/assembly-job.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ spec:
4949
{{- end }}
5050
containers:
5151
- name: {{ (datasource "config").$job.jobName }}
52-
image: ghcr.io/v6d-io/v6d/{{ (datasource "config").$job.jobName }}
52+
image: localhost:5001/{{ (datasource "config").$job.jobName }}
5353
env:
5454
- name: JOB_NAME
5555
value: {{ (datasource "config").$job.jobName }}

k8s/test/e2e/assembly/distributed-assembly-e2e.yaml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
# Test assembly operation in different node
1717
setup:
1818
env: kind
19-
file: ../kind.yaml
19+
kubeconfig: /tmp/e2e-k8s.config
2020
steps:
2121
- name: install cert-manager
2222
command: |
@@ -25,16 +25,19 @@ setup:
2525
- namespace: cert-manager
2626
resource: pod
2727
for: condition=Ready
28-
- name: install scheduler-plugin and operator
28+
- name: install vineyard operator
2929
command: |
30-
kind load docker-image vineyardcloudnative/vineyard-operator:latest
30+
docker tag vineyardcloudnative/vineyard-operator:latest localhost:5001/vineyard-operator:latest
31+
docker push localhost:5001/vineyard-operator:latest
32+
export IMG=localhost:5001/vineyard-operator:latest
3133
make -C k8s deploy
32-
33-
make -C k8s/test/e2e kind-load-distributed-assembly-images
3434
wait:
3535
- namespace: vineyard-system
3636
resource: deployment/vineyard-controller-manager
3737
for: condition=Available
38+
- name: download all distributed assembly images into kind cluster
39+
command: |
40+
make -C k8s/test/e2e e2e-test-distributed-assembly REGISTRY=localhost:5001
3841
- name: install vineyardd
3942
command: |
4043
kubectl apply -f k8s/test/e2e/vineyardd.yaml

0 commit comments

Comments
 (0)