Skip to content

Commit 8d46095

Browse files
kate-goldenringMossaka
authored andcommitted
Add systemd configuration even if Spin has previously been configured
Signed-off-by: Kate Goldenring <[email protected]>
1 parent c0b3084 commit 8d46095

File tree

2 files changed

+19
-3
lines changed

2 files changed

+19
-3
lines changed

node-installer/script/installer.sh

100644100755
Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ mkdir -p $NODE_ROOT$KWASM_DIR/bin/
6161
cp /assets/containerd-shim-spin-v2 $NODE_ROOT$KWASM_DIR/bin/
6262

6363
if ! grep -q spin $NODE_ROOT$CONTAINERD_CONF; then
64+
echo "Adding Spin runtime to containerd"
6465
if $IS_K3S; then
6566
echo '
6667
[plugins."io.containerd.cri.v1.runtime".containerd.runtimes."spin"]
@@ -70,11 +71,27 @@ if ! grep -q spin $NODE_ROOT$CONTAINERD_CONF; then
7071
echo '
7172
[plugins."io.containerd.grpc.v1.cri".containerd.runtimes.spin]
7273
runtime_type = "'$KWASM_DIR'/bin/containerd-shim-spin-v2"
74+
' >> $NODE_ROOT$CONTAINERD_CONF
75+
fi
76+
rm -Rf $NODE_ROOT$KWASM_DIR/active
77+
fi
78+
79+
# Check if Spin runtime options have not been configured
80+
# TODO: this should allow for some options to already be configured and just additively
81+
# configuring SystemdCgroup
82+
if ! grep -q 'runtimes.spin.options' $NODE_ROOT$CONTAINERD_CONF; then
83+
echo "Setting SystemdCgroup to $SYSTEMD_CGROUP in Spin containerd configuration"
84+
if $IS_K3S; then
85+
echo '
86+
[plugins."io.containerd.cri.v1.runtime".containerd.runtimes.spin.options]
87+
SystemdCgroup = '$SYSTEMD_CGROUP'
88+
' >> $NODE_ROOT$CONTAINERD_CONF
89+
else
90+
echo '
7391
[plugins."io.containerd.grpc.v1.cri".containerd.runtimes.spin.options]
7492
SystemdCgroup = '$SYSTEMD_CGROUP'
7593
' >> $NODE_ROOT$CONTAINERD_CONF
7694
fi
77-
rm -Rf $NODE_ROOT$KWASM_DIR/active
7895
fi
7996

8097
if $IS_K3S; then

node-installer/tests/integration-test-microk8s.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,10 @@ echo "Applying KWasm node installer job..."
6060
kubectl apply -f ./microk8s-kwasm-job.yml
6161

6262
echo "Waiting for node installer job to complete..."
63-
kubectl wait -n kwasm --for=condition=Ready pod --selector=job-name=microk8s-provision-kwasm --timeout=90s || true
6463
kubectl wait -n kwasm --for=jsonpath='{.status.phase}'=Succeeded pod --selector=job-name=microk8s-provision-kwasm --timeout=60s
6564

6665
# Verify the SystemdCgroup is set to true
67-
cat /var/snap/microk8s/current/args/containerd.toml | grep -A5 "spin" | grep "SystemdCgroup = true"
66+
sudo cat /var/snap/microk8s/current/args/containerd.toml | grep -A5 "spin" | grep "SystemdCgroup = true"
6867

6968
if ! kubectl get pods -n kwasm | grep -q "microk8s-provision-kwasm.*Completed"; then
7069
echo "Node installer job failed!"

0 commit comments

Comments
 (0)