-
Notifications
You must be signed in to change notification settings - Fork 19
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
Delete all PVCs if guest cluster is deleted in Rancher #64
Open
votdev
wants to merge
1
commit into
harvester:master
Choose a base branch
from
votdev:issue_2825
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
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
w13915984028
approved these changes
Nov 5, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks.
Oats87
suggested changes
Nov 5, 2024
If a cluster is deleted, the PVCs of the workloads are not deleted in Harvester. This is because the node driver does not know why the associated VM has to be deleted, e.g. because its parameters have changed or because the cluster is deleted. To solve the problem, a finalizer on the Machine resource in Rancher will add an annotation to the VM which then is evaluated by the node driver when it running the Remove() handler. Signed-off-by: Volker Theile <[email protected]>
guys, please help review the PR! |
ibrokethecloud
approved these changes
Dec 12, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm. thanks.
FrankYang0529
approved these changes
Dec 12, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
If a cluster is deleted, the PVCs of the workloads are not deleted in Harvester. This is because the node driver does not know why the associated VM has to be deleted, e.g. because its parameters have changed or because the cluster is deleted.
To solve the problem, a finalizer on the
Machine
resource in Rancher will add an annotation to the VM which then is evaluated by the node driver when it running theRemove()
handler.See rancher/rancher#47870 for the Rancher part.
Related to: harvester/harvester#2825
When the cluster is deleted in Rancher, a pod is started which will run the
docker-machine-driver-harvester
binary. The output will look like this:Testing
Testing can be done via an ipxe test cluster. Note, this test requires a Rancher setup containing this PR.
make build && make package
ssh [email protected]
and run:Pod
tab and chooseCreate Persistent Volume Claim
after pressing theAdd Volume
button. Make sure to use theHarvester
storage class.harvesterhci.io/removeAllPersistentVolumeClaims
annotation at the VM in Harvester.10. There is a pod (in the Rancher context) which is running the node driver binary. The log output should look like this:
Force the removal of all persistent volume claims
log line MUST be present.Volumes
page in Harvester. The volume that was created by the workload in rancher MUST be removed.