@@ -22,12 +22,8 @@ if pgrep -f snap/microk8s > /dev/null; then
2222 fi
2323elif ls $NODE_ROOT /var/lib/rancher/rke2/agent/etc/containerd/config.toml > /dev/null 2>&1 ; then
2424 IS_RKE2_AGENT=true
25- cp $NODE_ROOT /var/lib/rancher/rke2/agent/etc/containerd/config.toml $NODE_ROOT /var/lib/rancher/rke2/agent/etc/containerd/config.toml.tmpl
26- CONTAINERD_CONF=/var/lib/rancher/rke2/agent/etc/containerd/config.toml.tmpl
2725elif ls $NODE_ROOT /var/lib/rancher/k3s/agent/etc/containerd/config.toml > /dev/null 2>&1 ; then
2826 IS_K3S=true
29- cp $NODE_ROOT /var/lib/rancher/k3s/agent/etc/containerd/config.toml $NODE_ROOT /var/lib/rancher/k3s/agent/etc/containerd/config.toml.tmpl
30- CONTAINERD_CONF=/var/lib/rancher/k3s/agent/etc/containerd/config.toml.tmpl
3127elif pgrep -f /var/lib/k0s/bin/kubelet > /dev/null; then
3228 IS_K0S_WORKER=true
3329 CONTAINERD_CONF=/etc/k0s/containerd.d/spin.toml
@@ -38,7 +34,9 @@ mkdir -p $NODE_ROOT$KWASM_DIR/bin/
3834
3935cp /assets/containerd-shim-spin-v2 $NODE_ROOT$KWASM_DIR /bin/
4036
41- if ! grep -q spin $NODE_ROOT$CONTAINERD_CONF ; then
37+ # K3S and RKE2 can detect spin shim themselves, no need to configure
38+ # https://github.com/k3s-io/k3s/pull/9519
39+ if ! ( $IS_K3S || $IS_RKE2_AGENT ) && ! grep -q spin $NODE_ROOT$CONTAINERD_CONF ; then
4240 if grep -q " version = 3" $NODE_ROOT$CONTAINERD_CONF ; then
4341 echo '
4442[plugins."io.containerd.cri.v1.runtime".containerd.runtimes."spin"]
@@ -53,10 +51,6 @@ if ! grep -q spin $NODE_ROOT$CONTAINERD_CONF; then
5351 rm -Rf $NODE_ROOT$KWASM_DIR /active
5452fi
5553
56- if $IS_K3S ; then
57- sed -i " s|runtime_type = \" io.containerd.spin.*\" |runtime_type = \" $KWASM_DIR /bin/containerd-shim-spin-v2\" |g" $NODE_ROOT$CONTAINERD_CONF
58- fi
59-
6054if [ ! -f $NODE_ROOT$KWASM_DIR /active ]; then
6155 touch $NODE_ROOT$KWASM_DIR /active
6256 if $IS_MICROK8S ; then
0 commit comments