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

Added cleanupDataDir function to remove any folders within the data d… #5139

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

derickdiaz
Copy link

Proposed Changes

This PR adds the ability for the RKE2 executable to clean up unused data directory folders. As RKE2 clusters are upgraded, the data directory keeps old artifacts of its previous versions. As described within the issue discussion, when a cluster is upgraded, containers running within the cluster may still reference the old artifacts from previous versions. This will happen until the rke2 service is restart or the machine is rebooted. I implemented it in a way even if the service fails to clean up the data directory the RKE2 cluster will continue with its startup process.

Types of Changes

New Feature

Verification

  • Create an RKE2 Cluster
  • Upgrade the cluster
  • Restart the RKE2 service and verify the data directories from previous versions no longer exists

Testing

Linked Issues

#3902

User-Facing Change

NONE

Further Comments

For this feature, I tried to use https://github.com/mitchellh/go-ps/tree/master to identify what folders need to be deleted in the data directory; however, referencing the executables did not show the same output as traversing proc directory and retrieving the symlinks for the exe file for each process folder. Additionally, I did not implement how this would work on the windows version of RKE2.

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.

1 participant