diff --git a/.obs/specfile/elemental.spec b/.obs/specfile/elemental.spec index c12efde8d..67b29b0ac 100644 --- a/.obs/specfile/elemental.spec +++ b/.obs/specfile/elemental.spec @@ -99,6 +99,7 @@ rm -rf %{buildroot}/usr/libexec/.placeholder %dir %{_sysconfdir}/NetworkManager/conf.d %config %{_sysconfdir}/NetworkManager/conf.d/rke2-canal.conf %dir %{_unitdir} +%{_unitdir}/shutdown-k3s.service %{_unitdir}/elemental-populate-node-labels.service %{_sbindir}/elemental-populate-node-labels %dir /usr/libexec diff --git a/Dockerfile.image b/Dockerfile.image index 75891eb7c..81d3ef7a7 100644 --- a/Dockerfile.image +++ b/Dockerfile.image @@ -60,7 +60,7 @@ COPY --from=elemental-cli /usr/bin/elemental /usr/bin/elemental COPY framework/files/ / # Enable services -RUN systemctl enable NetworkManager sshd elemental-populate-node-labels systemd-timesyncd +RUN systemctl enable NetworkManager sshd elemental-populate-node-labels systemd-timesyncd shutdown-k3s ARG IMAGE_TAG=latest ARG IMAGE_COMMIT="" diff --git a/framework/files/usr/lib/systemd/system/shutdown-k3s.service b/framework/files/usr/lib/systemd/system/shutdown-k3s.service new file mode 100644 index 000000000..312637e31 --- /dev/null +++ b/framework/files/usr/lib/systemd/system/shutdown-k3s.service @@ -0,0 +1,11 @@ +[Unit] +Description=Kill containerd-shims on shutdown +DefaultDependencies=false +Before=shutdown.target umount.target + +[Service] +ExecStart=/usr/local/bin/k3s-killall.sh +Type=oneshot + +[Install] +WantedBy=shutdown.target