Skip to content

Commit 3524bf7

Browse files
committed
move kind tests to a script
Signed-off-by: Koray Oksay <koray.oksay@gmail.com>
1 parent 1245aa4 commit 3524bf7

File tree

6 files changed

+59
-269
lines changed

6 files changed

+59
-269
lines changed
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
#!/bin/bash
2+
3+
CLUSTER_NAME="kind-test"
4+
KIND_CONFIG="kind-config.yaml"
5+
6+
sudo sysctl fs.inotify.max_user_instances=1280
7+
sudo sysctl fs.inotify.max_user_watches=655360
8+
9+
cat <<EOF > $KIND_CONFIG
10+
kind: Cluster
11+
apiVersion: kind.x-k8s.io/v1alpha4
12+
nodes:
13+
- role: control-plane
14+
- role: worker
15+
- role: worker
16+
EOF
17+
18+
echo "[*] Creating Kind cluster..."
19+
kind create cluster --name $CLUSTER_NAME --config $KIND_CONFIG
20+
21+
kubectl wait --for=condition=Ready nodes --all --timeout=120s
22+
23+
echo "[*] Creating pod ..."
24+
kubectl apply -f - <<EOF
25+
apiVersion: v1
26+
kind: Pod
27+
metadata:
28+
name: nginx
29+
spec:
30+
containers:
31+
- name: nginx
32+
image: nginx:latest
33+
resources:
34+
requests:
35+
memory: "256Mi"
36+
cpu: "100m"
37+
limits:
38+
memory: "256Mi"
39+
cpu: "500m"
40+
EOF
41+
42+
echo "[*] Waiting for pods to be ready..."
43+
kubectl wait --for=condition=Ready pod/nginx --timeout=300s
44+
45+
echo "[*] Pods running, doing test workload..."
46+
sleep 60
47+
48+
echo "[*] Deleting pods..."
49+
kubectl delete pod nginx
50+
51+
echo "[*] Deleting Kind cluster..."
52+
kind delete cluster --name $CLUSTER_NAME
53+
54+
echo "[*] Done!"

.github/workflows/change-file-build-new-actions-arm-vm.yml

Lines changed: 1 addition & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -173,59 +173,7 @@ jobs:
173173
cat /proc/cpuinfo
174174
175175
- name: Run kind cluster
176-
run: |
177-
CLUSTER_NAME="kind-test"
178-
KIND_CONFIG="kind-config.yaml"
179-
180-
sudo sysctl fs.inotify.max_user_instances=1280
181-
sudo sysctl fs.inotify.max_user_watches=655360
182-
183-
cat <<EOF > $KIND_CONFIG
184-
kind: Cluster
185-
apiVersion: kind.x-k8s.io/v1alpha4
186-
nodes:
187-
- role: control-plane
188-
- role: worker
189-
- role: worker
190-
EOF
191-
192-
echo "[*] Creating Kind cluster..."
193-
kind create cluster --name $CLUSTER_NAME --config $KIND_CONFIG
194-
195-
kubectl wait --for=condition=Ready nodes --all --timeout=120s
196-
197-
echo "[*] Creating pod ..."
198-
kubectl apply -f - <<EOF
199-
apiVersion: v1
200-
kind: Pod
201-
metadata:
202-
name: nginx
203-
spec:
204-
containers:
205-
- name: nginx
206-
image: nginx:latest
207-
resources:
208-
requests:
209-
memory: "256Mi"
210-
cpu: "100m"
211-
limits:
212-
memory: "256Mi"
213-
cpu: "500m"
214-
EOF
215-
216-
echo "[*] Waiting for pods to be ready..."
217-
kubectl wait --for=condition=Ready pod/nginx --timeout=300s
218-
219-
echo "[*] Pods running, doing test workload..."
220-
sleep 60
221-
222-
echo "[*] Deleting pods..."
223-
kubectl delete pod nginx
224-
225-
echo "[*] Deleting Kind cluster..."
226-
kind delete cluster --name $CLUSTER_NAME
227-
228-
echo "[*] Done!"
176+
run: ${{ github.workspace }}/.github/scripts/test_with_kind_cluster.sh
229177

230178
release-new-image:
231179
runs-on: ubuntu-latest

.github/workflows/change-file-build-new-actions-vm.yml

