-
Notifications
You must be signed in to change notification settings - Fork 301
Fix VolumeImportSource DataVolume status tracking #3941
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
base: main
Are you sure you want to change the base?
Fix VolumeImportSource DataVolume status tracking #3941
Conversation
- Enable progress tracking in external-population-controller - Add updateCDIPopulatorStatus to handle CDI volume populators - Add comprehensive unit tests for all CDI populator types
|
Adding the "do-not-merge/release-note-label-needed" label because no release-note block was detected, please follow our release note process to remove it. 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. |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
Hi @DiMalovanyy. Thanks for your PR. PRs from untrusted users cannot be marked as trusted with I understand the commands that are listed here. 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. |
|
Hi, thanks for the PR, I will review shortly. To get the |
|
Thanks for the PR! would love to hear more about the use case, we generally only create the target PVCs with our own dataSourceRefs, not the DVs themselves. /cc @alromeros |
|
Hi @akalenyu, |
I see, you don't want to rely on us creating the volumeImportSource on your behalf? |
In my system, software image creation and image instantiation is two different processes. Also I want to have multiple instances (DataVolumes) that references the same VolumeImportSource. |
- Enable progress tracking in external-population-controller - Add updateCDIPopulatorStatus to handle CDI volume populators - Add comprehensive unit tests for all CDI populator types Signed-off-by: DiMalovanyy <[email protected]>
…github.com:DiMalovanyy/containerized-data-importer into fix-external-pupulator-controller-dv-reconcilation
|
Thanks for your pull request. Before we can look at it, you'll need to add a 'DCO signoff' to your commits. 📝 Please follow instructions in the contributing guide to update your commits with the DCO Full details of the Developer Certificate of Origin can be found at developercertificate.org. The list of commits missing DCO signoff:
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. I understand the commands that are listed here. |
alromeros
left a comment
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.
Thanks @DiMalovanyy for the PR! The overall logic looks fine, but I have a couple of concerns.
In principle I’m not keen to add CDI populator logic into the external-population controller. That controller is intended as a generic way to support external populators, and including CDI-populator specific behavior introduces a level of knowledge that'd be better to avoid considering we have a native way to use those populators. If the use case justifies the change I’m ok with merging, but in my opinion creating a regular dv with an import source is probably just as simple at scale as the approach you are currently using. That said I'd also like to hear what other maintainers think.
Aside from that, I second @awels’ comment about signing the commits. It also looks like there is a leftover commit that should be removed:
fd295de
| } | ||
|
|
||
| func (r *PopulatorReconciler) updateStatusPhase(pvc *corev1.PersistentVolumeClaim, dataVolumeCopy *cdiv1.DataVolume, event *Event) error { | ||
| if isCDIVolumePopulator(dataVolumeCopy) { |
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.
The checkPopulationRequirements function might be a bit rusty (we are still checking if the feature gate is enabled though it's been true by default since v1.24), but imo it makes more sense to include this check nested in the else if supported condition.
Thanks for your comment. However, the external-population-controller does not handle these annotations properly, even though it could. This might be confusing for users who try to use VolumeImportSource or other CDI resources as a dataSourceRef. If you decide not to merge these changes, I think it should at least be documented that using a DataVolume with a dataSourceRef to CDI-managed resources may not work as expected. |
What this PR does / why we need it:
This PR fixes a bug where DataVolumes using
VolumeImportSourceviaspec.storage.dataSourceRefwere immediately marked asSucceededwithout tracking theactual import progress.
When using CDI's own volume populators (VolumeImportSource, VolumeUploadSource, VolumeCloneSource) through the dataSourceRef field, the
external-population-controller was treating them like external populators and immediately setting them to Succeeded status, instead of tracking their actual
phase transitions (ImportScheduled → ImportInProgress → Succeeded) and progress percentages.
After the fix
Changes:
- Enable progress tracking in external-population-controller (set
shouldUpdateProgress: true)- Add
updateCDIPopulatorStatus()to read PVC annotations set by populator controllers and update DataVolume phases accordingly- Add helper functions
isCDIVolumePopulator()andgetCDIVolumePopulatorKind()to distinguish CDI's own populators from external ones- Add comprehensive unit tests for all CDI populator types (Import, Upload, Clone) covering phase transitions, progress tracking, and failure scenarios
Special notes for your reviewer:
The fix keeps CDI volume populators routed to the external-population-controller (as designed) but adds special handling to read the PVC annotations
(
cdi.kubevirt.io/storage.pod.phaseandcdi.kubevirt.io/storage.populator.progress) that are set by the respective populator controllers (import-populator,upload-populator, clone-populator). This mirrors the status update logic from import-controller but adapted for the populator pattern.
All existing tests pass (302/302), including 8 new tests that verify proper phase transitions and progress tracking for CDI volume populators.
Testing: A pre-built image with this fix is available at
ghcr.io/kube-nfv/cdi-controller:v1.63-dv-rec-fixfor testing purposes.