-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Split vmi controller into smaller, more maintainable parts #14238
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
Conversation
Skipping CI for Draft Pull Request. |
/cc @xpivarc |
/test all |
5b2571d
to
8119bee
Compare
/test all |
8119bee
to
9710467
Compare
/test all |
646d244
to
07e1084
Compare
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.
Looks good overall, thanks!
What I dislike is that now we have storage.go
and datavolumes.go
files.
And in storage.go
, there are some methods about the datavolumes.
Can we merge them? or move dv methods under the right file?
Thank you!
@fossedihelm thanks. I think it's better to separate at this point. Did you mean the datavolume event handlers? (add/update/delete) or anything else? |
Well, I was referring to the event handlers. But there is a cross-context function, |
07e1084
to
da01c3c
Compare
Thank you @vladikr! |
@jean-edouard Can you please take a look? |
/test pull-kubevirt-e2e-k8s-1.32-sig-storage |
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.
/approve
Required labels detected, running phase 2 presubmits: |
Quite strange how the storage is failing even if the changes just involve function moving and minor refactorings. |
/hold |
yup, something is not right with this test... |
@jean-edouard the test itself is passing just fine. Looks like the cleanup is causing the issue. |
da01c3c
to
02c12a2
Compare
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: jean-edouard 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 |
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 a lot @vladikr! Looks awesome overall.
@@ -375,3 +375,38 @@ func (c *Controller) getFilesystemOverhead(pvc *k8sv1.PersistentVolumeClaim) (vi | |||
} | |||
return storagetypes.GetFilesystemOverhead(pvc.Spec.VolumeMode, pvc.Spec.StorageClassName, cdiConfig) | |||
} | |||
|
|||
func (c *Controller) syncVolumesUpdate(vmi *virtv1.VirtualMachineInstance) { |
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.
tiny nit: this belongs to the previous commit.
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.
done
@@ -747,7 +747,7 @@ var _ = Describe(SIG("Volumes update with migration", decorators.RequiresTwoSche | |||
return controller.NewVirtualMachineConditionManager().HasCondition( | |||
vm, virtv1.VirtualMachineManualRecoveryRequired) | |||
}).WithTimeout(120 * time.Second).WithPolling(time.Second).Should(BeFalse()) | |||
libwait.WaitForVMIPhase(vmi, []v1.VirtualMachineInstancePhase{v1.Running}) | |||
Eventually(matcher.ThisVMI(vmi), 360*time.Second, time.Second).Should(matcher.BeInPhase(v1.Running)) |
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.
I fail to understand how this is related.
Should these failures concern us that some behavior was changed in this PR?
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.
@iholder101 no, the WaitForVMIPhase looks at weird warnings and fails on them. For example `Unexpected Warning event received: testvmi-klbkg,f35c019b-b555-4665-a08f-ea219efa6a63: Failed to delete virtual machine pod virt-launcher-testvmi-klbkg-qn8zd
Obviously, all pods are deleted in this test, and it is complete. I think the warning is related to garbage collection. I was watching the pods manually, there were no delays or failures.
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.
This is most certainly not related to your changes, but still concerning.
I've opened an issue to track this: #14326.
This move storage related functions and event handlers to storage.go Signed-off-by: Vladik Romanovsky <vromanso@redhat.com>
Signed-off-by: Vladik Romanovsky <vromanso@redhat.com>
This moves all lifecycle related functions and event handlers into lifecycle.go Signed-off-by: Vladik Romanovsky <vromanso@redhat.com>
Signed-off-by: Vladik Romanovsky <vromanso@redhat.com>
Signed-off-by: Vladik Romanovsky <vromanso@redhat.com>
02c12a2
to
db53a5d
Compare
/lgtm |
Required labels detected, running phase 2 presubmits: |
Thank you very much @vladikr and everyone else involved! |
FYI @ShellyKa13 @akalenyu |
/retest |
/retest-required |
What this PR does
Currently, the controller was split into three smaller parts: storage.go, lifecycle.go, and vmi.go.
The idea was to isolate storage-related code into storage.go, compute/lifecycle-related code into lifecycle.go, and keep the core controller logic in vmi.go
The next step is to move the storage related code into pkg/storage - but I have concerns about this change. Perhaps separating it into vmi/storage with it own OWNERS file would be a better approach.
Special notes for your reviewer
Release note