Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion config/k3s/k3s.service
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ Restart=always
RestartSec=5s
ExecStartPre=-@coreutils@/bin/rm -f /run/k3s/containerd/containerd.sock
ExecStart=@k3s@/bin/k3s server

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Operational behavior change on manual stop: Removing ExecStopPost=k3s-killall.sh is the right call for the auto-restart path (this is exactly what upstream k3s ships, and it lets KillMode=process + ExecStartPre=rm ... containerd.sock do their job so k3s can reattach to still-running containerd after a crash). One side effect worth mentioning in the PR description: a manual systemctl stop k3s will now leave containerd, pods, and CNI netns/mounts in place until an operator invokes k3s-killall.sh explicitly. Not a bug (matches upstream), just a UX change for anyone who was relying on systemctl stop k3s as a full teardown.

ExecStopPost=-@k3s@/bin/k3s-killall.sh

[Install]
WantedBy=multi-user.target
15 changes: 15 additions & 0 deletions spec/k3s_service_activate_spec.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,21 @@ The output should include 'set -euo pipefail'
End
End

Describe 'config/k3s/k3s.service'
SERVICE="$PWD/config/k3s/k3s.service"

It 'restarts k3s after an unexpected exit'
When run grep '^Restart=always$' "$SERVICE"
The output should include 'Restart=always'
The status should be success
End

It 'does not run the destructive killall helper after service exit'
When run grep 'ExecStopPost=.*k3s-killall' "$SERVICE"
The status should equal 1
End
End

Describe 'sudo detection'
It 'checks for sudo command'
When run bash -c "grep 'command -v sudo' '$SCRIPT'"
Expand Down
Loading