Lines changed: 1 addition & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -190,59 +190,7 @@ jobs:
190190
cat /proc/cpuinfo
191191
192192
- name: Run kind cluster
193-
run: |
194-
CLUSTER_NAME="kind-test"
195-
KIND_CONFIG="kind-config.yaml"
196-
197-
sudo sysctl fs.inotify.max_user_instances=1280
198-
sudo sysctl fs.inotify.max_user_watches=655360
199-
200-
cat <<EOF > $KIND_CONFIG
201-
kind: Cluster
202-
apiVersion: kind.x-k8s.io/v1alpha4
203-
nodes:
204-
- role: control-plane
205-
- role: worker
206-
- role: worker
207-
EOF
208-
209-
echo "[*] Creating Kind cluster..."
210-
kind create cluster --name $CLUSTER_NAME --config $KIND_CONFIG
211-
212-
kubectl wait --for=condition=Ready nodes --all --timeout=120s
213-
214-
echo "[*] Creating pod ..."
215-
kubectl apply -f - <<EOF
216-
apiVersion: v1
217-
kind: Pod
218-
metadata:
219-
name: nginx
220-
spec:
221-
containers:
222-
- name: nginx
223-
image: nginx:latest
224-
resources:
225-
requests:
226-
memory: "256Mi"
227-
cpu: "100m"
228-
limits:
229-
memory: "256Mi"
230-
cpu: "500m"
231-
EOF
232-
233-
echo "[*] Waiting for pods to be ready..."
234-
kubectl wait --for=condition=Ready pod/nginx --timeout=300s
235-
236-
echo "[*] Pods running, doing test workload..."
237-
sleep 60
238-
239-
echo "[*] Deleting pods..."
240-
kubectl delete pod nginx
241-
242-
echo "[*] Deleting Kind cluster..."
243-
kind delete cluster --name $CLUSTER_NAME
244-
245-
echo "[*] Done!"
193+
run: ${{ github.workspace }}/.github/scripts/test_with_kind_cluster.sh
246194

247195
release-new-image:
248196
runs-on: ubuntu-latest

.github/workflows/periodic-build-new-actions-arm-vm.yml

Lines changed: 1 addition & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -192,59 +192,7 @@ jobs:
192192
cat /proc/cpuinfo
193193
194194
- name: Run kind cluster
195-
run: |
196-
CLUSTER_NAME="kind-test"
197-
KIND_CONFIG="kind-config.yaml"
198-
199-
sudo sysctl fs.inotify.max_user_instances=1280
200-
sudo sysctl fs.inotify.max_user_watches=655360
201-
202-
cat <<EOF > $KIND_CONFIG
203-
kind: Cluster
204-
apiVersion: kind.x-k8s.io/v1alpha4
205-
nodes:
206-
- role: control-plane
207-
- role: worker
208-
- role: worker
209-
EOF
210-
211-
echo "[*] Creating Kind cluster..."
212-
kind create cluster --name $CLUSTER_NAME --config $KIND_CONFIG
213-
214-
kubectl wait --for=condition=Ready nodes --all --timeout=120s
215-
216-
echo "[*] Creating pod ..."
217-
kubectl apply -f - <<EOF
218-
apiVersion: v1
219-
kind: Pod
220-
metadata:
221-
name: nginx
222-
spec:
223-
containers:
224-
- name: nginx
225-
image: nginx:latest
226-
resources:
227-
requests:
228-
memory: "256Mi"
229-
cpu: "100m"
230-
limits:
231-
memory: "256Mi"
232-
cpu: "500m"
233-
EOF
234-
235-
echo "[*] Waiting for pods to be ready..."
236-
kubectl wait --for=condition=Ready pod/nginx --timeout=300s
237-
238-
echo "[*] Pods running, doing test workload..."
239-
sleep 60
240-
241-
echo "[*] Deleting pods..."
242-
kubectl delete pod nginx
243-
244-
echo "[*] Deleting Kind cluster..."
245-
kind delete cluster --name $CLUSTER_NAME
246-
247-
echo "[*] Done!"
195+
run: ${{ github.workspace }}/.github/scripts/test_with_kind_cluster.sh
248196

249197
release-new-image:
250198
runs-on: ubuntu-latest

.github/workflows/periodic-build-new-actions-vm.yml

