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

Add a change for killall to not unmount server and agent directory #10403

Merged
merged 1 commit into from
Aug 7, 2024

Conversation

vitorsavian
Copy link
Member

@vitorsavian vitorsavian commented Jun 25, 2024

Proposed Changes

  • Since our kill all script unmount and delete the entire /var/lib/rancher/k3s directory, the main idea is to remove the unmount and delete.
  • Add a cleaner for mounted dirs when using the uninstall script

Types of Changes

  • Changes to killall script to not delete anything inside /var/lib/rancher
  • Changes to uninstall script to not delete mounted dirs inside /var/lib/rancher

Verification

  • install k3s using my commit and then use the killall script
  • uninstall k3s with the uninstall script

Testing

Linked Issues

User-Facing Change


Further Comments

@vitorsavian vitorsavian requested a review from a team as a code owner June 25, 2024 15:54
Copy link

codecov bot commented Jun 25, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 43.54%. Comparing base (82ba778) to head (41917b2).

❗ There is a different number of reports uploaded between BASE (82ba778) and HEAD (41917b2). Click for more details.

HEAD has 1 upload less than BASE
Flag BASE (82ba778) HEAD (41917b2)
e2etests 7 6
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #10403      +/-   ##
==========================================
- Coverage   49.68%   43.54%   -6.15%     
==========================================
  Files         179      179              
  Lines       14955    14955              
==========================================
- Hits         7431     6512     -919     
- Misses       6166     7250    +1084     
+ Partials     1358     1193     -165     
Flag Coverage Δ
e2etests 36.33% <ø> (-10.05%) ⬇️
inttests 36.72% <ø> (+0.05%) ⬆️
unittests 13.41% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

install.sh Outdated Show resolved Hide resolved
Copy link
Contributor

@brandond brandond left a comment

Choose a reason for hiding this comment

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

  1. Need to account for possibility of arbitrary other mounted paths, not just the agent and server dirs.
  2. Need to account for data and storage dirs under /var/lib/rancher/k3s

install.sh Outdated Show resolved Hide resolved
install.sh Outdated Show resolved Hide resolved
install.sh Outdated Show resolved Hide resolved
install.sh Outdated
do_unmount_and_remove '/var/lib/kubelet/pods'
do_unmount_and_remove '/var/lib/kubelet/plugins'
do_unmount_and_remove '/run/netns/cni-'
clean_mounted_directory '/var/lib/rancher/k3s'
Copy link
Contributor

Choose a reason for hiding this comment

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

wait wait wait, we put this in the killall script... so now whenever you run the killall script it deletes all of K3s off your node. This makes sense to do in the uninstaller but the killall script DEFINITELY shouldn't be deleting everything out from under /var/lib/rancher/k3s otherwise you end up wiping your cluster off the face of the earth when all you wanted to do was kill the pods and service.

Copy link
Member Author

Choose a reason for hiding this comment

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

@brandond when you said about deleting everything inside the /var/lib/rancher/k3s means also for the data and storage? btw I added the clean_mounted_directory to the uninstall script.

Copy link
Contributor

Choose a reason for hiding this comment

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

thanks! Sorry, I realize my review here has not been great, I forgot that we were talking about killall and not just uninstall.

@brandond
Copy link
Contributor

brandond commented Jul 3, 2024

This looks good to me but I'd like someone from QA to validate it on a couple different distros with different disks mounted under /var/lib/rancher/ just to validate that I haven't missed anything - prior to merging.

@vitorsavian vitorsavian force-pushed the killallunmount branch 2 times, most recently from 872c6f6 to 9a0c31f Compare July 12, 2024 15:21
@vitorsavian
Copy link
Member Author

@brandond after the merge of #10473 will we affect rancher if we change again to not delete anything when running killall?

@brandond
Copy link
Contributor

I think it should be OK?

brandond
brandond previously approved these changes Jul 26, 2024
@fmoral2
Copy link
Contributor

fmoral2 commented Aug 6, 2024

This looks good to me but I'd like someone from QA to validate it on a couple different distros with different disks mounted under /var/lib/rancher/ just to validate that I haven't missed anything - prior to merging.

  • Sorry was passing by, can we just add a sh test for that ? instead of QA

maybe just simulate a disks mounted in some distros and creating the path( /var/lib/rancher/ ) and one test for a custom dir
then call the install and uninstall function
then just create a func to validate the uninstall was ok removing and not removing the expected dirs and the mountpoint ?

@dereknola
Copy link
Contributor

Ignore centos 7 failure, I am handling it in a separate PR.

Signed-off-by: Vitor Savian <[email protected]>

Add recursive search and deletion of unmounted/mounted dirs in killall

Signed-off-by: Vitor Savian <[email protected]>

Only clean the server and agent directory if it is uninstall

Signed-off-by: Vitor Savian <[email protected]>

Add uninstall test to check mount points

Signed-off-by: Vitor Savian <[email protected]>

Add uninstall test in CI

Signed-off-by: Vitor Savian <[email protected]>
@vitorsavian vitorsavian merged commit 3aceb85 into k3s-io:master Aug 7, 2024
35 of 36 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants