Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Release-1.28] Fix for kill all to not delete the data dir #6563

Merged
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
9 changes: 9 additions & 0 deletions .github/workflows/nightly-install.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,12 @@ jobs:
- name: "rke2-procps"
if: ${{ !contains(matrix.vm, 'windows') }}
run: vagrant provision --provision-with=rke2-procps
- name: "rke2-mount-directory"
if: ${{ !contains(matrix.vm, 'windows') }}
run: vagrant provision --provision-with=rke2-mount-directory
- name: "rke2-killall"
if: ${{ !contains(matrix.vm, 'windows') }}
run: vagrant provision --provision-with=rke2-killall
- name: "rke2-check-mount"
if: ${{ !contains(matrix.vm, 'windows') }}
run: vagrant provision --provision-with=rke2-check-mount
1 change: 0 additions & 1 deletion bundle/bin/rke2-killall.sh
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ systemctl stop rke2-agent.service || true
killtree $({ set +x; } 2>/dev/null; getshims; set -x)

do_unmount_and_remove '/run/k3s'
do_unmount_and_remove "${RKE2_DATA_DIR}"
do_unmount_and_remove '/var/lib/kubelet/pods'
do_unmount_and_remove '/run/netns/cni-'

Expand Down
35 changes: 34 additions & 1 deletion tests/install/install_util.rb
Original file line number Diff line number Diff line change
Expand Up @@ -87,4 +87,37 @@ def kubectlStatus(vm)
kubectl get node,all -A -o wide
SHELL
end
end
end

def mountDirs(vm)
vm.provision "rke2-mount-directory", type: "shell", run: ENV['CI'] == 'true' ? 'never' : 'once' do |sh|
sh.inline = <<~SHELL
#!/usr/bin/env bash
set -eu -o pipefail
echo 'Mounting server dir'
mount --bind /var/lib/rancher/rke2/server /var/lib/rancher/rke2/server
SHELL
end
end

def checkMountPoint(vm)
vm.provision "rke2-check-mount", type: "shell", run: ENV['CI'] == 'true' ? 'never' : 'once' do |sh|
sh.inline = <<~SHELL
#!/usr/bin/env bash
set -eu -o pipefail
echo 'Check the mount'
mount | grep /var/lib/rancher/rke2/server
SHELL
end
end

def runKillAllScript(vm)
vm.provision "rke2-killall", type: "shell", run: ENV['CI'] == 'true' ? 'never' : 'once' do |sh|
sh.inline = <<~SHELL
#!/usr/bin/env bash
set -eu -o pipefail
echo 'Run kill all'
rke2-killall.sh
SHELL
end
end
4 changes: 4 additions & 0 deletions tests/install/opensuse-leap/Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ Vagrant.configure("2") do |config|

kubectlStatus(test.vm)
checkRKE2Processes(test.vm)

mountDirs(test.vm)
runKillAllScript(test.vm)
checkMountPoint(test.vm)
end

config.vm.provision "install-packages", type: "shell", run: "once" do |sh|
Expand Down
4 changes: 4 additions & 0 deletions tests/install/rocky-8/Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ Vagrant.configure("2") do |config|

kubectlStatus(test.vm)
checkRKE2Processes(test.vm)

mountDirs(test.vm)
runKillAllScript(test.vm)
checkMountPoint(test.vm)
end

config.vm.provision "install-packages", type: "shell", run: "once" do |sh|
Expand Down
4 changes: 4 additions & 0 deletions tests/install/ubuntu-2004/Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ Vagrant.configure("2") do |config|
ps auxZ | grep -E 'etcd|kube|rke2|container|confined' | grep -v grep
SHELL
end

mountDirs(test.vm)
runKillAllScript(test.vm)
checkMountPoint(test.vm)
end

config.vm.provision "install-packages", type: "shell", run: "once" do |sh|
Expand Down