Commit Graph

13 Commits

Author SHA1 Message Date
Alex Kalenyuk
31d12e426e
update k8s & related libraries to 1.28 (#3078)
* Bump k8s/OpenShift/ctrl-runtime/lifecycle-sdk & make deps-update

Signed-off-by: Alex Kalenyuk <akalenyu@redhat.com>

* Operator: adapt for dependency bump

Signed-off-by: Alex Kalenyuk <akalenyu@redhat.com>

* Controller: adapt watch calls for dependency bump

Signed-off-by: Alex Kalenyuk <akalenyu@redhat.com>

* Controller: adapt to ctrl-runtime's cache API changes

Signed-off-by: Alex Kalenyuk <akalenyu@redhat.com>

* Operator: fix unit tests by deleting resources properly in fake client

Signed-off-by: Alex Kalenyuk <akalenyu@redhat.com>

* Controller: fix unit tests by deleting resources properly in fake client

Signed-off-by: Alex Kalenyuk <akalenyu@redhat.com>

* Controller: adapt to fake client honoring status subresource

Signed-off-by: Alex Kalenyuk <akalenyu@redhat.com>

* Fix codegen script & make generate

There are some issues in the new script, so we
will still use the deprecated one.
More context in f4d1a5431b

Signed-off-by: Alex Kalenyuk <akalenyu@redhat.com>

* Functests: Adapt to NamespacedName now implementing MarshalLog

ns/name -> {"name":"name","namespace":"ns"}

Signed-off-by: Alex Kalenyuk <akalenyu@redhat.com>

* Functests & API server: address deprecation of wait.PollImmediate

Signed-off-by: Alex Kalenyuk <akalenyu@redhat.com>

---------

Signed-off-by: Alex Kalenyuk <akalenyu@redhat.com>
2024-01-23 17:52:05 +01:00
Michael Henriksen
b86d3dd3a3
Feature Gate and annotation for PVCs to be "adopted" by DataVolumes (#3029)
* apiserver support for cdi.kubevirt.io/allowClaimAdoption

Signed-off-by: Michael Henriksen <mhenriks@redhat.com>

* controller support for cdi.kubevirt.io/allowClaimAdoption on existing PVC

Signed-off-by: Michael Henriksen <mhenriks@redhat.com>

* if cdi.kubevirt.io/allowClaimAdoption specified on DataVolume do not apply on PVC until DV is succeeded

Signed-off-by: Michael Henriksen <mhenriks@redhat.com>

* add DataVolumeClaimAdoption featuregate and integrate with apiserver and controller

Signed-off-by: Michael Henriksen <mhenriks@redhat.com>

* functional tests for claim adoption

Signed-off-by: Michael Henriksen <mhenriks@redhat.com>

* Fix func test failure and address some review comments

Signed-off-by: Michael Henriksen <mhenriks@redhat.com>

* rename pvcRequiresNoWork to pvcRequiresWork

Signed-off-by: Michael Henriksen <mhenriks@redhat.com>

* allow unbound PVC to be adopted

Signed-off-by: Michael Henriksen <mhenriks@redhat.com>

---------

Signed-off-by: Michael Henriksen <mhenriks@redhat.com>
2024-01-17 19:53:59 +01:00
akalenyu
3ca01fd500
Fix possible nil ptr in snapshot/pvc clone controllers (#2900)
We slap on the clone-without-source index key regardless of source.PVC/source.Snapshot so
it was possible for a DV with PVC source to get queued for the snapshot controller
(and hence the nil ptr).

The test addition demonstrates a real use case where this would happen.

Signed-off-by: Alex Kalenyuk <akalenyu@redhat.com>
2023-09-22 00:18:23 +02:00
Arnon Gilboa
3c57d94d4c
Annotate PVC with host-assisted clone fallback reason; add missing events (#2814)
* Annotate PVC with host-assisted clone fallback reason

and add missing events

Signed-off-by: Arnon Gilboa <agilboa@redhat.com>

* Add PVC clone fallback annotation and event

when DV controller is using the non-CSI clone path

Signed-off-by: Arnon Gilboa <agilboa@redhat.com>

* Add func tests

Signed-off-by: Arnon Gilboa <agilboa@redhat.com>

---------

Signed-off-by: Arnon Gilboa <agilboa@redhat.com>
2023-07-26 18:12:36 +02:00
Shelly Kagan
533a725d40
Allow ImmediateBinding annotation when using populators (#2765)
* Allow ImmediateBind annotation when using populators

In case of using PVC with populators if the PVC has this
annotation we prevent from waiting for it to be schedueled
and we proceed with the process.
When using datavolumes with populators in case the dv has the annotation
it will be passed to the PVC. we prevent from being in pendingPopulation
in case the created pvc has the annotaion.
Plus when having honorWaitForFirstConsumer feature gate disabled we will
put on the target PVC the immediateBind annotation.
Now we allow to use populators when having the annotation the the
feature gate disabled.

Signed-off-by: Shelly Kagan <skagan@redhat.com>

* Add functional tests to population using PVCs

Signed-off-by: Shelly Kagan <skagan@redhat.com>

* Support immediate binding with clone datavolume

Signed-off-by: Shelly Kagan <skagan@redhat.com>

* Pass allowed annotations from target pvc to pvc prime

This annotations are used for the import/upload/clone
pods to define netork configurations.

Signed-off-by: Shelly Kagan <skagan@redhat.com>

---------

Signed-off-by: Shelly Kagan <skagan@redhat.com>
2023-07-10 01:05:04 +02:00
Michael Henriksen
4ce9272c2c
DataVolume Controller uses VolumeCloneSource Populator (#2750)
* remove CSI clone

bye bye

Signed-off-by: Michael Henriksen <mhenriks@redhat.com>

* no more smart clone

Signed-off-by: Michael Henriksen <mhenriks@redhat.com>

* PVC clone same namespace

Signed-off-by: Michael Henriksen <mhenriks@redhat.com>

* cross namespace pvc clone

Signed-off-by: Michael Henriksen <mhenriks@redhat.com>

* various fixes to get some functional tests to work

Signed-off-by: Michael Henriksen <mhenriks@redhat.com>

* delete smart clone controller again

somehow reappeared after rebase

Signed-off-by: Michael Henriksen <mhenriks@redhat.com>

* mostly pvc clone functional test fixes

make sure size detect pod only runs on kubevirt content type

clone populator was skipping last round op applying pvc' annotations

various func test fixes

review comments

Signed-off-by: Michael Henriksen <mhenriks@redhat.com>

* more various test fixes

host clone phase should (implicitly) wait for clone source pod to exit

Signed-off-by: Michael Henriksen <mhenriks@redhat.com>

* remove "smart" clone from snapshot

Signed-off-by: Michael Henriksen <mhenriks@redhat.com>

* DataVolume clone from snapshot uses populator

Signed-off-by: Michael Henriksen <mhenriks@redhat.com>

* improve clone populator/datavolume coordination on "running" condition

For host clone, not much changes, values still comming from annotations on host clone PVC

For smart/csi clone the DataVolume will be "running" if not in pending or error phase

Will have the same values for terminal "completed" state regardless of clone type

Signed-off-by: Michael Henriksen <mhenriks@redhat.com>

* unit tests for pvc/snapshot clone controllers

Signed-off-by: Michael Henriksen <mhenriks@redhat.com>

* remove skipped test added in https://github.com/kubevirt/containerized-data-importer/pull/2759

Signed-off-by: Michael Henriksen <mhenriks@redhat.com>

* attempt address AfterSuite and generate-verify failures

Signed-off-by: Michael Henriksen <mhenriks@redhat.com>

* handle snapshot clone with no target size specified

also add more validation to some snapshot clone tests

Signed-off-by: Michael Henriksen <mhenriks@redhat.com>

* remove Patch calls

Using the controller runtime Patch API with controller runtime cached client seems to be a pretty bad fit

At least given the way the CR API is designed where an old object is compared to new.

I like patch in theory though and will revisit

Signed-off-by: Michael Henriksen <mhenriks@redhat.com>

* Clone populator should plan and execute even if PVC is bound

It was possible to miss "preallocation applied" annotation otherwise

Signed-off-by: Michael Henriksen <mhenriks@redhat.com>

* add long term token to datavolume

Signed-off-by: Michael Henriksen <mhenriks@redhat.com>

* Rename ProgressReporter to StatusReporter

Should have been done back when annotations were addded to "progress"

Also, if pvc is bound do not call phase Reconcile functions only Status

Signed-off-by: Michael Henriksen <mhenriks@redhat.com>

---------

Signed-off-by: Michael Henriksen <mhenriks@redhat.com>
2023-06-30 00:14:54 +02:00
Michael Henriksen
f88fab69dc
PVC Clone Populator (#2709)
* touch up zero restoresize snapshot

Signed-off-by: Michael Henriksen <mhenriks@redhat.com>

* clone populator

only supports PVC source now

snapshot coming soon

Signed-off-by: Michael Henriksen <mhenriks@redhat.com>

* more unit tests

Signed-off-by: Michael Henriksen <mhenriks@redhat.com>

* unit test for clone populator

Signed-off-by: Michael Henriksen <mhenriks@redhat.com>

* func tests for clone populator

Signed-off-by: Michael Henriksen <mhenriks@redhat.com>

* move clone populator cleanup function to planner

other review comments

verifier pod should bount readonly

Signed-off-by: Michael Henriksen <mhenriks@redhat.com>

* add readonly flag to test executor pods

synchronize get hash calls

Signed-off-by: Michael Henriksen <mhenriks@redhat.com>

* increase linter timeout

Signed-off-by: Michael Henriksen <mhenriks@redhat.com>

* better/explicit readonly support for test pods

Signed-off-by: Michael Henriksen <mhenriks@redhat.com>

* check pv for driver info before looking up storageclass as it may not exist

Signed-off-by: Michael Henriksen <mhenriks@redhat.com>

* addressed review comments

Signed-off-by: Michael Henriksen <mhenriks@redhat.com>

* chooseStrategy shoud generate more events

Signed-off-by: Michael Henriksen <mhenriks@redhat.com>

---------

Signed-off-by: Michael Henriksen <mhenriks@redhat.com>
2023-05-24 05:11:52 +02:00
garonsky
4e3ee4c44d
Add support for imagePullSecrets (#2589)
* Add support for imagePullSecrets in the CDI CR, to support pulling
images from repositories that require secrets.

The imagePullSecrets is propagated to the following components: cdi-apiserver,
cdi-deployment, and cdi-uploadproxy. The definition of imagePullSecrets in
cdi-operator must be done manually.

Signed-off-by: Gleb Aronsky <gleb.aronsky@windriver.com>

* Modifying code to incorporate review comments.

Signed-off-by: Gleb Aronsky <gleb.aronsky@windriver.com>

---------

Signed-off-by: Gleb Aronsky <gleb.aronsky@windriver.com>
Co-authored-by: Gleb Aronsky <gleb.aronsky@windriver.com>
2023-03-18 01:41:35 +00:00
akalenyu
f58f83feeb
Add sourceRef support for VolumeSnapshot sources (#2582)
Signed-off-by: Alex Kalenyuk <akalenyu@redhat.com>
2023-03-03 16:53:55 +00:00
Arnon Gilboa
12d57d6a94
Get rid of sync/updateStatus shared state (#2590)
There should be no state shared between sync() and updateStatus().
updateStatus() should stand on it's own, and come to it's own
conclusions based on what it observes. It is okay if it is "late to the
party" and does not observe the latest changes in sync(). It will
eventually converge. This is what kubevirt does.

Signed-off-by: Arnon Gilboa <agilboa@redhat.com>
2023-02-23 22:50:41 +01:00
Michael Henriksen
496efbcafb
Annotation to check for statically provisioned PVs when creating DataVolumes (#2583)
* function should return dataVolumeSyncResult, take *dataVolumeSyncResult as a parameter

Signed-off-by: Michael Henriksen <mhenriks@redhat.com>

* checkStaticVolume implemetation for import DataVolume

Signed-off-by: Michael Henriksen <mhenriks@redhat.com>

* upload support for checkStaticVolume

Signed-off-by: Michael Henriksen <mhenriks@redhat.com>

* checkStaticVolume for clone datavolumes

Signed-off-by: Michael Henriksen <mhenriks@redhat.com>

* checkStaticVolume for snapshot clone

Signed-off-by: Michael Henriksen <mhenriks@redhat.com>

* checkStaticVolume for external populator source

Signed-off-by: Michael Henriksen <mhenriks@redhat.com>

* tignten up static volume check

Signed-off-by: Michael Henriksen <mhenriks@redhat.com>

* expand functional test to compare creation timestamps

Signed-off-by: Michael Henriksen <mhenriks@redhat.com>

* updates from code review mostly add md5 verification to test and refacto common index creation

Signed-off-by: Michael Henriksen <mhenriks@redhat.com>

* webhook changes, allow clone source DataVolumes (with special annotations)
even if source does not exist or user has no permission

BUT no token is added so this is really just for the static/prepopulate cases

Signed-off-by: Michael Henriksen <mhenriks@redhat.com>

---------

Signed-off-by: Michael Henriksen <mhenriks@redhat.com>
2023-02-22 23:40:48 +01:00
akalenyu
e54cc283ca
Clone from VolumeSnapshot source (#2522)
* API for VolumeSnapshot clone source

Signed-off-by: Alex Kalenyuk <akalenyu@redhat.com>

* Refactor doCrossNamespaceClone to get rid of some source PVC assumptions

Signed-off-by: Alex Kalenyuk <akalenyu@redhat.com>

* Refactor isCrossNamespaceClone to get rid of some some source PVC assumptions

Signed-off-by: Alex Kalenyuk <akalenyu@redhat.com>

* Clone from VolumeSnapshot source controller

Signed-off-by: Alex Kalenyuk <akalenyu@redhat.com>

* Func tests for cloning from volumesnapshot source

Signed-off-by: Alex Kalenyuk <akalenyu@redhat.com>

* Extend cross ns clone token mechanism for VolumeSnapshot cloning

Signed-off-by: Alex Kalenyuk <akalenyu@redhat.com>

* Validate source volumesnapshot on create

Signed-off-by: Alex Kalenyuk <akalenyu@redhat.com>

---------

Signed-off-by: Alex Kalenyuk <akalenyu@redhat.com>
2023-02-03 04:44:13 +01:00
akalenyu
3a4af3eff0
Introduce base clone controller and adjust PVC clone controller accordingly (#2544)
We are introducing cloning from snapshot soon as a new controller,
as part of those efforts, it was identified to be beneficial to have this split.

Signed-off-by: Alex Kalenyuk <akalenyu@redhat.com>

Signed-off-by: Alex Kalenyuk <akalenyu@redhat.com>
2023-01-18 19:34:59 +01:00