Commit Graph

167 Commits

Author SHA1 Message Date
Marcelo Feitoza Parisi
c7467cc5fd
Google Cloud Storage Import Support (#2615)
* Google Cloud Storage Importer

This is a Google Cloud Storage importer for CDI

Signed-off-by: Marcelo Parisi <marcelo@feitoza.com.br>

* Fix auto-generated swagger and openapi

Signed-off-by: Marcelo Parisi <marcelo@feitoza.com.br>

* GCS Importer General Fixes

Signed-off-by: Marcelo Parisi <marcelo@feitoza.com.br>

* Moving back gcs-secret.txt

Moving file back to imageDir to fix unit testing.

Signed-off-by: Marcelo Parisi <marcelo@feitoza.com.br>

---------

Signed-off-by: Marcelo Parisi <marcelo@feitoza.com.br>
Co-authored-by: Marcelo Parisi <marcelo@dev-box.corp.feitoza.com.br>
2023-03-22 16:49:29 +00:00
Maya Rashish
a623d6d071
Simplify upgrade testing, and only test v1beta1 DVs (#2618)
Newer releases of CDI no longer contain v1alpha1 support, so we
can't blindly apply v1alpha1 DVs. Any old version DV is good enough,
nothing specific to v1alpha1, so let's remove that variant.

While here, make the DVs for upgrade testing always contain the
annotation to not be garbage collected.
This helps simplify the cluster-sync logic.

Signed-off-by: Maya Rashish <mrashish@redhat.com>
2023-03-06 14:28:07 +00:00
alromeros
2e9a9257f9
Add support for volume populators (#2482)
* Add support for volume populators in CDI

This commit enables the use of volume populators in CDI, so datavolume-owned PVCs can be populated using custom logic.

Volume populators are CRDs used to populate volumes externally, independently of CDI. These CRDs can now be specified using the new DataSourceRef API field in the DataVolume spec.

When a DataVolume is created with a populated DataSourceRef field, the datavolume-controller creates the corresponding PVC accordingly but skips all the population-related steps. Once the PVC is bound, the DV phase changes to succeeded.

Signed-off-by: Alvaro Romero <alromero@redhat.com>

* Modify CDI test infrastructure to support testing of external populators

This commit introduces several changes to CDI ci to support the testing of DataVolumes with external populators:
* A sample volume populator is now deployed in the test infrastructure, in a similar way as bad-webserver or test-proxy. This populator will be used in functional tests from now on.
* A new test file with external population tests has been introduced in the tests directory

Signed-off-by: Alvaro Romero <alromero@redhat.com>

* Update dependencies to include lib-volume-populator library

Signed-off-by: Alvaro Romero <alromero@redhat.com>

* Add functional tests for proper coverage of external population of DataVolumes

Signed-off-by: Alvaro Romero <alromero@redhat.com>

* Minor fixes on external-population logic for DataVolumes:
* Added comments for exported structs
* Removed non-inclusive language
* Improved error messages in webhooks
* Fixed logic on datavolume-controller

Signed-off-by: Alvaro Romero <alromero@redhat.com>

* Improve DataVolume external-population logic when using the old 'DataSource' API

This commit introduces several changes into the datavolume external-population controller to improve its behavior when using the DataSource field.

It also introduces minor fixes on the generic populator logic.

Signed-off-by: Alvaro Romero <alromero@redhat.com>

* Add unit tests for external-population controller and DV admission

Signed-off-by: Alvaro Romero <alromero@redhat.com>

Signed-off-by: Alvaro Romero <alromero@redhat.com>
2023-01-17 21:56:15 +01:00
Alexander Wels
7b7b435bf4
Udpate cdi-testing-sa SCC to work in newer Open Shift (#2504)
The SCC was not applying properly due to some missing required
fields. This PR adds those fields.

Signed-off-by: Alexander Wels <awels@redhat.com>

Signed-off-by: Alexander Wels <awels@redhat.com>
2022-12-13 12:05:34 +00:00
Alexander Wels
5d9cc8d9ff
Enable HonorWaitForFirstConsumer by default (#2445)
Modified template that generates CDI cr to honor
wait for first consumer for the release manifest

Signed-off-by: Alexander Wels <awels@redhat.com>

Signed-off-by: Alexander Wels <awels@redhat.com>
2022-10-19 03:57:31 +01:00
Alexander Wels
a7b31b759d
Change how we deploy the upgrade testing DVs (#2434)
* Dump some information if the upgrade testing objects are
not ready in time.

Signed-off-by: Alexander Wels <awels@redhat.com>

* Added new logic for upgrading

Signed-off-by: Alexander Wels <awels@redhat.com>

Signed-off-by: Alexander Wels <awels@redhat.com>
2022-09-28 03:34:08 +01:00
Maya Rashish
02e70a5a54
Use centos:stream9 as a base image, cleanup unused code (#1983)
* Retire ember LVM code, unused

(Rationale: avoid having to change more things for changing the
base image)

Signed-off-by: Maya Rashish <mrashish@redhat.com>

* Remove unreferenced files from WORKSPACE

Signed-off-by: Maya Rashish <mrashish@redhat.com>

* Switch to centos:stream9 as a base image.

It has a significantly longer support cycle than Fedora releases,
and supposedly offers vulnerability scans.

Add a tinyCore.vdi to the repo instead of generating it.
The centos qemu-img has read-only VDI support, so we can't generate
it. Generate it using my system and add to the file-host.

Signed-off-by: Maya Rashish <mrashish@redhat.com>

* Use full names for pulls from dockerhub

CentOS doesn't like short tags

Signed-off-by: Maya Rashish <mrashish@redhat.com>

* Avoid specifying checksum for CentOS images.

They expire faster than we can update checksums, this is unfortunate
but perhaps they will soon publish images at a lower rate allowing
us to keep up.

Signed-off-by: Maya Rashish <mrashish@redhat.com>

* Bump number of open file limit to avoid bazel crashes

Signed-off-by: Maya Rashish <mrashish@redhat.com>

* Update builder to include #2087, builder based on centos stream9

Signed-off-by: Maya Rashish <mrashish@redhat.com>

* Update checksums that seem wrong

Signed-off-by: Maya Rashish <mrashish@redhat.com>

* Update ovirt links: old ones were removed

Signed-off-by: Maya Rashish <mrashish@redhat.com>

* Remove unused RPMs

Noticed due to: duplicated checksum but no problem in testsuite,
lack of aarch64 equivalent.

Signed-off-by: Maya Rashish <mrashish@redhat.com>

* Put nbdkit-vddk-plugin back for amd64.

Signed-off-by: Maya Rashish <mrashish@redhat.com>

* Use quay.io instead of dockerhub.

Signed-off-by: Maya Rashish <mrashish@redhat.com>

* Install util-linux-core for /usr/sbin/blockdev

Needed after #2174

Signed-off-by: Maya Rashish <mrashish@redhat.com>

* Update nbdkit/libnbd/nginx/ovirt versions to the latest

The previous version we were using can't be fetched any more

Signed-off-by: Maya Rashish <mrashish@redhat.com>

* Generate our own CentOS stream9 image using RPMs

Now updating the dependencies can be done by running `make rpm-deps`
and committing the change, like kubevirt.

This creates a small complication that we need to run update-ca-trust
to trust root CAs. Do this on the pod, using the entrypoint to do so.

Use a single image with all the dependencies for the test tools, we
don't benefit from making them minimal and it saved some trouble in
the conversion.

Signed-off-by: Maya Rashish <mrashish@redhat.com>

* Fixup imageio test container

Run update-ca-trust and update-crypto-policies before running
ovirt-imageio, to stop error messages.

Signed-off-by: Maya Rashish <mrashish@redhat.com>
2022-04-20 19:37:51 +02:00
akalenyu
0cc145f403
Retry adding ticket on imageio container startup (#2223)
Sometimes we see that ticket is not there (thx awels), we might want to
try a few times before giving up.

Signed-off-by: Alex Kalenyuk <akalenyu@redhat.com>
2022-04-08 17:13:48 +02:00
akalenyu
2cb09af168
Include namespace on upgrade test manifest/attempt to fix quota test (#2197)
* Include namespace of upgrade testing manifests in yaml

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

* Don't back out until we verify quota status is set following us POSTing it

Signed-off-by: Alex Kalenyuk <akalenyu@redhat.com>
2022-03-29 00:06:05 +02:00
Alexander Wels
4d620acc09
Create imageio container during CDI build. (#2156)
* Create imageio container during CDI build.

Instead of using a really old imageio, use bazel to build a new
imageio based on 2.5.0. Update the tests to use the new image
and paths in that new image. This requires a new repo in quay for
us to push the image to.

Also changed the approach of resolving the warm import potential
dead lock (scratch PVC from previous import pod terminating, while
the new pod is trying to create itself). Instead of trying to avoid
in all scenarios, detect the state, and delete the pod so the dead
lock can be resolved.

Signed-off-by: Alexander Wels <awels@redhat.com>

* Populate test images

Signed-off-by: Alexander Wels <awels@redhat.com>

* Enable disabled test, and fix race condition where the import
controller thought it was done, but we were still on the final
import of a warm migration.

Updated the way we create the ticket on the fake imageio

Signed-off-by: Alexander Wels <awels@redhat.com>
2022-02-18 00:36:56 +01:00
Alexander Wels
013cb6b62b
Set http(s)_proxy to lower case env variable (#2132)
* Set htpp(s)_proxy to lower case env variable

CURL used by nbdkit doesn't read upper case http(s)_proxy environment
variables, and thus was not using the proxy. Changed the variable to
be lower case.

Added a significant number of tests to test many more variations of
using a proxy. Also added https + auth endpoint to the file-host
container, so we can test https + auth with the proxy.

Added https endpoint to proxy, so we can test an https proxy.

Cleaned up some of the error handling in the import controller for
the proxy, in particular if a trustedCAProxy is defined.

Fixed some of the cluster wide proxy configuration so it works properly
inside an openshift cluster.

Signed-off-by: Alexander Wels <awels@redhat.com>

* Add https proxy support to registry import. Added extra
functional tests to test all registry import combinations

Signed-off-by: Alexander Wels <awels@redhat.com>

* Fixed some tests to work better in Open Shift.

Signed-off-by: Alexander Wels <awels@redhat.com>
2022-02-03 18:09:41 +01:00
Maya Rashish
f2939fcee8
add PVC claimName to datavolume status (#2060)
* Make it possible to find the underlying PVC name using the DV

Right now a lot of things assume that the underlying PVC has the
same name/namespace, let's make it possible to reach over and not
need to have this implicit knowledge in a lot of places.

Signed-off-by: Maya Rashish <mrashish@redhat.com>

* Install some artifacts on the old version of CDI during upgrade tests

And use this to test that DataVolume.Status.ClaimName is set after
upgrades.

Signed-off-by: Maya Rashish <mrashish@redhat.com>

* Bump CDI pod update timeout

Signed-off-by: Maya Rashish <mrashish@redhat.com>

* Only check if non-testing CDI pods have updated.

We don't update the testing environment, so it looks like some of the
update fails.

Signed-off-by: Maya Rashish <mrashish@redhat.com>

* Restore lower timeouts

Signed-off-by: Maya Rashish <mrashish@redhat.com>

* As elsewhere, don't use local registry artifacts with external provider

Signed-off-by: Maya Rashish <mrashish@redhat.com>
2022-01-07 20:28:25 +01:00
akalenyu
0c60ff58cb
Change deployment strategy on test manifests (#1985)
We see a rare flake where our registry test deployment is using a different cert
to what we saved in a CM in our cluster.
As an attempt to mitigate, lets ensure that during rollout old pods are first gone, and only then new ones are introduced.

Signed-off-by: Alex Kalenyuk <akalenyu@redhat.com>
2021-10-12 14:54:59 +02:00
akalenyu
22afd303be
Run imageio test deployment as root (#1931)
We see an error starting the deployment's server d/s:
```bash
[cnv-qe-jenkins@alex48-451-xzjsk-executor ocs-test]$ oc logs -f -n openshift-cnv imageio-deployment-f9bfff68-clbs2 imageiotest
Using configuration from /etc/pki/tls/openssl.cnf
...
  File "/ovirt-imageio/daemon/ovirt_imageio/uhttp.py", line 80, in server_bind
    self.socket.bind(self.server_address)
PermissionError: [Errno 13] Permission denied
curl: (7) Couldn't connect to server
```
Running as root seems to solve it, and doesn't harm test integrity since it's a test-helper.

Signed-off-by: Alex Kalenyuk <akalenyu@redhat.com>
2021-09-18 12:52:08 +02:00
Matthew Arnold
cab586ab1a
Implement multi-stage ImageIO imports. (#1903)
* Add qemu-img rebase and commit operations.

Also only fail images with backing files that do not exist, so that
ImageIO snapshots can be downloaded and applied to a base disk image.

Signed-off-by: Matthew Arnold <marnold@redhat.com>

* Add merge phase to data processor.

This keeps qemu-img details out of the ImageIO data source.

Signed-off-by: Matthew Arnold <marnold@redhat.com>

* Beef up transfer ticket finalization/cancellation.

Snapshots seem to be more prone to getting locked indefinitely than
disks if not correctly finalized or cancelled, so do this more carefully
than before.

Signed-off-by: Matthew Arnold <marnold@redhat.com>

* Allow downloading snapshots from ImageIO.

Download the first snapshot as a raw whole-disk image, and download
subsequent snapshots as QCOW images to be committed to that base.

Signed-off-by: Matthew Arnold <marnold@redhat.com>

* Allow multi-stage fields on ImageIO data sources.

Also avoid removing base disk image when cleaning data directory.

Signed-off-by: Matthew Arnold <marnold@redhat.com>

* Add ImageIO multi-stage functional tests.

Pick up fakeovirt update for stub functionality, so inventory responses
can be changed on the fly for individual tests.

Signed-off-by: Matthew Arnold <marnold@redhat.com>

* Update multi-stage documentation for ImageIO.

Signed-off-by: Matthew Arnold <marnold@redhat.com>

* Move if-else test block to functions.

Signed-off-by: Matthew Arnold <marnold@redhat.com>

* Reset ImageIO inventory for a test I missed.

Signed-off-by: Matthew Arnold <marnold@redhat.com>

* Clean up from some review comments.

Signed-off-by: Matthew Arnold <marnold@redhat.com>

* Sort out calls to cleanupTransfer.

Failures during the creation of a transfer ticket call the original
cleanupTransfer in a single location, and any exits after the data
source is created call a wrapper function. The wrapper has a lock and a
'done' flag to make sure it is only called once on exit, even when
interrupted from the goroutine that waits for SIGTERM.

Signed-off-by: Matthew Arnold <marnold@redhat.com>
2021-08-30 19:22:07 +02:00
akalenyu
2b423469fe
Use dedicated ServiceAccount for test manifests (#1905)
Instead of using our production SA with test manifests, let's have a dedicated & minimal one.
Also provide SCC in case test suite is ran on OpenShift (needed to provide capability to `cdi-docker-registry-host`).

Signed-off-by: Alex Kalenyuk <akalenyu@redhat.com>
2021-08-25 13:06:36 +02:00
akalenyu
ef7634754a
Use NodePort instead of kubectl port-forward for upload tests (#1897)
Follow up for #1886, we now have a kubevirtci version that gives us a free port.
We can use that to make the switch from `kubectl port-forward` which has been known to cause many flakes in our CI.

Signed-off-by: Alex Kalenyuk <akalenyu@redhat.com>
2021-08-23 11:18:50 +02:00
akalenyu
acb382b97c
Bump kubevirtci for uploadproxy port (#1886)
* Bump kubevirtci for uploadproxy port

Bumping kubevirtci to get https://github.com/kubevirt/kubevirtci/pull/653

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

* Fix local registry test container

We were never supposed to be able to run buildah bud without the SETFCAP capability:
https://www.redhat.com/sysadmin/podman-inside-kubernetes
Building an image using buildah requires a properly installed shadow-utils package. This requires SETFCAP.

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

* Increase timeout on propagation from cdi.spec->cdiconfig

Seeing some failures on the istio lane to ensure propagation in 10 second

Signed-off-by: Alex Kalenyuk <akalenyu@redhat.com>
2021-08-17 12:40:36 +02:00
Alexander Wels
623f3eb95c
Replace dockerhub references with quay.io (#1704)
Signed-off-by: Alexander Wels <awels@redhat.com>
2021-03-19 13:05:08 +01:00
Alexander Wels
af66100384
Use quay.io for imageio test image (#1697)
Signed-off-by: Alexander Wels <awels@redhat.com>
2021-03-15 21:07:34 +01:00
Marcelo Carneiro do Amaral
8d1721db0a
Add support for proxy in the CDI import pod, reconciling the info from OpenShift cluster wide proxy when available (#1507)
* api: Add new ImportProxy structure to CDIConfig in v1beta1 core api

Signed-off-by: Marcelo Amaral <marcelo.amaral1@ibm.com>

* common: Add constants related to configure Import proxy in Import pod and controller reconcile

Signed-off-by: Marcelo Amaral <marcelo.amaral1@ibm.com>

* config controller: Add import proxy reconcile, monitoring OCP proxy updates

Signed-off-by: Marcelo Amaral <marcelo.amaral1@ibm.com>

* config controller: Add unit test for import proxy reconcile, monitoring OCP proxy updates and creating Secret and ConfigMap

Signed-off-by: Marcelo Amaral <marcelo.amaral1@ibm.com>

* import controller: Add unit support of ImportProxy in the tests

Signed-off-by: Marcelo Amaral <marcelo.amaral1@ibm.com>

* controller util: Add support to retrieve an OpenShift cluster wide proxy object as well as its needed configurations

Signed-off-by: Marcelo Amaral <marcelo.amaral1@ibm.com>

* controller util:  Add unit test for the get cluster wide proxy functionality

Signed-off-by: Marcelo Amaral <marcelo.amaral1@ibm.com>

* controller: moved isOpenshift function to utils common and export it

Signed-off-by: Marcelo Amaral <marcelo.amaral1@ibm.com>

* importer: Clone http transport to keep the default proxy config such as the usage of environment variables and add support for proxy CA

Signed-off-by: Marcelo Amaral <marcelo.amaral1@ibm.com>

* operator: Update CDIConfigCRD with import proxy info

Signed-off-by: Marcelo Amaral <marcelo.amaral1@ibm.com>

* operator: Update CDIListCRD with import proxy info

Signed-off-by: Marcelo Amaral <marcelo.amaral1@ibm.com>

* operator: Add service account rights to CDI for accessing OpenShift proxy obj

Signed-off-by: Marcelo Amaral <marcelo.amaral1@ibm.com>

* operator: Add OpenShift proxy obj scheme support

Signed-off-by: Marcelo Amaral <marcelo.amaral1@ibm.com>

* test: Add new forwarding proxy for testing things that require a proxy

Signed-off-by: Marcelo Amaral <marcelo.amaral1@ibm.com>

* test: Add test to verify the importer pod with proxy

Signed-off-by: Marcelo Amaral <marcelo.amaral1@ibm.com>

* doc: Update cdi config doc with the ImportProxy info

Signed-off-by: Marcelo Amaral <marcelo.amaral1@ibm.com>

* add support to build the new proxy docker image

Signed-off-by: Marcelo Amaral <marcelo.amaral1@ibm.com>

* test: remove unwanted F parameter from test

Signed-off-by: Marcelo Amaral <marcelo.amaral1@ibm.com>

* controller: fix error handling

Signed-off-by: Marcelo Amaral <marcelo.amaral1@ibm.com>

* test: update the used method to get the pod of the importer pod and proxy

Signed-off-by: Marcelo Amaral <marcelo.amaral1@ibm.com>

* fixed comments from the revision

Signed-off-by: Marcelo Amaral <marcelo.amaral1@ibm.com>

* controller config: update the methods to use the log object from the reconcile object

Signed-off-by: Marcelo Amaral <marcelo.amaral1@ibm.com>

* controller: update function GetImportProxyConfig to return errors and include a new unit test

Signed-off-by: Marcelo Amaral <marcelo.amaral1@ibm.com>

* controller: add back a test that was removed by mistake

Signed-off-by: Marcelo Amaral <marcelo.amaral1@ibm.com>

* update updateCDIConfigByUpdatingTheClusterWideProxy function

Signed-off-by: Marcelo Amaral <marcelo.amaral1@ibm.com>

* test: decrease the import pod log pooling interval and increase the image size to be able to verify the import pod before it is deleted

Signed-off-by: Marcelo Amaral <marcelo.amaral1@ibm.com>

* test: update the pvc and proxied requests verification

Signed-off-by: Marcelo Amaral <marcelo.amaral1@ibm.com>

* tools: add X-Forwarded-For header in the proxy requests  used for testing

Signed-off-by: Marcelo Amaral <marcelo.amaral1@ibm.com>

* test: reset cluster wide proxy with the original values

Signed-off-by: Marcelo Amaral <marcelo.amaral1@ibm.com>

* test: fix proxy update to change spec instead of status and other minor updates

Signed-off-by: Marcelo Amaral <marcelo.amaral1@ibm.com>

* doc: update import proxy description

Signed-off-by: Marcelo Amaral <marcelo.amaral1@ibm.com>

* update generated files

Signed-off-by: Marcelo Amaral <marcelo.amaral1@ibm.com>
2021-02-16 13:43:01 +01:00
Maya Rashish
958c1d39b0
Make CDI infra deployments as critical addons. (#1361)
* Make CDI infra deployments as critical addons.

While here, mark cdi-operator as linux-only, it doesn't take
its value from the CDI CR.

Signed-off-by: Maya Rashish <mrashish@redhat.com>

* Add test CDI pods are deployed with critical addon tolerations

Co-authored-by: Daniel Belenky <dbelenky@redhat.com>
Signed-off-by: Daniel Belenky <dbelenky@redhat.com>
Signed-off-by: Maya Rashish <mrashish@redhat.com>

* Turn nfs-server into a deployment

So that it is restarted after the destructive test destroying
CDI testing pods.

Signed-off-by: Maya Rashish <mrashish@redhat.com>

* Rewrite CDI critical taint test

Now it is simpler and waits for pods to be running before
continuing for the next tests.

Signed-off-by: Maya Rashish <mrashish@redhat.com>

* Skip tolerations test if the CDI CR has unexpected values

This is necessary for Prow, which installs the CDI CR from the
previous version and updates to the latest code, but might be
useful in other cases too.

Signed-off-by: Maya Rashish <mrashish@redhat.com>

* Modify functional test to use AfterEach instead of defer

While here, make it more generic so there's a chance this Describe
block will be used by other tests - iterate over all pods instead
of just the CDI test pods.

Signed-off-by: Maya Rashish <mrashish@redhat.com>

* Skip test if CDI CR isn't named "cdi" (rather than fail)

Signed-off-by: Maya Rashish <mrashish@redhat.com>

* fix typo

Signed-off-by: Maya Rashish <mrashish@redhat.com>

Co-authored-by: Daniel Belenky <dbelenky@redhat.com>
2020-10-15 09:05:39 +02:00
Alexander Wels
80699dcbc1
Removed hard coded registry:5000 for vddk datasource test. (#1402)
This allows people to run the test outside of the kubevirtci
environment and have it complete successfully.
Added configmap to vcenter.yaml.in that creates the CM that
lets users specify which init container to use. The default
is the test init container

Signed-off-by: Alexander Wels <awels@redhat.com>
2020-09-28 18:03:30 +02:00
Alexander Wels
d2da27b41b
Ensure we can specify different CDI CR name. (#1383)
Fix bug where the CR name was hard coded to CDI and it failed in HCO.

Signed-off-by: Alexander Wels <awels@redhat.com>
2020-09-22 00:13:28 +02:00
Matthew Arnold
dc6bad6473
Fill out VDDK data volume source. (#1320)
* Add support for a VDDK datasource to the controllers

This commit does not implement the VDDK datasource. It simply
adds the DataVolumeSourceVDDK type and adds support to the
datavolume and import controllers for it. The datasource itself
will need to be done in a follow-up.

Signed-off-by: Sam Lucidi <slucidi@redhat.com>

* Fix tests and clean up lint

Signed-off-by: Sam Lucidi <slucidi@redhat.com>

* Add DataVolumeSourceVDDK to the v1alpha1 api group

Signed-off-by: Sam Lucidi <slucidi@redhat.com>

* Install nbdkit.

Signed-off-by: Matthew Arnold <marnold@redhat.com>

* Add govmomi to vendor directory.

Signed-off-by: Matthew Arnold <marnold@redhat.com>

* Integrate govmomi into build.

Incomplete! This allows 'find' and 'object' imports from govmomi, but
further dependencies may require more bazel tweaks later.

Signed-off-by: Matthew Arnold <marnold@redhat.com>

* Create a container image just to hold the VDDK.

Mount the VDDK folder to /opt. Also copy the libxcrypt-compat RPM to
/opt for run-time installation as a temporary workaround for my
inability to install it at container creation time. Make VDDK optional
by storing a dummy file in its directory, so an empty VDDK directory
will not break the build.

Signed-off-by: Matthew Arnold <marnold@redhat.com>

* Fill in VDDK data source.

Add the simplest possible VDDK data source: set up an nbdkit server with
the given VMware parameters, and copy data out using qemu-img.

Signed-off-by: Matthew Arnold <marnold@redhat.com>

* Add vddk to resource validation schema.

Stops "error validating data" messages.

Signed-off-by: Matthew Arnold <marnold@redhat.com>

* Move libxcrypt-compat install out of VDDK image.

Requiring users to add this to the VDDK image is kind of onerous, so
move it straight into the importer image instead.

Signed-off-by: Matthew Arnold <marnold@redhat.com>

* Generate BUILD.bazel for the rest of govmomi.

Signed-off-by: Matthew Arnold <marnold@redhat.com>

* Get VDDK sidecar image from v2v-vmware ConfigMap.

Convention from https://github.com/kubevirt/web-ui-components/pull/534

Signed-off-by: Matthew Arnold <marnold@redhat.com>

* Reduce nbdkit startup timeout.

Signed-off-by: Matthew Arnold <marnold@redhat.com>

* Update govmomi dependencies.

Cleans up 'inconsistent vendoring' errors.

Signed-off-by: Matthew Arnold <marnold@redhat.com>

* Fix schema verification test.

Signed-off-by: Matthew Arnold <marnold@redhat.com>

* Change disk.raw to disk.img.

Signed-off-by: Matthew Arnold <marnold@redhat.com>

* Add vCenter simulator for VDDK datasource tests.

Signed-off-by: Matthew Arnold <marnold@redhat.com>

* Functional test with vcsim and dummy VDDK plugin.

Signed-off-by: Matthew Arnold <marnold@redhat.com>

* Clean up lint errors.

Signed-off-by: Matthew Arnold <marnold@redhat.com>

* Check kubevirt-hyperconverged namespace for VDDK.

Signed-off-by: Matthew Arnold <marnold@redhat.com>

* Add VDDK unit tests and API functional test.

Signed-off-by: Matthew Arnold <marnold@redhat.com>

* Read a raw image for VDDK test plugin.

Have the fake VDDK test plugin for nbdkit read a raw image passed in
/opt/updates/nbdtest.img instead of returning fixed data.

Signed-off-by: Matthew Arnold <marnold@redhat.com>

* Add some documentation about VDDK data sources.

Signed-off-by: Matthew Arnold <marnold@redhat.com>

* Remove unit test focus and trailing spaces.

Signed-off-by: Matthew Arnold <marnold@redhat.com>

* Use updated build container image.

Signed-off-by: Matthew Arnold <marnold@redhat.com>

* Add some extra comments about VDDK fields.

Signed-off-by: Matthew Arnold <marnold@redhat.com>

* Clarify VDDK ConfigMap a little more.

Signed-off-by: Matthew Arnold <marnold@redhat.com>

* Clarify namespace for vddk-init sidecar.

Signed-off-by: Matthew Arnold <marnold@redhat.com>

* Remove NodePort from vCenter simulator manifest.

Signed-off-by: Matthew Arnold <marnold@redhat.com>

* Re-word explanations on VDDK source types.

Signed-off-by: Matthew Arnold <marnold@redhat.com>

* Add VDDK to comment with types needing URL check.

Signed-off-by: Matthew Arnold <marnold@redhat.com>

* Rebuild types.

Signed-off-by: Matthew Arnold <marnold@redhat.com>

* Move AnnThumbprint to storage.import.vddk.thumbprint.

Signed-off-by: Matthew Arnold <marnold@redhat.com>

* Remove run-time installation of libxcrypt-compat.

Signed-off-by: Matthew Arnold <marnold@redhat.com>

* Remove fixed namespaces for vddk-init reference.

The importer now looks for the v2v-vmware ConfigMap in the current CDI
namespace instead of openshift-cnv/kubevirt-hyperconverged.

Signed-off-by: Matthew Arnold <marnold@redhat.com>

* Find CDI install namespace from data volume test.

Signed-off-by: Matthew Arnold <marnold@redhat.com>

Co-authored-by: Sam Lucidi <slucidi@redhat.com>
2020-09-11 23:37:22 +02:00
Maya Rashish
e3436e0199
Allow specifying nodeSelector, affinity and tolerations for CDI pods (#1346)
* Generate CDI CRD using controller-tools.

This is only done for CDI CRD as it requires the existence of source
code. Other CRDs we create are created by a more bare bones pod.

CDIUninstallStrategy was missing a comment describing it, so add
one. This was spotted manually so there might be more missing.

Signed-off-by: Maya Rashish <mrashish@redhat.com>

* Allow users to specify which nodes CDI pods will live on.

nodeSelector, affinity and tolerations are possible values.

This is done in the CDI CR (rather than CDIConfig) as we are
interested in having this field be populated by external operators.

Unit tests now require the existence of a CDI CR, so create it.

Signed-off-by: Maya Rashish <mrashish@redhat.com>

* Add a unit test covering some node placement functions

Signed-off-by: Maya Rashish <mrashish@redhat.com>

* Specify that all our pods are linux-only.

Signed-off-by: Maya Rashish <mrashish@redhat.com>

* Avoid duplicate test, accidental left over.

Pointed out by awels, thanks.

Signed-off-by: Maya Rashish <mrashish@redhat.com>

* Rename to cdiOperatorDeployment for clarity.

Suggested by awels

Signed-off-by: Maya Rashish <mrashish@redhat.com>

* Specify we only run on linux using the CDI CR, no need to embed this
into the code.

Signed-off-by: Maya Rashish <mrashish@redhat.com>

* Don't dereference workloadPlacement for no reason

Signed-off-by: Maya Rashish <mrashish@redhat.com>

* Split off operator test to have its own AfterEach, BeforeEach.

Use even more descriptive function names.

Do all the CDI delete/restore logic in AfterEach, to ensure that
it happens and restores the deployment with the original CR even
if the test fails.

Signed-off-by: Maya Rashish <mrashish@redhat.com>

* Remove XXX. This is the proper way.

Signed-off-by: Maya Rashish <mrashish@redhat.com>

* Adapt to latest changes in controller_test.go (renaming import)

Signed-off-by: Maya Rashish <mrashish@redhat.com>

* Simplify, not storing intermediate value.

Signed-off-by: Maya Rashish <mrashish@redhat.com>

* Don't dereference nodeplacement in callers to CreateDeployment

Signed-off-by: Maya Rashish <mrashish@redhat.com>

* Remove redundant save & restore. Unit tests do this for us.

Pointed out by awels, thanks.

Signed-off-by: Maya Rashish <mrashish@redhat.com>

* Split out "find toplevel" to a utility function

Signed-off-by: Maya Rashish <mrashish@redhat.com>

* Wait for the CDI CR update to apply before continuing.

Signed-off-by: Maya Rashish <mrashish@redhat.com>

* Simplify, not storing intermediate value.

Signed-off-by: Maya Rashish <mrashish@redhat.com>

* Make it clear that the chosen node placement will not be schedulable.

Signed-off-by: Maya Rashish <mrashish@redhat.com>
2020-09-03 22:13:18 +02:00
Tomasz Barański
536af6b1ad
Replace skopeo (#1322)
* Updated dependencies
Signed-off-by: Tomasz Baranski <tbaransk@redhat.com>

* Replace skopeo with containers API.

This commit removes dependence on skopeo (binary) and uses containers
API. By doing that we're able to opimize the use of storage (scratch)
space, storage I/O and download bandwith.

Signed-off-by: Tomasz Baranski <tbaransk@redhat.com>

* Fixing rebase - dependencies kerfuffle.

Signed-off-by: Tomasz Baranski <tbaransk@redhat.com>

* Handling docker-format images as well as OCI.

Signed-off-by: Tomasz Baranski <tbaransk@redhat.com>

* Fix for missing code-generator module.

Signed-off-by: Tomasz Baranski <tbaransk@redhat.com>

* Remove regex, image file in registry images are matched by a path
prefix.

Signed-off-by: Tomasz Baranski <tbaransk@redhat.com>

* Added nginx proxy in front of docker registry for a rate-limited access.

Signed-off-by: Tomasz Baranski <tbaransk@redhat.com>
2020-08-22 05:52:00 +02:00
Michael Henriksen
9e2c79b1e0
move api groups to v1beta1 (#1232)
* move upload.cdi.kubevirt.io API group to v1beta1

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

* move core api to v1beta1

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

* fix os-3.11 cluster sync and add functional tests for alpha api

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

* change more occurences of v1alpha1

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

* updates after rebase

Signed-off-by: Michael Henriksen <mhenriks@redhat.com>
2020-07-10 15:47:38 +02:00
Tomasz Barański
57717261c2
[test] Import from registry using credentials - tier 1 test (#1281)
Signed-off-by: Tomasz Baranski <tbaransk@redhat.com>
2020-07-08 02:11:37 +02:00
maya-r
93565b2c88
Implement local webserver to mimic flawed servers (for functional tests) (#1193)
* Implement local web server to mimic flawed servers

http://cdi-bad-webserver.cdi/flaky/filename will return a 503
"unavailable" error to most requests.

http://cdi-bad-webserver.cdi/forbidden-HEAD/filename will return
a 403 "Forbidden" error on HEAD requests.

In both those cases, we validate that we still eventually succeed
in creating a datavolume.

Signed-off-by: Maya Rashish <mrashish@redhat.com>

* Add the imageio server to the manual test setup instructions.

Signed-off-by: Maya Rashish <mrashish@redhat.com>

* Add missing bad-webserver.yaml.in (forgot to git add)

Signed-off-by: Maya Rashish <mrashish@redhat.com>

* Make "flaky" bad-webserver reproducibly flaky.

9 failures followed by a success.
Switch to port 9090, os-3.11 disallows using privileged ports,
and we don't have a reason to prefer port 80.

Signed-off-by: Maya Rashish <mrashish@redhat.com>

* Provide polarion test IDs

Signed-off-by: Maya Rashish <mrashish@redhat.com>

* Make flaky test server fail less frequently.

The exponential backoff makes 10 retries very slow.

Signed-off-by: Maya Rashish <mrashish@redhat.com>

* Tolerate being installed on a namespace that isn't "cdi"

Assume that we are in the same namespace as cdi-file-host, and
use that namespace in the URL.

Signed-off-by: Maya Rashish <mrashish@redhat.com>

* Use AfterEach to cleanup datavolumes after test.

Suggested by Alexander Wels.

Signed-off-by: Maya Rashish <mrashish@redhat.com>
2020-05-08 00:01:19 +02:00
Sue Yoon
668a7f54de
Minor fix to a manifest example, import-kubevirt-block-datavolume (#1184)
Signed-off-by: isueyoon <sueyoon@protonmail.com>
2020-04-19 13:44:05 +02:00
Alexander Wels
886e76035e
Fix InsecureSkipVerify in imageio data source for http client. Use http data source client instead. (#1159)
Signed-off-by: Alexander Wels <awels@redhat.com>
2020-03-27 00:51:48 +01:00
Ondra Machacek
ab45d7e691
Add source of imageio docker images (#1153)
This PR add source of imageio docker images used for functional tests.

Change-Id: Ib9a2a89e69c71a1a059e9a1b2a9b2f80582e520d
Signed-off-by: Ondra Machacek <omachace@redhat.com>
2020-03-23 16:29:45 +01:00
Piotr Kliczewski
78cee6d166
Imageio - new import data source (#1042)
This PR introduces new import data source to fetch disks from ovirt
and store them in storage available in the cluster. It uses ovirt-sdk
to check whether the this is there, the size of the disk and it obtains
signed ticket which allows to get the disk using ovirt-imageio-proxy.

In order to use it a user needs to create configmap with ovirt api
certificate and secret with ovirt engine user and password. Both are
required and validated by webhook. In order to start import process
we need to post following definition:

---
apiVersion: cdi.kubevirt.io/v1alpha1
kind: DataVolume
metadata:
  name: "imageio-dv"
spec:
  source:
      imageio:
         url: "<engine-api-endpoint>"
         secretRef: "<secret-name-containing-engine-credentials>"
         certConfigMap: "<configmap-name-containing-engine-api-certificate>"
         diskId: "<disk-id-which-we-want-to-import>"
  pvc:
    accessModes:
      - ReadWriteOnce
    resources:
      requests:
        storage: "64Mi"
---

Signed-off-by: Piotr Kliczewski <piotr.kliczewski@gmail.com>
2020-03-19 19:49:44 +01:00
Michael Henriksen
99c95f2ddf
skip CDI CR delete tests when expected name does not exist (#1131)
Signed-off-by: Michael Henriksen <mhenriks@redhat.com>
2020-03-07 01:49:11 +01:00
Alexander Wels
657be041ac Add k8s 1.16.2 provider. (#1041)
Signed-off-by: Alexander Wels <awels@redhat.com>
2019-12-02 17:55:45 +01:00
Michael Henriksen
044ab60f52 cut down operator permissions (#1012)
* cut down operator permissions

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

* mage sure csv-generator is built but not included in operator image

Signed-off-by: Michael Henriksen <mhenriks@redhat.com>
2019-11-11 22:41:14 +01:00
Pedro Ibanez Requena
fad70f9fb6 fixing names issue as the image is the cirros and the names where referencing to fedora (#1011)
Signed-off-by: Pedro Ibáñez <pedro@redhat.com>
2019-11-08 07:57:12 -05:00
Alexander Wels
4a20e29db3
Remove OLM integration as we aren't using it. (#982)
Removed OLM code since it is not being used in CDI deployment.

Signed-off-by: Alexander Wels <awels@redhat.com>
2019-10-07 18:34:07 -04:00
Michael Henriksen
254dc90835 create aggregate cluster roles (#961)
* create aggregate cluster roles

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

* CDIConfig needs a ClusterRoleBinding so bind to system:authenticated for reading

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

* comment out problematic test

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

* operator needs upload.cdi.kubevirt.io permission

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

* revert commented out tests

Signed-off-by: Michael Henriksen <mhenriks@redhat.com>
2019-09-18 19:03:49 -04:00
David Vossel
2292ea1700 Generate release CSV from code
Signed-off-by: David Vossel <davidvossel@gmail.com>
2019-08-02 10:11:27 -04:00
annastopel
77f9e5a88e reove extra whitespaces 2019-07-14 09:49:36 +03:00
annastopel
34bc7e1d94 OLM - ci -test. Create cdi-olm-catalog to be able to deploy cdi via olm in ci. This is due to okd 4.1.
* Add make tagret docker-olm-catalog
  * Add build-olm-catalog script that builds tree expected by operator-registry.

  * add catalogsource manifest to deploy operator registry per provider
    * os
    * k8s
  * update olm documentation with opertor-registry deployment
2019-07-14 09:48:09 +03:00
Alexander Wels
dc4d22dc5d
Allow specifying block storage class. (#815)
Fix node selection functional test

Signed-off-by: Alexander Wels <awels@redhat.com>
2019-06-28 08:22:56 -04:00
Anna Stopel
7ad9bc2366 Olm upgrade (#817)
*     CDI OLM update support
    * Download latest CDI OLM manifest from marketplace to set replaces field
    * Prevent from genarting a csv version that already exist in  the marketplace

*     * Vendor the bellow packages in order to be able to fetch existing CSV
      - github.com/operator-framework/operator-marketplace
      - github.com/go-openapi/spec
      - github.com/go-openapi/validate
      - github.com/go-openapi/errors
      - github.com/go-openapi/analysis
      - github.com/go-openapi/strfmt
      - github.com/go-openapi/loads
      - github.com/go-openapi/runtime

* lint bug-fix

* CR fixes

* CR typo fixes

* * Split catalogsource/operatorsource/subscription manifests to k8s and os
* Update OLM documentation
* rename bundle-helper.go file

* * change CDI repository name in quay from cdi to cdi-operatorhub

* Update cdi-operator-olm.md
2019-06-19 16:35:58 -04:00
Michael Henriksen
5740cee5fd fix host:port not allowed in insecure registry configmap 2019-05-29 17:05:55 -04:00
Michael Henriksen
8204a3b3b6 fix sync script and rename cdi manifest 2019-05-05 19:11:49 -04:00
annastopel
f634cdaa17 CDI operator OLM integration:
- Generate OLM related manifests for CDI in _out/manifests/release/olm
      OLM bundle:
	- cdi CSV manifest
	- cdi crd manifest
	- cdi package manifest
     - operatorsource manifest
     - subscription manifest
     - operatorgroup manifest
- Modify cdi-operator role not to be cluster-admin but more specific
- Move all final manifests to _out/manifests directory and update travis with new manifests location
- Provide API for vendoring CDI OLM manifests generation code

Note:
  - OLM CSV update to be supported in a separate PR
  - OLM bundle integration in travis is to be supported together with CSV update
2019-05-01 13:54:28 +03:00
Alexander Wels
3f489cc2f0
Merge pull request #751 from awels/fix_example_links
Fix example links in datavolume documentation.
2019-04-24 08:02:12 -04:00
tavni
e9b6b4f501 Adding support to upload disk image to a Raw Block PV
Signed-off-by: tavni <tavni@redhat.com>
2019-04-17 10:27:24 +03:00