44 workflow_call :
55
66env :
7- SHIM_SPIN_VERSION : v0.15.1
7+ # TODO: bump to a more recent K8S_VERSION once rcm supports containerd 2.0+
8+ # see https://github.com/spinframework/runtime-class-manager/issues/371
9+ # For k3d in particular, containerd 2.0 is used starting with k3s image tag v1.32.2-k3s1
10+ K8S_VERSION : v1.32.1
11+ MICROK8S_CHANNEL : 1.32/stable
12+ SHIM_SPIN_VERSION : v0.18.0
13+ DOCKER_BUILD_SUMMARY : false
814
915jobs :
10- helm-install-smoke-test :
16+ build-images :
1117 runs-on : ubuntu-22.04
18+ strategy :
19+ matrix :
20+ config :
21+ - {
22+ name : " runtime-class-manager" ,
23+ context : " ." ,
24+ file : " ./Dockerfile"
25+ }
26+ - {
27+ name : " shim-downloader" ,
28+ context : " ./images/downloader" ,
29+ file : " ./images/downloader/Dockerfile"
30+ }
31+ - {
32+ name : " node-installer" ,
33+ context : " ." ,
34+ file : " ./images/installer/Dockerfile"
35+ }
1236 steps :
1337 - uses : actions/checkout@v4
1438
15- - name : Install helm
16- uses : Azure/setup-helm@v4
17- with :
18- version : v3.15.4
19-
2039 - name : Set up QEMU
2140 uses : docker/setup-qemu-action@v3
2241
2342 - name : Set up Docker Buildx
2443 uses : docker/setup-buildx-action@v3
2544
26- - name : Build RCM
45+ - name : Build ${{ matrix.config.name }}
2746 uses : docker/build-push-action@v6
2847 with :
29- context : .
30- file : ./Dockerfile
48+ context : ${{ matrix.config.context }}
49+ file : ${{ matrix.config.file }}
3150 platforms : linux/amd64
3251 cache-from : type=gha
3352 cache-to : type=gha,mode=max
34- load : true
35- tags : |
36- runtime-class-manager:chart-test
53+ outputs : type=docker,dest=/tmp/${{ matrix.config.name }}.tar
54+ tags : ${{ matrix.config.name }}:chart-test
3755
38- - name : Build node installer
39- uses : docker/build-push-action@v6
56+ - name : Upload artifact
57+ uses : actions/upload-artifact@v4
4058 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
59+ name : image-${{ matrix.config.name }}
60+ path : /tmp/${{ matrix.config.name }}.tar
4961
50- - name : Build shim downloader
51- uses : docker/build-push-action@v6
62+ helm-install-smoke-test :
63+ runs-on : ubuntu-22.04
64+ needs : build-images
65+ strategy :
66+ matrix :
67+ config :
68+ - {
69+ type : " kind" ,
70+ import_cmd : " kind load image-archive"
71+ }
72+ - {
73+ type : " minikube" ,
74+ import_cmd : " minikube image load"
75+ }
76+ - {
77+ type : " microk8s" ,
78+ import_cmd : " sudo microk8s ctr images import"
79+ }
80+ - {
81+ type : " k3d" ,
82+ import_cmd : " k3d image import"
83+ }
84+
85+ steps :
86+ - uses : actions/checkout@v4
87+
88+ - name : Install helm
89+ uses : Azure/setup-helm@v4
5290 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
91+ version : v3.17.2
6192
62- - name : create kind cluster
93+ - name : Download artifact
94+ uses : actions/download-artifact@v4
95+ with :
96+ pattern : image-*
97+ merge-multiple : true
98+ path : /tmp
99+
100+ # Note: 'uses' doesn't support variable interpolation, hence the
101+ # k8s-specific steps below.
102+ # Ref: https://github.com/orgs/community/discussions/25824
103+ - name : Create kind cluster
104+ if : matrix.config.type == 'kind'
63105 uses : helm/kind-action@v1
64106 with :
65107 cluster_name : kind
108+ # Versions lower than v0.27.0 encounter https://github.com/kubernetes-sigs/kind/issues/3795
109+ version : v0.27.0
110+ node_image : kindest/node:${{ env.K8S_VERSION }}
111+
112+ - name : Create minikube cluster
113+ if : matrix.config.type == 'minikube'
114+ 115+ with :
116+ container-runtime : containerd
117+ kubernetes-version : ${{ env.K8S_VERSION }}
118+
119+ - name : Create microk8s cluster
120+ if : matrix.config.type == 'microk8s'
121+ 122+ with :
123+ channel : ${{ env.MICROK8S_CHANNEL }}
124+
125+ - name : Create k3d cluster
126+ if : matrix.config.type == 'k3d'
127+ uses : AbsaOSS/k3d-action@v2
128+ with :
129+ cluster-name : k3s-default
130+ k3d-version : v5.8.3
131+ args : |
132+ --image docker.io/rancher/k3s:${{ env.K8S_VERSION }}-k3s1
66133
67- - name : import images into kind cluster
134+ - name : Import images
68135 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
136+ for image in $(ls /tmp/*.tar); do
137+ ${{ matrix.config.import_cmd }} $image
138+ done
72139
73140 - name : helm install runtime-class-manager
74141 run : |
@@ -94,23 +161,45 @@ jobs:
94161 - name : label nodes
95162 run : kubectl label node --all spin=true
96163
164+ # MicroK8s runs directly on the host, so both the host's containerd process and MicroK8s' would
165+ # otherwise be detected by runtime-class-manager. As of writing, rcm will fail if more than one
166+ # containerd process is detected when attempting to restart. So, we stop the host process until
167+ # the shim has been installed and the test app has been confirmed to run.
168+ - name : stop system containerd
169+ if : matrix.config.type == 'microk8s'
170+ run : sudo systemctl stop containerd
171+
97172 - name : run Spin App
98173 run : |
99174 kubectl apply -f testdata/apps/spin-app.yaml
100- kubectl rollout status deployment wasm-spin --timeout 90s
175+ kubectl rollout status deployment wasm-spin --timeout 180s
101176 kubectl get pods -A
102177 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'
178+ timeout 60s bash -c 'until curl -f -vvv http://localhost:8083/hello; do sleep 2; done'
179+
180+ - name : restart system containerd
181+ if : matrix.config.type == 'microk8s'
182+ run : sudo systemctl start containerd
104183
105184 - name : debug
106185 if : failure()
107186 run : |
108187 kubectl get pods -A
109188 kubectl describe shim spin-v2
110189 kubectl describe runtimeclass wasmtime-spin-v2
111- kubectl describe -n rcm pod -l job-name=kind-control-plane-spin-v2-install || true
190+
191+ # Get install pod logs
192+ # Note: there may be multiple pods pending fix in https://github.com/spinkube/runtime-class-manager/issues/140
193+ install_pod=$(kubectl get pods -n rcm --no-headers -o name | awk '{if ($1 ~ "-spin-v2-install") print $0}' | tail -n 1)
194+ kubectl describe -n rcm $install_pod || true
195+ kubectl logs -n rcm -c downloader $install_pod || true
196+ kubectl logs -n rcm -c provisioner $install_pod || true
197+
198+ # RCM pod logs
112199 kubectl logs -n rcm -l app.kubernetes.io/name=runtime-class-manager || true
113200 kubectl describe -n rcm pod -l app.kubernetes.io/name=runtime-class-manager || true
201+
202+ # App logs
114203 kubectl logs -l app=wasm-spin || true
115204 kubectl describe pod -l app=wasm-spin || true
116205
0 commit comments