* baseline refactoring of webhook package
* datavolume clone validation webhook
* rename datavolumes/clone-init to datavolumes/source
* add RBAC doc
* updates from review
* make clone permission check exportable function
* force dumb cloning in in functional test
Changes and flow:
* datavolume-controller:
- When clone pvc is requested and smart-clone is applicable -> Create a new VolumeSnapshot.
* Introduced smart-clone-controller:
- Listens to VolumeSnapshot changes and create a new PVC based on the snapshot.
- Upon PVC successful creation, deletes the snapshot for cleaning up.
Change-Id: I369fc92e72edb8a2cf584c8cb916795415f9d6e0
Signed-off-by: Daniel Erez <derez@redhat.com>
Co-authored-by: Fred Rolland <frolland@redhat.com>
In case that CDIConfig already exists, create call will return the
object with empty fields. Calling update will result with an error
updating empty resource.
Signed-off-by: Irit goihman <igoihman@redhat.com>
Combined code from PR#489 and PR#490 by
@gites and
@danielerez
Added some tests and rebased on current master.
Signed-off-by: Alexander Wels <awels@redhat.com>
This patch does two things:
1. We modify the restar policy from never to "OnFailure" for the
Importer (we already did this for Upload, and we don't want to do it yet
for the Clone pods)
2. Upon succesful completion delete our worker pods
We're not doing this on failed pods right now because in general an
admin will likely want to inspect the pod to see why it failed.
The first question someone will likely ask is "well what about a node
failure", well in the case of a node failure for CDI we have a bigger
outstanding issue remaining to figure out how to deal with volume
connections. We can't just simply reschedule the job.
This change just updates the common package to pass golint. Of course
that has some reaching implications into other packages with renaming of
constants.
I've intentionally kept this patch set to the bare minimum for the lint
test, I do think that we should put some effort into our use of
constants (especially those in common.go) in the future.
Ideally we'd declare constants where they're used, and we wouldn't
export them if they don't need to be. There are some in here that
are only used in one or two packages, and that can be cleaned up pretty
easily however it's likely that there might be plans to use them
elsewhere in the future.
[WIP] CDI: expectations and single queue - cloning refactoring
Adding 'expectPodCreate' call before creating target pod
minor change
Adding 'expectPodCreate' call before creating target pod
updating according feedback
Adding cloner unit test
code updates
Signed-off-by: tavni <tavni@redhat.com>
more updates
Signed-off-by: tavni <tavni@redhat.com>
minor change for util_test.go
Signed-off-by: tavni <tavni@redhat.com>
updating unit tests
Signed-off-by: tavni <tavni@redhat.com>
finished unit test for cloning refactoring
Signed-off-by: tavni <tavni@redhat.com>
rebase
Signed-off-by: tavni <tavni@redhat.com>
updating unit test after rebase
Signed-off-by: tavni <tavni@redhat.com>
gofmt errors
Signed-off-by: tavni <tavni@redhat.com>
- Updated controller to use ENTRYPOINT (no cmd) instead of /bin/sh
- Updated Dockerfile to set path to /usr/bin/cloner_startup.sh instead of /tmp
- Updated Dockerfile to use ENTRYPOINT.
Fixed issue #374
Signed-off-by: Alexander Wels <awels@redhat.com>
The target pod looks for a pod with a specific label (specified in the pod affinity) that matches the source pod label.
In my case the target pod included this label as well, so we can see that the target pod found matching pod, but it is the WRONG pod. It's itself!!
The target was running without finding the source pod first.
If we remove this label from the target pod, it will find the source pod and then will be scheduled on the same node.
If it does not find the source pod (because the scheduler tried to schedule it before the source pod), it will be in 'Pending' state until the source pod is scheduled, and then will be running on the same node.
https://github.com/kubevirt/containerized-data-importer/issues/279
* Pull in expectations code from kubevirt
Signed-off-by: David Vossel <davidvossel@gmail.com>
* add expectations to datavolume controller
Signed-off-by: David Vossel <davidvossel@gmail.com>
* Refactor importer pod to use single queue and expectations
Signed-off-by: David Vossel <davidvossel@gmail.com>
* update utils tests to use single queue
Signed-off-by: David Vossel <davidvossel@gmail.com>
* re-introduce import controller test suite
Signed-off-by: David Vossel <davidvossel@gmail.com>
* make clone controllers pass after utils refactor
Signed-off-by: David Vossel <davidvossel@gmail.com>
* Use log level constants in cdi controllers
Signed-off-by: David Vossel <davidvossel@gmail.com>
* Remove useless shadow variables in expectations pkg
Signed-off-by: David Vossel <davidvossel@gmail.com>
* required changes to get owner references working with openshift 1.10
Signed-off-by: David Vossel <davidvossel@gmail.com>
* update functional tests to work with importer controller refactor
Signed-off-by: David Vossel <davidvossel@gmail.com>
* Rename AnnImportPVC to LabelImportPvc in order to reflect its use
Signed-off-by: David Vossel <davidvossel@gmail.com>
* Add comment about expectations code
Signed-off-by: David Vossel <davidvossel@gmail.com>
* Add owner references to import pod
Signed-off-by: David Vossel <davidvossel@gmail.com>
* Unit test to verify import pod spec and the new owner references
Signed-off-by: David Vossel <davidvossel@gmail.com>
* Place cdi packages under the top level kubevirt.io project path
Signed-off-by: David Vossel <davidvossel@gmail.com>
* Change all references to cdi.io to cdi.kubevirt.io
Signed-off-by: David Vossel <davidvossel@gmail.com>
* Add go_import_path to travis config
Signed-off-by: David Vossel <davidvossel@gmail.com>
* update test package imports
Signed-off-by: David Vossel <davidvossel@gmail.com>
Start pod informer
also shutodwn podQueue
Added getting the PVC from pod's volume list using a global const for vol name
Generalized set-annotation func, added pod to pvc status writes
Use Filtered IndexInformer
Filter Pods by Label, examine all cluster PVCs
Resource dequeuing funcs return true unless key is malformed or processing succeeds
Pod correctly annotates PVC w/ status
Fix error message
Aligned log line with PVC func
Make CDI selector label a global constant
Parameterize selectorlabel
Handled nil selector case
Handel NewController error in testing, use constant importer tag
Changed informer factory back to un-filtered, fixed nil ptr error
removed labels, to be handled in a separate pr
To accomodate testing, NewController takes a pre-created Informer, not a factory
Add global constant for default resync
fix makefile bug
fix bug in deployent manifest