-
Notifications
You must be signed in to change notification settings - Fork 21
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
Conversation
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.
guys, please help review the PR! |
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.
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]>
rancher/rancher#47870 is not merged yet, so the behavior here won't take effect, right? |
Yes. But you could theoretically activate the functionality manually when a guest cluster is deleted. I have discussed with Kiefer that I will merge the PR after I have finished and tested it. |
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.