-
Notifications
You must be signed in to change notification settings - Fork 372
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
Fix deletion of persistent data with k0s reset #5193
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ncopa
changed the title
Fix deletion of data and kube root dirs
Fix deletion of persistent data with k0s reset
Nov 8, 2024
ncopa
force-pushed
the
reset-umount-delete
branch
from
November 8, 2024 16:03
8599e88
to
7a4fc92
Compare
This superseeds #5187 |
Make sure that we don't have anything mounted under those directories so we don't delete persistent data. We do this py parsing /proc/mounts in reverse order as it is listed in mount order, and then we unmount anything that is under our directories before we delete them. Don't umount datadir itself if it is on a separate partition/mount Fixes k0sproject#4318 Signed-off-by: Natanael Copa <[email protected]>
Add a script to the reset integration test that tries to clutter the data directory by placing files and directories with odd permissions, adding symlinks to stuff outside the data directory, and adding bind mounts in various ways. This is to prove that k0's reset will never delete anything that is not beneath the data directory. Signed-off-by: Tom Wieczorek <[email protected]>
ncopa
force-pushed
the
reset-umount-delete
branch
from
November 8, 2024 16:12
7a4fc92
to
2897c35
Compare
ncopa
added
bug
Something isn't working
backport/release-1.29
PR that needs to be backported/cherrypicked to the release-1.29 branch
backport/release-1.30
PR that needs to be backported/cherrypicked to the release-1.30 branch
backport/release-1.31
PR that needs to be backported/cherrypicked to the release-1.31 branch
labels
Nov 8, 2024
16 tasks
k0s reset will delete any leftovers safely when deleting directories. Signed-off-by: Natanael Copa <[email protected]>
twz123
approved these changes
Nov 29, 2024
Backport failed for Please cherry-pick the changes locally and resolve any conflicts. git fetch origin release-1.29
git worktree add -d .worktree/backport-5193-to-release-1.29 origin/release-1.29
cd .worktree/backport-5193-to-release-1.29
git switch --create backport-5193-to-release-1.29
git cherry-pick -x 7ab81aa71708240a6de345c8ad027f422554b276 2897c35fd6428b0f9fdcb4859f1ea551e6f1034e 12aa9065b53e1a1940545ece35673b5794cfd7d2 |
Successfully created backport PR for |
Successfully created backport PR for |
16 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
backport/release-1.29
PR that needs to be backported/cherrypicked to the release-1.29 branch
backport/release-1.30
PR that needs to be backported/cherrypicked to the release-1.30 branch
backport/release-1.31
PR that needs to be backported/cherrypicked to the release-1.31 branch
bug
Something isn't working
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Make sure that we don't have anything mounted under those directories so we don't delete persistent data.
We do this py parsing /proc/mounts in reverse order as it is listed in mount order, and then we unmount anything that is under our directories before we delete them.
Don't umount datadir itself if it is on a separate partition/mount
Fixes #4318
Description
Fixes # (issue)
Type of change
How Has This Been Tested?
Checklist: