-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Preliminary support for DataVolumes using populators internally #9812
Conversation
bb8427a
to
0f25d8e
Compare
/retest-required |
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.
Over all looks good, a few questions and a suggestion
pkg/storage/snapshot/restore.go
Outdated
waitingDV = waitingDV || | ||
(dv.Status.Phase != v1beta1.Succeeded && | ||
dv.Status.Phase != v1beta1.WaitForFirstConsumer && | ||
dv.Status.Phase != v1beta1.PendingPopulation) | ||
continue | ||
} | ||
if createdDV, err = t.createDataVolume(dvt); err != nil { |
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.
good catch by adding "waitingDV = waitingDV ||" dont we need to do in "createdDV = createdDV || result of t.createDataVolume(dvt)" by the same logic?
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.
Yeah this code is pretty wonky, can also remove this unnecessary statement at the end of the loop:
...
}
if !createdDV {
continue
}
}
if dv.Status.Phase != cdiv1.Succeeded { | ||
isBound := dvConditions.HasConditionWithStatus(dv, cdiv1.DataVolumeBound, v1.ConditionTrue) | ||
// WFFC + plus unbound is not provisioning | ||
if isBound || dv.Status.Phase != cdiv1.WaitForFirstConsumer { |
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.
maybe then just add dv.Status.Phase == cdiv1.WaitForFirstConsumer to the line where you check succeeded and pendingPopulation, if its WFFC it can be bound anyways right?
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.
We want WFFC and bound to be "provisioning" so cannot add WFFC to prev check
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.
how can it be bound and WFFC?
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.
Small time between doppelganger pod created/running and DV phase is updated
@@ -320,6 +320,11 @@ var _ = Describe("VirtualMachine", func() { | |||
createCount := 0 | |||
shouldExpectDataVolumeCreation(vm.UID, map[string]string{"kubevirt.io/created-by": string(vm.UID), "my": "label"}, map[string]string{"my": "annotation"}, &createCount) | |||
|
|||
vmInterface.EXPECT().UpdateStatus(context.Background(), gomock.Any()).Times(1).Do(func(ctx context.Context, obj interface{}) { | |||
objVM := obj.(*virtv1.VirtualMachine) | |||
Expect(objVM.Status.PrintableStatus).To(Equal(virtv1.VirtualMachineStatusProvisioning)) |
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 wonder why now this test returns that the dv is provisioning and before it didnt
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.
Before it wasn't calling updateStatus at all because unset dv phase and unbound condition was not considered provisioning. I think that's incorrect.
@@ -2997,11 +3003,16 @@ var _ = Describe("VirtualMachine", func() { | |||
Expect(objVM.Status.PrintableStatus).To(Equal(status)) | |||
}) | |||
|
|||
if running { | |||
vmiInterface.EXPECT().Create(context.Background(), gomock.Any()).Return(vmi, nil) |
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 wonder why before create call was not expected
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.
because we were not setting the dv phase before
5dfe472
to
ad531f9
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.
Nice
/lgtm
Signed-off-by: Michael Henriksen <mhenriks@redhat.com>
Signed-off-by: Michael Henriksen <mhenriks@redhat.com>
ad531f9
to
9ad2454
Compare
/retest-required |
1 similar comment
/retest-required |
/lgtm |
Looks great! |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: alicefr 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 |
What this PR does / why we need it:
Very soon, DataVolumes will use Volume Populators[1] internally. But before that happens, we have to merge this PR. Otherwise, if KubeVirt consumes a version of CDI with populator support, WaitForFirstConsumer PVCs will be broken.
Basically, KubeVirt has to know that it is okay to start VMs with DataVolumes in
PendingPopulation
phase. Nice thing aboutPendingPopulation
is that we avoid having to create "doppelganger" virt-launcher pods simply to bind WFFC PVCs. See #4025[1] https://kubernetes.io/blog/2022/05/16/volume-populators-beta/
Which issue(s) this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close the issue(s) when PR gets merged):Fixes #
Special notes for your reviewer:
Once CDI releases with populator support, there will be another PR here with functional tests
Release note: