Skip to content

Commit 6196e81

Browse files
authored
Merge branch 'main' into dependabot/go_modules/github.com/spf13/viper-1.20.1
2 parents 744b92f + 74b6d1f commit 6196e81

File tree

14 files changed

+363
-520
lines changed

14 files changed

+363
-520
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ jobs:
2020
helm_install_smoke_test:
2121
uses: ./.github/workflows/helm-chart-smoketest.yml
2222

23+
helm_node_scaling_test:
24+
uses: ./.github/workflows/helm-chart-node-scaling-test.yml
25+
2326
unit_tests:
2427
name: Test
2528
runs-on: ubuntu-latest
Lines changed: 149 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
1+
name: Helm Node Scaling Test
2+
3+
on:
4+
workflow_call:
5+
6+
env:
7+
SHIM_SPIN_VERSION: v0.19.0
8+
DOCKER_BUILD_SUMMARY: false
9+
10+
jobs:
11+
helm-node-scaling-test:
12+
runs-on: ubuntu-22.04
13+
steps:
14+
- uses: actions/checkout@v4
15+
16+
- name: Install helm
17+
uses: Azure/setup-helm@v4
18+
with:
19+
version: v3.15.4
20+
21+
- name: Set up QEMU
22+
uses: docker/setup-qemu-action@v3
23+
24+
- name: Set up Docker Buildx
25+
uses: docker/setup-buildx-action@v3
26+
27+
- name: Build RCM
28+
uses: docker/build-push-action@v6
29+
with:
30+
context: .
31+
file: ./Dockerfile
32+
platforms: linux/amd64
33+
cache-from: type=gha
34+
cache-to: type=gha,mode=max
35+
load: true
36+
tags: |
37+
runtime-class-manager:chart-test
38+
39+
- name: Build node installer
40+
uses: docker/build-push-action@v6
41+
with:
42+
context: .
43+
file: ./images/installer/Dockerfile
44+
platforms: linux/amd64
45+
cache-from: type=gha
46+
cache-to: type=gha,mode=max
47+
load: true
48+
tags: |
49+
node-installer:chart-test
50+
51+
- name: Build shim downloader
52+
uses: docker/build-push-action@v6
53+
with:
54+
context: ./images/downloader
55+
file: ./images/downloader/Dockerfile
56+
platforms: linux/amd64
57+
cache-from: type=gha
58+
cache-to: type=gha,mode=max
59+
load: true
60+
tags: |
61+
shim-downloader:chart-test
62+
63+
- name: create kind config
64+
run: |
65+
cat << EOF > kind-config.yaml
66+
kind: Cluster
67+
apiVersion: kind.x-k8s.io/v1alpha4
68+
nodes:
69+
- role: control-plane
70+
- role: worker
71+
labels:
72+
spin: true
73+
EOF
74+
75+
- name: fetch kindscaler script
76+
run: |
77+
curl -so kindscaler.sh https://raw.githubusercontent.com/lobuhi/kindscaler/refs/heads/main/kindscaler.sh
78+
chmod +x kindscaler.sh
79+
80+
- name: create kind cluster
81+
uses: helm/kind-action@v1
82+
with:
83+
cluster_name: kind
84+
config: kind-config.yaml
85+
86+
- name: import images into kind cluster
87+
run: |
88+
kind load docker-image runtime-class-manager:chart-test
89+
kind load docker-image node-installer:chart-test
90+
kind load docker-image shim-downloader:chart-test
91+
92+
- name: helm install runtime-class-manager
93+
run: |
94+
helm install rcm \
95+
--namespace rcm \
96+
--create-namespace \
97+
--debug \
98+
--set image.repository=runtime-class-manager \
99+
--set image.tag=chart-test \
100+
--set rcm.nodeInstallerImage.repository=node-installer \
101+
--set rcm.nodeInstallerImage.tag=chart-test \
102+
--set rcm.shimDownloaderImage.repository=shim-downloader \
103+
--set rcm.shimDownloaderImage.tag=chart-test \
104+
deploy/helm
105+
106+
- name: apply Spin shim
107+
run: |
108+
# Ensure shim binary is compatible with runner arch
109+
yq -i '.spec.fetchStrategy.anonHttp.location = "https://github.com/spinkube/containerd-shim-spin/releases/download/${{ env.SHIM_SPIN_VERSION }}/containerd-shim-spin-v2-linux-x86_64.tar.gz"' \
110+
config/samples/test_shim_spin.yaml
111+
kubectl apply -f config/samples/test_shim_spin.yaml
112+
113+
- name: verify shim is installed into one node
114+
run: |
115+
timeout 1m bash -c 'until [[ "$(kubectl get node -l spin=true -l spin-v2=provisioned -o name | wc -l)" == "1" ]]; do sleep 2; done'
116+
timeout 1m bash -c 'until [[ "$(kubectl get shim.runtime.spinkube.dev/spin-v2 -o json | jq -r '.status.nodesReady')" == "1" ]]; do sleep 2; done'
117+
118+
- name: scale kind worker nodes to 2
119+
run: ./kindscaler.sh kind -r worker -c 1
120+
121+
- name: re-import images into kind cluster, for new node
122+
run: |
123+
kind load docker-image runtime-class-manager:chart-test
124+
kind load docker-image node-installer:chart-test
125+
kind load docker-image shim-downloader:chart-test
126+
127+
- name: verify shim is installed into two nodes
128+
run: |
129+
timeout 1m bash -c 'until [[ "$(kubectl get node -l spin=true -l spin-v2=provisioned -o name | wc -l)" == "2" ]]; do sleep 2; done'
130+
timeout 1m bash -c 'until [[ "$(kubectl get shim.runtime.spinkube.dev/spin-v2 -o json | jq -r '.status.nodesReady')" == "2" ]]; do sleep 2; done'
131+
132+
- name: delete Spin Shim
133+
run: kubectl delete -f config/samples/test_shim_spin.yaml
134+
135+
- name: verify shim is uninstalled from both nodes
136+
run: |
137+
timeout 1m bash -c 'until [[ "$(kubectl get node -l spin=true -l spin-v2=provisioned -o name | wc -l)" == "0" ]]; do sleep 2; done'
138+
timeout 1m bash -c 'until ! kubectl get shims.runtime.spinkube.dev/spin-v2; do sleep 2; done'
139+
140+
- name: debug
141+
if: failure()
142+
run: |
143+
kubectl get pods -A
144+
kubectl describe shim spin-v2
145+
kubectl describe runtimeclass wasmtime-spin-v2
146+
kubectl describe -n rcm pod -l job-name=kind-worker-spin-v2-install || true
147+
kubectl logs -n rcm -l app.kubernetes.io/name=runtime-class-manager || true
148+
kubectl describe -n rcm pod -l app.kubernetes.io/name=runtime-class-manager || true
149+
kubectl describe nodes

.github/workflows/helm-chart-smoketest.yml

Lines changed: 127 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -4,71 +4,135 @@ on:
44
workflow_call:
55

66
env:
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

912
jobs:
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+
uses: medyagh/[email protected]
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+
uses: balchua/[email protected]
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

.github/workflows/sbom.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
uses: anchore/sbom-action/download-syft@f325610c9f50a54015d37c8d16cb3b0e2c8f4de0 # v0.18.0
3333

3434
- name: Install the crane command
35-
uses: IAreKyleW00t/crane-installer@714fc1e08f8f301abca2f140eba36d9a14e8c5e6 # v1.3
35+
uses: IAreKyleW00t/crane-installer@7a098cf907ebbb438b174e1e01cab6f732b492f9 # v1.3
3636

3737
- name: Login to GitHub Container Registry
3838
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0

0 commit comments

Comments
 (0)