44 workflow_call :
55
66env :
7- SHIM_SPIN_VERSION : v0.15.1
7+ K8S_VERSION : v1.32.3
8+ MICROK8S_CHANNEL : 1.32/stable
9+ SHIM_SPIN_VERSION : v0.19.0
10+ DOCKER_BUILD_SUMMARY : false
811
912jobs :
10- helm-install-smoke-test :
13+ build-images :
1114 runs-on : ubuntu-22.04
15+ strategy :
16+ matrix :
17+ config :
18+ - {
19+ name : " runtime-class-manager" ,
20+ context : " ." ,
21+ file : " ./Dockerfile"
22+ }
23+ - {
24+ name : " shim-downloader" ,
25+ context : " ./images/downloader" ,
26+ file : " ./images/downloader/Dockerfile"
27+ }
28+ - {
29+ name : " node-installer" ,
30+ context : " ." ,
31+ file : " ./images/installer/Dockerfile"
32+ }
1233 steps :
1334 - uses : actions/checkout@v4
1435
15- - name : Install helm
16- uses : Azure/setup-helm@v4
17- with :
18- version : v3.15.4
19-
2036 - name : Set up QEMU
2137 uses : docker/setup-qemu-action@v3
2238
2339 - name : Set up Docker Buildx
2440 uses : docker/setup-buildx-action@v3
2541
26- - name : Build RCM
42+ - name : Build ${{ matrix.config.name }}
2743 uses : docker/build-push-action@v6
2844 with :
29- context : .
30- file : ./Dockerfile
45+ context : ${{ matrix.config.context }}
46+ file : ${{ matrix.config.file }}
3147 platforms : linux/amd64
3248 cache-from : type=gha
3349 cache-to : type=gha,mode=max
34- load : true
35- tags : |
36- runtime-class-manager:chart-test
50+ outputs : type=docker,dest=/tmp/${{ matrix.config.name }}.tar
51+ tags : ${{ matrix.config.name }}:chart-test
3752
38- - name : Build node installer
39- uses : docker/build-push-action@v6
53+ - name : Upload artifact
54+ uses : actions/upload-artifact@v4
4055 with :
41- context : .
42- file : ./images/installer/Dockerfile
43- platforms : linux/amd64
44- cache-from : type=gha
45- cache-to : type=gha,mode=max
46- load : true
47- tags : |
48- node-installer:chart-test
56+ name : image-${{ matrix.config.name }}
57+ path : /tmp/${{ matrix.config.name }}.tar
4958
50- - name : Build shim downloader
51- uses : docker/build-push-action@v6
59+ helm-install-smoke-test :
60+ runs-on : ubuntu-22.04
61+ needs : build-images
62+ strategy :
63+ matrix :
64+ config :
65+ - {
66+ type : " kind" ,
67+ import_cmd : " kind load image-archive"
68+ }
69+ - {
70+ type : " minikube" ,
71+ import_cmd : " minikube image load"
72+ }
73+ - {
74+ type : " microk8s" ,
75+ import_cmd : " sudo microk8s ctr images import"
76+ }
77+ - {
78+ type : " k3d" ,
79+ import_cmd : " k3d image import"
80+ }
81+
82+ steps :
83+ - uses : actions/checkout@v4
84+
85+ - name : Install helm
86+ uses : Azure/setup-helm@v4
5287 with :
53- context : ./images/downloader
54- file : ./images/downloader/Dockerfile
55- platforms : linux/amd64
56- cache-from : type=gha
57- cache-to : type=gha,mode=max
58- load : true
59- tags : |
60- shim-downloader:chart-test
88+ version : v3.17.2
6189
62- - name : create kind cluster
90+ - name : Download artifact
91+ uses : actions/download-artifact@v4
92+ with :
93+ pattern : image-*
94+ merge-multiple : true
95+ path : /tmp
96+
97+ # Note: 'uses' doesn't support variable interpolation, hence the
98+ # k8s-specific steps below.
99+ # Ref: https://github.com/orgs/community/discussions/25824
100+ - name : Create kind cluster
101+ if : matrix.config.type == 'kind'
63102 uses : helm/kind-action@v1
64103 with :
65104 cluster_name : kind
105+ # Versions lower than v0.27.0 encounter https://github.com/kubernetes-sigs/kind/issues/3795
106+ version : v0.27.0
107+ node_image : kindest/node:${{ env.K8S_VERSION }}
108+
109+ - name : Create minikube cluster
110+ if : matrix.config.type == 'minikube'
111+ 112+ with :
113+ container-runtime : containerd
114+ kubernetes-version : ${{ env.K8S_VERSION }}
115+
116+ - name : Create microk8s cluster
117+ if : matrix.config.type == 'microk8s'
118+ 119+ with :
120+ channel : ${{ env.MICROK8S_CHANNEL }}
121+
122+ - name : Create k3d cluster
123+ if : matrix.config.type == 'k3d'
124+ uses : AbsaOSS/k3d-action@v2
125+ with :
126+ cluster-name : k3s-default
127+ k3d-version : v5.8.3
128+ args : |
129+ --image docker.io/rancher/k3s:${{ env.K8S_VERSION }}-k3s1
66130
67- - name : import images into kind cluster
131+ - name : Import images
68132 run : |
69- kind load docker- image runtime-class-manager:chart-test
70- kind load docker-image node-installer:chart-test
71- kind load docker-image shim-downloader:chart-test
133+ for image in $(ls /tmp/*.tar); do
134+ ${{ matrix.config.import_cmd }} $image
135+ done
72136
73137 - name : helm install runtime-class-manager
74138 run : |
@@ -94,23 +158,45 @@ jobs:
94158 - name : label nodes
95159 run : kubectl label node --all spin=true
96160
161+ # MicroK8s runs directly on the host, so both the host's containerd process and MicroK8s' would
162+ # otherwise be detected by runtime-class-manager. As of writing, rcm will fail if more than one
163+ # containerd process is detected when attempting to restart. So, we stop the host process until
164+ # the shim has been installed and the test app has been confirmed to run.
165+ - name : stop system containerd
166+ if : matrix.config.type == 'microk8s'
167+ run : sudo systemctl stop containerd
168+
97169 - name : run Spin App
98170 run : |
99171 kubectl apply -f testdata/apps/spin-app.yaml
100- kubectl rollout status deployment wasm-spin --timeout 90s
172+ kubectl rollout status deployment wasm-spin --timeout 180s
101173 kubectl get pods -A
102174 kubectl port-forward svc/wasm-spin 8083:80 &
103- timeout 15s bash -c 'until curl -f -vvv http://localhost:8083/hello; do sleep 2; done'
175+ timeout 60s bash -c 'until curl -f -vvv http://localhost:8083/hello; do sleep 2; done'
176+
177+ - name : restart system containerd
178+ if : matrix.config.type == 'microk8s'
179+ run : sudo systemctl start containerd
104180
105181 - name : debug
106182 if : failure()
107183 run : |
108184 kubectl get pods -A
109185 kubectl describe shim spin-v2
110186 kubectl describe runtimeclass wasmtime-spin-v2
111- kubectl describe -n rcm pod -l job-name=kind-control-plane-spin-v2-install || true
187+
188+ # Get install pod logs
189+ # Note: there may be multiple pods pending fix in https://github.com/spinkube/runtime-class-manager/issues/140
190+ install_pod=$(kubectl get pods -n rcm --no-headers -o name | awk '{if ($1 ~ "-spin-v2-install") print $0}' | tail -n 1)
191+ kubectl describe -n rcm $install_pod || true
192+ kubectl logs -n rcm -c downloader $install_pod || true
193+ kubectl logs -n rcm -c provisioner $install_pod || true
194+
195+ # RCM pod logs
112196 kubectl logs -n rcm -l app.kubernetes.io/name=runtime-class-manager || true
113197 kubectl describe -n rcm pod -l app.kubernetes.io/name=runtime-class-manager || true
198+
199+ # App logs
114200 kubectl logs -l app=wasm-spin || true
115201 kubectl describe pod -l app=wasm-spin || true
116202
0 commit comments