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

Add watch for DataImportCron-labeled PVCs deletion #3285

Merged
merged 1 commit into from
May 23, 2024

Conversation

arnongilboa
Copy link
Collaborator

What this PR does / why we need it:
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-39688

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

@kubevirt-bot kubevirt-bot added release-note Denotes a PR that will be considered when it comes time to generate release notes. dco-signoff: yes Indicates the PR's author has DCO signed all their commits. size/S labels May 22, 2024
@@ -1077,6 +1077,17 @@ func addDataImportCronControllerWatches(mgr manager.Manager, c controller.Contro
return err
}

if err := c.Watch(source.Kind(mgr.GetCache(), &corev1.PersistentVolumeClaim{}),
Copy link
Collaborator

Choose a reason for hiding this comment

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

May want to place this above the snapshot watch, since it has a

// Back out if there's no point to attempt watch
return nil

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good catch, fixed.

@akalenyu
Copy link
Collaborator

/approve

@kubevirt-bot
Copy link
Contributor

[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:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kubevirt-bot kubevirt-bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 22, 2024
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.

Signed-off-by: Arnon Gilboa <agilboa@redhat.com>
@akalenyu
Copy link
Collaborator

/retest

1 similar comment
@arnongilboa
Copy link
Collaborator Author

/retest

Copy link
Contributor

@ShellyKa13 ShellyKa13 left a comment

Choose a reason for hiding this comment

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

/lgtm

@kubevirt-bot kubevirt-bot added the lgtm Indicates that a PR is ready to be merged. label May 23, 2024
@kubevirt-bot kubevirt-bot merged commit 4342b3c into kubevirt:main May 23, 2024
19 checks passed
@arnongilboa
Copy link
Collaborator Author

/cherrypick release-v1.59

@kubevirt-bot
Copy link
Contributor

@arnongilboa: new pull request created: #3300

In response to this:

/cherrypick release-v1.59

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@arnongilboa
Copy link
Collaborator Author

/cherrypick release-v1.58

@kubevirt-bot
Copy link
Contributor

@arnongilboa: #3285 failed to apply on top of branch "release-v1.58":

Applying: Add watch for DataImportCron-labeled PVCs deletion
Using index info to reconstruct a base tree...
M	pkg/controller/dataimportcron-controller.go
Falling back to patching base and 3-way merge...
Auto-merging pkg/controller/dataimportcron-controller.go
CONFLICT (content): Merge conflict in pkg/controller/dataimportcron-controller.go
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Patch failed at 0001 Add watch for DataImportCron-labeled PVCs deletion
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".

In response to this:

/cherrypick release-v1.58

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

arnongilboa added a commit to arnongilboa/containerized-data-importer that referenced this pull request Jun 2, 2024
Manual backport of kubevirt#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.

Signed-off-by: Arnon Gilboa <agilboa@redhat.com>
arnongilboa added a commit to arnongilboa/containerized-data-importer that referenced this pull request Jun 2, 2024
Manual backport of kubevirt#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.

Signed-off-by: Arnon Gilboa <agilboa@redhat.com>
kubevirt-bot pushed a commit that referenced this pull request Jun 2, 2024
…3301)

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.

Signed-off-by: Arnon Gilboa <agilboa@redhat.com>
kubevirt-bot pushed a commit that referenced this pull request Jun 2, 2024
…3302)

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.

Signed-off-by: Arnon Gilboa <agilboa@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. dco-signoff: yes Indicates the PR's author has DCO signed all their commits. lgtm Indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/S
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants