Skip to content

Commit be84b0a

Browse files
committed
restructure to run both spin-registry-push and docker-build-push tests
Signed-off-by: Rajat Jindal <[email protected]>
1 parent 2aa6846 commit be84b0a

File tree

9 files changed

+268
-2
lines changed

9 files changed

+268
-2
lines changed

Makefile

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,33 @@ pod-status-check:
4242
workloads:
4343
./scripts/workloads.sh
4444

45+
./PHONY: workloads-spin-registry-push
46+
workloads-spin-registry-push:
47+
./scripts/workloads-spin-registry-push.sh
48+
4549
./PHONY: test-workloads-delete
4650
test-workloads-delete:
4751
./scripts/workloads-delete.sh
4852

4953
.PHONY: integration-tests
50-
integration-tests: check-bins move-bins up pod-status-check workloads test-workloads-delete
54+
integration-tests: prepare-cluster-and-images integration-docker-build-push-tests integration-spin-registry-push-tests
55+
56+
.PHONY: integration-docker-build-push-tests
57+
integration-docker-build-push-tests: workloads test-workloads-delete
58+
cargo test -p containerd-shim-spin-tests -- --nocapture
59+
kubectl delete -f tests/workloads-common --wait --timeout 60s --ignore-not-found=true
60+
kubectl delete -f tests/workloads-docker-build-push --wait --timeout 60s --ignore-not-found=true
61+
kubectl wait pod --for=delete -l app=wasm-spin -l app=spin-keyvalue -l app=spin-outbound-redis -l app=spin-multi-trigger-app --timeout 60s
62+
63+
.PHONY: integration-spin-registry-push-tests test-workloads-delete
64+
integration-spin-registry-push-tests: workloads-spin-registry-push
5165
cargo test -p containerd-shim-spin-tests -- --nocapture
66+
kubectl delete -f tests/workloads-common --wait --timeout 60s
67+
kubectl delete -f tests/workloads-spin-registry-push --wait --timeout 60s
68+
kubectl wait pod --for=delete -l app=wasm-spin -l app=spin-keyvalue -l app=spin-outbound-redis -l app=spin-multi-trigger-app --timeout 60s
5269

70+
.PHONY: prepare-cluster-and-images
71+
prepare-cluster-and-images: check-bins move-bins up pod-status-check
5372
.PHONY: tests/collect-debug-logs
5473
tests/collect-debug-logs:
5574
./scripts/collect-debug-logs.sh 2>&1
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/bin/bash
2+
3+
set -euo pipefail
4+
5+
# Check if kubectl is installed
6+
if ! command -v kubectl &> /dev/null; then
7+
echo "kubectl is not installed. Installing..."
8+
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
9+
sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl;
10+
fi
11+
12+
# apply the workloads
13+
echo ">>> apply workloads"
14+
kubectl apply -f tests/workloads-common
15+
kubectl apply -f tests/workloads-spin-registry-push
16+
17+
18+
# wait for all the pods to be ready
19+
kubectl wait --for=condition=ready --timeout=50s pod --all
20+
21+
# get and describe all the pods
22+
echo ">>> Pods:"
23+
kubectl get pods -o wide
24+
kubectl describe pods
25+
26+
# get and describe all the deployments
27+
echo ">>> Deployments:"
28+
kubectl get deployments -o wide
29+
kubectl describe deployments
30+
31+
# get and describe all the services
32+
echo ">>> Services:"
33+
kubectl get services -o wide
34+
kubectl describe services

scripts/workloads.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ fi
1111

1212
# apply the workloads
1313
echo ">>> apply workloads"
14-
kubectl apply -f tests/workloads
14+
kubectl apply -f tests/workloads-common
15+
kubectl apply -f tests/workloads-docker-build-push
1516

1617

