kubevirt / containerized-data-importer

Data Import Service for kubernetes, designed with kubevirt in mind.
Apache License 2.0
413 stars 259 forks source link

[release-v1.58] Add watch for DataImportCron-labeled PVCs deletion #3301

Closed arnongilboa closed 4 months ago

arnongilboa commented 4 months ago

What this PR does / why we need it: Manual backport of #3285

When the DataImportCron last import DV is manually deleted, the controller reconciles, but due to k8s default background cascading deletion, the PVC may still temporarily exist, so the controller will not re-create the DV even after the PVC is deleted, unless it reconciles due to other watched CR like DataSource. In the scenario of CNV-39688, since we move from pvc source format to snapshot, the DataSource won’t update until a snapshot is created, which will never happen. To solve it we add a watch for deletion of DataImportCron-labeled PVCs. The change was tested locally, but since it required two storage classes it’s currently out of scope for the existing CI lanes, so it requires tier-2 test.

Which issue(s) this PR fixes: Fixes # https://issues.redhat.com/browse/CNV-42129

Special notes for your reviewer:

Release note:

BugFix: On deletion of the last import DV of DataImportCron with Snapshot source format, re-create an import DV
arnongilboa commented 4 months ago

If you grab 7360fb1 I think you'll get a clean backport (It's low priority for a backport IMO but still has some value)

It won't. In main we use source.Kind() helper instead of source.Kind{}, so the patch will fail.

akalenyu commented 4 months ago

/approve /lgtm

kubevirt-bot commented 4 months ago

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: akalenyu

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files: - ~~[OWNERS](https://github.com/kubevirt/containerized-data-importer/blob/release-v1.58/OWNERS)~~ [akalenyu] Approvers can indicate their approval by writing `/approve` in a comment Approvers can cancel approval by writing `/approve cancel` in a comment