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

OVA: manually remove PVs attached to ova provider once it deleted. #679

Closed
wants to merge 1 commit into from

Conversation

bkhizgiy
Copy link
Member

When deleting an OVA provider, the PVs are not automatically deleted. To overcome this issue, as part of the reconciler, we need to perform a manual clean-up. Since the provider is already deleted, we can't query the specific PV by name, so using the PV prefix and labels, we find the matching one. And if the status of it is 'released' (which indicates that the provider was deleted), we remove it from the system.

@bkhizgiy bkhizgiy requested a review from ahadas as a code owner December 10, 2023 16:56
Signed-off-by: Bella Khizgiyaev <bkhizgiy@redhat.com>
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.5% 0.5% Duplication

@bkhizgiy bkhizgiy requested review from bennyz and liranr23 December 10, 2023 17:11
pkg/controller/provider/controller.go Show resolved Hide resolved
@@ -157,6 +160,28 @@ func (r Reconciler) Reconcile(ctx context.Context, request reconcile.Request) (r
_ = r.DB().Close(true)
}
}

// Wait for the PV to release
Copy link
Member

Choose a reason for hiding this comment

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

we should try to avoid placing provider-specific logic here in general and particularly when we add 5 seconds sleep that applies only to the OVA provider
it's not that great either, but it still seems better, to place this code in the Shutdown function of the OVA provider, WDYT?

Copy link
Member Author

Choose a reason for hiding this comment

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

yeah I think I mention it in one of our talks that its not the best place since its effect all the providers, i"ll try to move it directly under the ova instead.

Copy link
Member

@ahadas ahadas Dec 19, 2023

Choose a reason for hiding this comment

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

Another approach that is worth checking is to use a finalizer for the PVC that would remove the PV

Copy link
Member Author

Choose a reason for hiding this comment

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

Currently I'm encounter some issues with using the finalizer ,especially watching the PVC to catch the delete operation, so I'm putting this aside for now and switching back to the virt-v2v taks, I"ll come bake to it later (I think is the least urgent task from the existing ones).

Copy link
Member

@ahadas ahadas Dec 26, 2023

Choose a reason for hiding this comment

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

@bkhizgiy sure, getting the right configuration from the output of virt-v2v is definitely more important than #672

Copy link
Member

Choose a reason for hiding this comment

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

looking at this thread a bit more carefully, the finalizer should indeed not be placed on the PVC but on the provider - so when the provider is deleted, we'll try to remove its PV and only when the PV is removed, the finalizer is removed and the deletion of the provider can proceed

Copy link
Member

Choose a reason for hiding this comment

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

looking at this thread a bit more carefully, the finalizer should indeed not be placed on the PVC but on the provider - so when the provider is deleted, we'll try to remove its PV and only when the PV is removed, the finalizer is removed and the deletion of the provider can proceed

@bkhizgiy posted #742 with those changes

pkg/controller/provider/controller.go Show resolved Hide resolved
@ahadas ahadas linked an issue Dec 25, 2023 that may be closed by this pull request
@ahadas
Copy link
Member

ahadas commented Feb 13, 2024

closing in favor of #742

@ahadas ahadas closed this Feb 13, 2024
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.

PV isn't removed when an OVA provider is deleted
2 participants