Lines changed: 1 addition & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -216,59 +216,7 @@ jobs:
216216
cat /proc/cpuinfo
217217
218218
- name: Run kind cluster
219-
run: |
220-
CLUSTER_NAME="kind-test"
221-
KIND_CONFIG="kind-config.yaml"
222-
223-
sudo sysctl fs.inotify.max_user_instances=1280
224-
sudo sysctl fs.inotify.max_user_watches=655360
225-
226-
cat <<EOF > $KIND_CONFIG
227-
kind: Cluster
228-
apiVersion: kind.x-k8s.io/v1alpha4
229-
nodes:
230-
- role: control-plane
231-
- role: worker
232-
- role: worker
233-
EOF
234-
235-
echo "[*] Creating Kind cluster..."
236-
kind create cluster --name $CLUSTER_NAME --config $KIND_CONFIG
237-
238-
kubectl wait --for=condition=Ready nodes --all --timeout=120s
239-
240-
echo "[*] Creating pod ..."
241-
kubectl apply -f - <<EOF
242-
apiVersion: v1
243-
kind: Pod
244-
metadata:
245-
name: nginx
246-
spec:
247-
containers:
248-
- name: nginx
249-
image: nginx:latest
250-
resources:
251-
requests:
252-
memory: "256Mi"
253-
cpu: "100m"
254-
limits:
255-
memory: "256Mi"
256-
cpu: "500m"
257-
EOF
258-
259-
echo "[*] Waiting for pods to be ready..."
260-
kubectl wait --for=condition=Ready pod/nginx --timeout=300s
261-
262-
echo "[*] Pods running, doing test workload..."
263-
sleep 60
264-
265-
echo "[*] Deleting pods..."
266-
kubectl delete pod nginx
267-
268-
echo "[*] Deleting Kind cluster..."
269-
kind delete cluster --name $CLUSTER_NAME
270-
271-
echo "[*] Done!"
219+
run: ${{ github.workspace }}/.github/scripts/test_with_kind_cluster.sh
272220

273221
release-new-image:
274222
runs-on: ubuntu-latest

.github/workflows/test-vm-runner.yaml

Lines changed: 1 addition & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -43,64 +43,8 @@ jobs:
4343
df -h /
4444
4545
- name: Run kind cluster
46-
run: |
47-
CLUSTER_NAME="kind-test"
48-
KIND_CONFIG="kind-config.yaml"
49-
50-
sudo sysctl fs.inotify.max_user_instances=1280
51-
sudo sysctl fs.inotify.max_user_watches=655360
52-
53-
cat <<EOF > $KIND_CONFIG
54-
kind: Cluster
55-
apiVersion: kind.x-k8s.io/v1alpha4
56-
nodes:
57-
- role: control-plane
58-
- role: worker
59-
- role: worker
60-
EOF
61-
62-
echo "[*] Creating Kind cluster..."
63-
kind create cluster --name $CLUSTER_NAME --config $KIND_CONFIG
64-
65-
kubectl wait --for=condition=Ready nodes --all --timeout=120s
66-
67-
echo "[*] Creating Kind cluster..."
68-
kind create cluster --name $CLUSTER_NAME --config $KIND_CONFIG
69-
70-
kubectl wait --for=condition=Ready nodes --all --timeout=120s
71-
72-
echo "[*] Creating pod ..."
73-
kubectl apply -f - <<EOF
74-
apiVersion: v1
75-
kind: Pod
76-
metadata:
77-
name: nginx
78-
spec:
79-
containers:
80-
- name: nginx
81-
image: nginx:latest
82-
resources:
83-
requests:
84-
memory: "256Mi"
85-
cpu: "100m"
86-
limits:
87-
memory: "256Mi"
88-
cpu: "500m"
89-
EOF
90-
91-
echo "[*] Waiting for pods to be ready..."
92-
kubectl wait --for=condition=Ready pod/nginx --timeout=300s
93-
94-
echo "[*] Pods running, doing test workload..."
95-
sleep 60
96-
97-
echo "[*] Deleting pods..."
98-
kubectl delete pod nginx
99-
100-
echo "[*] Deleting Kind cluster..."
101-
kind delete cluster --name $CLUSTER_NAME
46+
run: ${{ github.workspace }}/.github/scripts/test_with_kind_cluster.sh
10247

103-
echo "[*] Done!"
10448
test-gpu-runner:
10549
runs-on: oracle-vm-gpu-a10-1
10650
if: ${{ github.event.inputs.test_gpu == 'yes' }}

0 commit comments

Comments
 (0)