44  workflow_call :
55
66env :
7-   SHIM_SPIN_VERSION : v0.15.1 
7+   K8S_VERSION : v1.31.2 
8+   MICROK8S_CHANNEL : 1.31/stable 
9+   SHIM_SPIN_VERSION : v0.17.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.15.4 
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+           node_image : kindest/node:${{ env.K8S_VERSION }} 
106+ 
107+       - name : Create minikube cluster 
108+         if : matrix.config.type == 'minikube' 
109+ 110+         with :
111+           container-runtime : containerd 
112+           kubernetes-version : ${{ env.K8S_VERSION }} 
66113
67-       - name : import images into kind cluster 
114+       - name : Create microk8s cluster 
115+         if : matrix.config.type == 'microk8s' 
116+ 117+         with :
118+           channel : ${{ env.MICROK8S_CHANNEL }} 
119+ 
120+       - name : Create k3d cluster 
121+         if : matrix.config.type == 'k3d' 
122+         uses : AbsaOSS/k3d-action@v2 
123+         with :
124+           cluster-name : k3s-default 
125+           k3d-version : v5.7.4 
126+           args : | 
127+             --image docker.io/rancher/k3s:${{ env.K8S_VERSION }}-k3s1 
128+ 
129+ name : Import images 
68130        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  
131+           for  image in $(ls /tmp/*.tar); do  
132+             ${{ matrix.config.import_cmd }} $image  
133+           done  
72134
73135name : helm install runtime-class-manager 
74136        run : | 
@@ -94,23 +156,44 @@ jobs:
94156name : label nodes 
95157        run : kubectl label node --all spin=true 
96158
159+       #  MicroK8s runs directly on the host, so both the host's containerd process and MicroK8s' would
160+       #  otherwise be detected by runtime-class-manager. As of writing, rcm will fail if more than one
161+       #  containerd process is detected when attempting to restart. So, we stop the host process until
162+       #  the shim has been installed and the test app has been confirmed to run.
163+       - name : stop system containerd 
164+         if : matrix.config.type == 'microk8s' 
165+         run : sudo systemctl stop containerd 
166+ 
97167      - name : run Spin App 
98168        run : | 
99169          kubectl apply -f testdata/apps/spin-app.yaml 
100170          kubectl rollout status deployment wasm-spin --timeout 90s 
101171          kubectl get pods -A 
102172          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' 
173+           timeout 60s bash -c 'until curl -f -vvv http://localhost:8083/hello; do sleep 2; done' 
174+ 
175+ name : restart system containerd 
176+         if : matrix.config.type == 'microk8s' 
177+         run : sudo systemctl start containerd 
104178
105179      - name : debug 
106180        if : failure() 
107181        run : | 
108182          kubectl get pods -A 
109183          kubectl describe shim spin-v2 
110184          kubectl describe runtimeclass wasmtime-spin-v2 
111-           kubectl describe -n rcm pod -l job-name=kind-control-plane-spin-v2-install || true  
185+ 
186+           # Get install pod logs 
187+           # Note: there may be multiple pods pending fix in https://github.com/spinkube/runtime-class-manager/issues/140 
188+           install_pod=$(kubectl get pods -n rcm --no-headers -o name | awk '{if ($1 ~ "-spin-v2-install") print $0}' | tail -n 1) 
189+           kubectl describe -n rcm $install_pod || true  
190+           kubectl logs -n rcm $install_pod || true  
191+ 
192+           # RCM pod logs 
112193          kubectl logs -n rcm -l app.kubernetes.io/name=runtime-class-manager || true  
113194          kubectl describe -n rcm pod -l app.kubernetes.io/name=runtime-class-manager || true  
195+ 
196+           # App logs 
114197          kubectl logs -l app=wasm-spin || true  
115198          kubectl describe pod -l app=wasm-spin || true  
116199
0 commit comments