1718
# wait for all the pods to be ready
File renamed without changes.
File renamed without changes.
File renamed without changes.
Lines changed: 212 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,212 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: wasm-spin
5+
spec:
6+
replicas: 1
7+
selector:
8+
matchLabels:
9+
app: wasm-spin
10+
template:
11+
metadata:
12+
labels:
13+
app: wasm-spin
14+
spec:
15+
runtimeClassName: wasmtime-spin
16+
containers:
17+
- name: testwasm
18+
image: test-registry:5000/spin-registry-push/spin-hello-world:latest
19+
imagePullPolicy: IfNotPresent
20+
command: ["/"]
21+
resources: # limit the resources to 128Mi of memory and 100m of CPU
22+
limits:
23+
cpu: 100m
24+
memory: 128Mi
25+
requests:
26+
cpu: 100m
27+
memory: 128Mi
28+
---
29+
apiVersion: v1
30+
kind: Service
31+
metadata:
32+
name: wasm-spin
33+
spec:
34+
ports:
35+
- protocol: TCP
36+
port: 80
37+
targetPort: 80
38+
selector:
39+
app: wasm-spin
40+
---
41+
apiVersion: apps/v1
42+
kind: Deployment
43+
metadata:
44+
name: spin-keyvalue
45+
spec:
46+
replicas: 1
47+
selector:
48+
matchLabels:
49+
app: spin-keyvalue
50+
template:
51+
metadata:
52+
labels:
53+
app: spin-keyvalue
54+
spec:
55+
runtimeClassName: wasmtime-spin
56+
containers:
57+
- name: keyvalue
58+
image: test-registry:5000/spin-registry-push/spin-keyvalue:latest
59+
command: ["/"]
60+
imagePullPolicy: IfNotPresent
61+
volumeMounts:
62+
- name: config-volume
63+
mountPath: /runtime-config.toml
64+
subPath: runtime-config.toml
65+
readOnly: true
66+
volumes:
67+
- name: config-volume
68+
configMap:
69+
name: spin-runtime-config
70+
---
71+
apiVersion: v1
72+
kind: Service
73+
metadata:
74+
name: spin-keyvalue
75+
spec:
76+
type: LoadBalancer
77+
ports:
78+
- protocol: TCP
79+
port: 80
80+
targetPort: 80
81+
selector:
82+
app: spin-keyvalue
83+
---
84+
apiVersion: apps/v1
85+
kind: Deployment
86+
metadata:
87+
name: spin-outbound-redis
88+
spec:
89+
replicas: 1
90+
selector:
91+
matchLabels:
92+
app: spin-outbound-redis
93+
template:
94+
metadata:
95+
labels:
96+
app: spin-outbound-redis
97+
spec:
98+
runtimeClassName: wasmtime-spin
99+
containers:
100+
- name: outbound-redis
101+
image: test-registry:5000/spin-registry-push/spin-outbound-redis:latest
102+
command: ["/"]
103+
imagePullPolicy: IfNotPresent
104+
env:
105+
- name: SPIN_VARIABLE_REDIS_ADDRESS
106+
value: redis://redis-service.default.svc.cluster.local:6379
107+
- name: SPIN_VARIABLE_REDIS_CHANNEL
108+
value: test
109+
---
110+
apiVersion: v1
111+
kind: Service
112+
metadata:
113+
name: spin-outbound-redis
114+
spec:
115+
type: LoadBalancer
116+
ports:
117+
- protocol: TCP
118+
port: 80
119+
targetPort: 80
120+
selector:
121+
app: spin-outbound-redis
122+
---
123+
# Middleware
124+
# Strip prefix /spin
125+
apiVersion: traefik.containo.us/v1alpha1
126+
kind: Middleware
127+
metadata:
128+
name: strip-prefix
129+
spec:
130+
stripPrefix:
131+
forceSlash: false
132+
prefixes:
133+
- /spin
134+
- /outboundredis
135+
- /keyvalue
136+
---
137+
apiVersion: networking.k8s.io/v1
138+
kind: Ingress
139+
metadata:
140+
name: wasm-ingress
141+
annotations:
142+
ingress.kubernetes.io/ssl-redirect: "false"
143+
traefik.ingress.kubernetes.io/router.middlewares: default-strip-prefix@kubernetescrd
144+
spec:
145+
ingressClassName: traefik
146+
rules:
147+
- http:
148+
paths:
149+
- path: /spin
150+
pathType: Prefix
151+
backend:
152+
service:
153+
name: wasm-spin
154+
port:
155+
number: 80
156+
- path: /keyvalue
157+
pathType: Prefix
158+
backend:
159+
service:
160+
name: spin-keyvalue
161+
port:
162+
number: 80
163+
- path: /outboundredis
164+
pathType: Prefix
165+
backend:
166+
service:
167+
name: spin-outbound-redis
168+
port:
169+
number: 80
170+
- path: /multi-trigger-app
171+
pathType: Prefix
172+
backend:
173+
service:
174+
name: spin-multi-trigger-app
175+
port:
176+
number: 80
177+
---
178+
apiVersion: apps/v1
179+
kind: Deployment
180+
metadata:
181+
name: spin-multi-trigger-app
182+
spec:
183+
replicas: 1
184+
selector:
185+
matchLabels:
186+
app: spin-multi-trigger-app
187+
template:
188+
metadata:
189+
labels:
190+
app: spin-multi-trigger-app
191+
spec:
192+
runtimeClassName: wasmtime-spin
193+
containers:
194+
- name: spin-multi-trigger-app
195+
image: test-registry:5000/spin-registry-push/spin-multi-trigger-app:latest
196+
imagePullPolicy: IfNotPresent
197+
command: ["/"]
198+
ports:
199+
- containerPort: 80
200+
---
201+
apiVersion: v1
202+
kind: Service
203+
metadata:
204+
name: spin-multi-trigger-app
205+
spec:
206+
type: LoadBalancer
207+
ports:
208+
- protocol: TCP
209+
port: 80
210+
targetPort: 80
211+
selector:
212+
app: spin-multi-trigger-app

0 commit comments

Comments
 (0)