Recreate DIC import DV when first default SC is set#4074
Conversation
|
[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. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
cbc4f06 to
08dd124
Compare
08dd124 to
37bb528
Compare
| if hasCurrent { | ||
| storageClassChanged = currentSc != desiredSc | ||
| } else { | ||
| storageClassChanged = len(dataImportCron.Status.CurrentImports) > 0 |
| Expect(dv.Spec.Storage.AccessModes).To(BeEmpty()) | ||
| }) | ||
|
|
||
| It("Should delete old DV and requeue when first default StorageClass is set", func() { |
There was a problem hiding this comment.
shouldn't it test the creation of a new dv?
akalenyu
left a comment
There was a problem hiding this comment.
Bit confused about the issue
| if desiredStorageClass != nil { | ||
| if deleted, err := r.deleteOutdatedPendingPvc(ctx, pvc, desiredStorageClass.Name, dataImportCron.Name); deleted || err != nil { | ||
| desiredSc := desiredStorageClass.Name | ||
| if deleted, err := r.deleteOutdatedPendingPvc(ctx, pvc, desiredSc, dataImportCron.Name); deleted || err != nil { |
There was a problem hiding this comment.
I'm not sure why the described issue ins't being handled by deleteOutdatedPendingPvc but that was going to solve the no sc->set sc
There was a problem hiding this comment.
Because in the problematic scenario the DV was already created, and will prefer RWX as specified by the default StorageProfile, as it was created before the DIC controller reconciled to prefer RWO, so just deleting the PVC (and not recreating DV) will recreate the PVC again with RWX. I think we better refactor this code and do all the deletion magics in a single call deleting the DV.
There was a problem hiding this comment.
I agree but for backportability why don't we just whack the DV in the deleteOutdatedPendingPvc path?
There was a problem hiding this comment.
deleteOutdatedPendingPvc returns immediately when pvc status != Pending, and also when the pvc SC is the default/desired one, so afaiu it won't help much in the mentioned scenario. @noamasu ?
containerized-data-importer/pkg/controller/dataimportcron-controller.go
Lines 1536 to 1547 in 33bb159
There was a problem hiding this comment.
when SC is nil (and no accessmode specificed in DIC), the DV is stuck with error "PVC spec is missing accessMode and no storageClass to choose profile" and this happens before the DV's PVC is created...
because the PVC is nil, the logic in deleteOutdatedPendingPvc is skipped...
if we want to put the DV deletion in deleteOutdatedPendingPvc, we might need to do some extra changes there (and also change the this func name to reflect DV deletion as well)
I can go to that direction if you think this is worth it
I tried to keep the fix as contained as possible, but i can refactor if needed
There was a problem hiding this comment.
Thinking about it some more, I think we're better off handling a DV spec mismatch at all times, similarly to the snapshot thing (handleSnapshotClassChange). The reasoning is that I don't think this type of issues will be limited to the storage class switching scenario
There was a problem hiding this comment.
the thing with default SC is that the DV spec are the same for current and desired DV in case a default SC is being set, therefore a DV spec mismatch will probably wont detect that edge case change.. (same for the outdated PVC edge case, you still need to check the PVC's SC name and compare it to desired SC... what we can do is instead of removing the PVC, we can remove the DV instead).
would you prefer to keep that fix contained with what we have right now and later open another PR for a broader mismatch refactor, or would you rather do the refactor in this PR? (which again, will probably be unrelated to this specific nil to default SC case... we will probably still need to track down the desiredStorageClass and decide if to delete DV according to its changes).
There was a problem hiding this comment.
The desired DV spec will be created explicitly with RWO, so reflect.DeepEqual() should detect the change, right?
containerized-data-importer/pkg/controller/dataimportcron-controller.go
Lines 1797 to 1803 in 4e4aaa3
There was a problem hiding this comment.
I think I remember that reconciling over the DV desired != current was trickier to implement but as @arnongilboa said it's definitely doable. Maybe snap has to carry source access mode so you know when to reconcile
There was a problem hiding this comment.
I see we took a hybrid approach instead of strictly focusing on the spec drift, which makes me worry a little since we have to reason about the broader introduced condition.
IMO, the backport-friendly version of this change is to strictly handle spec drifts on the DV and act accordingly, and a follow up to main for a bigger refactor.
That said, I fully acknowledge that I am on the cautious side, and if we can get a 2-1 vote on this, I am willing to proceed.
b298650 to
37bb528
Compare
37bb528 to
b4dc55a
Compare
b4dc55a to
3d24d4d
Compare
|
/retest |
|
@noamasu: The following tests failed, say
DetailsInstructions 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. |
3d24d4d to
782019d
Compare
782019d to
c4a39f9
Compare
|
[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. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
c4a39f9 to
f75b3d6
Compare
33f1aad to
a765b41
Compare
|
/retest |
The default SC change condition only handled changes from one SC to another, but did not handle the first default SC being set. To get the DIC-created DV with the DIC-special RWO preference, it must be deleted (as DV is immutable) and recreated with the right settings from the new default StorageClass. Signed-off-by: Noam Assouline <nassouli@redhat.com>
a765b41 to
d4dd4c7
Compare
akalenyu
left a comment
There was a problem hiding this comment.
main worry in #4074 (comment) 🙏
|
I think the destructive lane failure is related https://prow.ci.kubevirt.io/view/gs/kubevirt-prow/pr-logs/pull/kubevirt_containerized-data-importer/4074/pull-containerized-data-importer-e2e-destructive/2072598145111429120 |
|
@noamasu: The following tests failed, say
DetailsInstructions 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. |
What this PR does / why we need it:
The default SC change condition only handled changes from one SC to another, but did not handle the first default SC being set.
To get the DIC-created DV with the DIC-special RWO preference, it must be deleted (as DV is immutable) and recreated with the right settings from the new default StorageClass.
Which issue(s) this PR fixes:
Jira: https://redhat.atlassian.net/browse/CNV-81826
Special notes for your reviewer:
Release note: