Commit Graph

62 Commits

Author SHA1 Message Date
Eng Zer Jun
aaacbae797
refactor: move from io/ioutil to io and os packages (#2484)
The io/ioutil package has been deprecated as of Go 1.16 [1]. This commit
replaces the existing io/ioutil functions with their new definitions in
io and os packages.

[1]: https://golang.org/doc/go1.16#ioutil
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
2022-12-05 19:19:13 +00:00
akalenyu
dfafc29fef
Fix SCC priority so our scc doesn't get picked for random pods (#2466)
We create our SCC with `priority: 10` (not sure why), which means
that it might get picked up by random pods whose service account is privileged enough to access all SCCs:
```bash
$ oc get pods -n openshift-cluster-storage-operator cluster-storage-operator-5648cb555d-zh76b  -o yaml| grep scc
    openshift.io/scc: containerized-data-importer
```
Happens because it can physically do that
```bash
$ oc get clusterrolebinding cluster-storage-operator-role -o yaml | grep cluster-admin
  name: cluster-admin
```
A nice readout about this in context of the openshift oauth pods:
https://access.redhat.com/solutions/4727461

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

Signed-off-by: Alex Kalenyuk <akalenyu@redhat.com>
2022-11-15 00:36:23 +00:00
Arnon Gilboa
eef03584fb
Add DataImportCron CronJobs Proxy support (#2455)
* Add DataImportCron CronJobs Proxy support

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

* CR fixes

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

* Add cronjob env utest

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

Signed-off-by: Arnon Gilboa <agilboa@redhat.com>
2022-11-03 19:43:23 +00:00
Arnon Gilboa
a222359dc6
Adapt DataImportCron and DataSource to DV GC (#2441)
* Adapt DataImportCron and DataSource to DV GC

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

* Add DIC test for GC

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

* CR fixes

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

Signed-off-by: Arnon Gilboa <agilboa@redhat.com>
2022-10-20 20:55:47 +01:00
Arnon Gilboa
f58723d9ce
Enable DataVolume garbage collection by default (#2421)
On the next kubevirt-bot Bump kubevirtci PR (with bump-cdi), it will
fail on all kubevirtci lanes with tests referring DVs, as the tests
IsDataVolumeGC() looks at CDIConfig Spec.DataVolumeTTLSeconds and
assumes default is disabled. This should be fixed there.

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

Signed-off-by: Arnon Gilboa <agilboa@redhat.com>
2022-09-16 08:52:45 +01:00
Maya Rashish
81deac9fcf
Split up utils.go to logical divisions (#2310)
* Remove unused function PanicOnError

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

* Remove logic for skipping a test on old kubectl

1.14.0 is pretty old, assume a new enough kubectl is used now.
Simplify utils.go which has an elaborate function for detecting
the version used.

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

* Make functions private if they're only used in one file

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

* Move prometheus functions to tests/framework/prometheus.go

Split utils.go into meaningful filenames.
Framework was chosen because it uses framework things, and that
can't be done from utils without circular imports.

Make functions part of the framework struct wherever possible
to avoid needing to pass extra arguments.

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

* Move {Create,Run}KubectlCommand to framework

Allows moving more things away from tests/utils.go towards the goal
of eliminating it.

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

* Move CreateVddkWarmImportDataVolume into own file in framework

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

* Move node placement utils to a separate file in framework package

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

* Move WaitForConditions and associated functions to util

Pass it a ClientsIface instead of pulling in framework.

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

* Move pod log functions to framework/pod.go, delete tests/utils.go

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

* Fix typo

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

* Use CombinedOutput - shows stderr in the output unconditionally

Simplifies the code.

Signed-off-by: Maya Rashish <mrashish@redhat.com>
2022-07-04 10:48:40 +02:00
akalenyu
cbb439072b
Switch CI lanes to k8s 1.24 (#2328)
* Update kubevirtci

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

* Add cluster-sync 1.24 provider

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

* Increment k8s versions used in CI lanes

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

* Handle secrets not being auto generated in 1.24

More info in third bullet point
https://github.com/kubernetes/kubernetes/blob/master/CHANGELOG/CHANGELOG-1.24.md#urgent-upgrade-notes

Signed-off-by: Alex Kalenyuk <akalenyu@redhat.com>
2022-06-30 01:30:22 +02:00
Assaf Admi
24aa9353c1
Add sanity test for CDI alerts (#2309)
Signed-off-by: assafad <aadmi@redhat.com>
2022-06-27 23:22:56 +02:00
Roman Mohr
b9c0684469
Separate sdk api (#2208)
* Introduce controller-runtime-sdk api package

Split controller-runtime-sdk into the base package and
controller-runtime-sdk/api.

Signed-off-by: Roman Mohr <rmohr@redhat.com>

* go mod vendor

Signed-off-by: Roman Mohr <rmohr@redhat.com>

* Update code references

Signed-off-by: Roman Mohr <rmohr@redhat.com>
2022-03-31 21:31:18 +02:00
Arnon Gilboa
d4a850468b
Delete erroneous DataVolume on DataImportCron desired digest update (#2169)
* Delete erroneous DV on DIC desired digest update

When a DataImportCron import DV is condition Running=False with
Reason=Error it indicates this DIC might get stuck with this DV forever,
so no new import DVs will be created even if the source sha256 is
updated. With this change, when digest is updated, before creating the
new DV, we simply delete the erroneous DV if necessary.

Also includes some DataImportCron tests improvements and cleanup.

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

* CR fixes

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

* Fix flaky tests

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

* More CR fixes

Signed-off-by: Arnon Gilboa <agilboa@redhat.com>
2022-03-01 23:04:12 +01:00
Assaf Admi
855e6d9dce
Add test cases for runbook URLs (#2079)
Signed-off-by: assafad <aadmi@redhat.com>
2022-02-21 16:55:24 +01:00
Arnon Gilboa
0ee4a61987
Get rid of DataImportCron finalizer (#2144)
* Get rid of DataImportCron finalizer

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

* Remove CRDs deletion in operator deletion

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

* CR fixes

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

* Cleanups

Signed-off-by: Arnon Gilboa <agilboa@redhat.com>
2022-02-12 05:56:08 +01:00
Arnon Gilboa
472c38e657
Fix CRDs deletion in operator deletion (#2129)
* Fix CRDs deletion in operator deletion

Also check DataImportCron CRD has no DeletionTimestamp before adding a
finalizer

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

* CR fixes

Signed-off-by: Arnon Gilboa <agilboa@redhat.com>
2022-01-28 16:13:09 +01:00
Arnon Gilboa
d9a23e5f8f
Delete CRDs & check finalizers in operator delete (#2097)
* Delete CRDs & check finalizers in operator delete

reconcileDeleteControllerDeployment deletes the CRDs of DataImportCron and
DataVolume, and returns error if any DIC/DV has a finalizer. It will get
retried and controller will eventually remove the finalizers.

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

* Fix error handling

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

* Add destructive operator test

Signed-off-by: Arnon Gilboa <agilboa@redhat.com>
2022-01-19 16:47:47 +01:00
Yan Du
99e00b0354
Add test ids for Alert tests (#2083)
Signed-off-by: Yan Du <yadu@redhat.com>
2022-01-10 18:10:37 +01:00
akalenyu
3bff27dd43
Add alert for DataImportCron not being up to date (#2063)
* Add alert for DataImportCron failing

DataImportCrons now have conditions (particularly UpToDate) that tell us if
things are going as planned. We can utilize those to alert whenever were not UpToDate for a while.

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

* Address CR review; don't List, increment when needed via corresponding instance

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

* Address review & bugfix: don't update metric if err occurs

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

* upToDateCondition => prevUpToDateCondition so it's clear we're deciding if we should inc/dec based on that

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

* Don't store state in controller; change metric type to GaugeVec (bool metric per DIC)

Signed-off-by: Alex Kalenyuk <akalenyu@redhat.com>
2021-12-24 01:10:52 +01:00
Arnon Gilboa
4ef4b20cbf
On CDI delete validation ignore DVs labeled with DataImportCron (#2066)
Signed-off-by: Arnon Gilboa <agilboa@redhat.com>
2021-12-21 21:18:43 +01:00
akalenyu
38af724f1c
Add alert for incomplete storage profiles / delete profile when corresponding SC gone (#2027)
* Add alert for incomplete storage profiles

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

* Run metric tests on both openshift and k8s

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

* Add functional test for storageprofile metrics

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

* Delete profile as a follow up to storage class getting deleted

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

* Address review, alter tests to cover List metric approach

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

* Address review; individually loop over metric decrement, shorten reconcile.Result{}

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

* Address review; deletion timestamp not possible when err/teardown in AfterEach

Signed-off-by: Alex Kalenyuk <akalenyu@redhat.com>
2021-12-01 21:54:59 +01:00
akalenyu
fd332a3165
Degraded/unusual restartcount alerts (#2009)
* Add degraded alert

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

* Add unusual restart count metric

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

* Add actual firing alerts (degraded/restartcount)

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

* Test newly added metrics

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

* Review: Rename metric to match conventions, func to check if test is eligible to run metric tests

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

* Get rid of similar funcs, reconcile more generally

Signed-off-by: Alex Kalenyuk <akalenyu@redhat.com>
2021-11-18 01:05:01 +01:00
Nahshon Unna Tsameret
48b7606d4d
Replace the priorityClass to kubevirt-cluster-critical (#2011)
The current priority class for the operator is openshift-user-critical. This priority class does not exist in Kubernetes.

Instead, use the kubevirt-cluster-critical priority class that is created by HCO.

Signed-off-by: Nahshon Unna-Tsameret <nunnatsa@redhat.com>
2021-11-08 17:29:13 +01:00
Michael Henriksen
aedaf513ec
Move apis to staging, push to containerized-data-importer-api (#1997)
* move apis to new staging area

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

* add script to push to staging

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

* fix lint check and api reference

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

* push staging to api repo

Signed-off-by: Michael Henriksen <mhenriks@redhat.com>
2021-10-28 13:40:24 +02:00
akalenyu
50c93e8b0e
Deploy alerts infra as part of our installation (#1979)
* Deploy alerts infra as part of our installation

Conditionally deploy the infrastructure that is needed to fire alerts for our users
when bad things are happening to CDI.

Testing with `KUBEVIRT_DEPLOY_PROMETHEUS=true`

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

* Watch and unit test all prometheus related resources

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

* add gateway for changing monitoring namespace (rbac purposes)

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

* refactor test to check for exact alert name and firing state

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

* Align pattern of ensuring prometheus resource exists for all

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

* Remove potential noisy event

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

* Extract duplicate code to function

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

* Dont use empty value for prometheus label due to open issue

https://github.com/prometheus-operator/prometheus-operator/issues/4325

Signed-off-by: Alex Kalenyuk <akalenyu@redhat.com>
2021-10-26 21:26:07 +02:00
Maya Rashish
a2fd370a0d
Update external links. (#1946)
* Update doc links.

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

* Remove reference for travis-ci, no longer used

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

* Follow links and update links

Signed-off-by: Maya Rashish <mrashish@redhat.com>
2021-09-22 14:16:30 +02:00
Alexander Wels
17599e5c20
Allow users to set priority class via CDI cr. (#1896)
Allow users to specify the priority class of the CDI control
plane using the CDI CR. Verifies that the set value is valid
before passing to the deployments.

Signed-off-by: Alexander Wels <awels@redhat.com>
2021-08-21 15:48:33 +02:00
Vishesh Tanksale
abcb176429
Removing cdi-prometheus-metrics service for CDI installation (#1892)
Signed-off-by: Vishesh Ajay Tanksale <vtanksale@apple.com>

Co-authored-by: Vishesh Ajay Tanksale <vtanksale@apple.com>
2021-08-16 13:18:30 +02:00
Michael Henriksen
ee2f8376bb
fix custom cert rotation params (#1775)
Signed-off-by: Michael Henriksen <mhenriks@redhat.com>
2021-05-06 20:19:39 +02: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
Michael Henriksen
ea1890e0fa
Flaky test fix (#1647)
Signed-off-by: Michael Henriksen <mhenriks@redhat.com>
2021-02-13 21:32:57 +01:00
Tomasz Barański
02df94ffd0
Add diagnostic to flake test (#1626)
Operator cert config tests failes sometimes during CI. This commit adds
some diagnostic outout that can help understand the failure.
Signed-off-by: Tomasz Baranski <tbaransk@redhat.com>
2021-02-05 14:20:53 +01:00
Alexander Wels
79f1bef987
Add focus for destructive tests. (#1614)
Sometimes destructive tests wouldn't clean up properly ruining the rest
of the run. This makes it so we can focus and skip the destructive
tests based on the lane settings.

Signed-off-by: Alexander Wels <awels@redhat.com>
2021-01-28 22:32:50 +01:00
Maya Rashish
9a8fc07302
Skip test 2555 if running on openshift (#1572)
* Move "isOpenshift" to utils and make public.

No functional change.

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

* Skip malformed too large qcow2 on openshift.

Whether this test fails depends on the qemu-img version. The way we
build and test it in this repo is fine, but external builds may fail.

Skipping only on OpenShift means we will continue testing it and
finding regressions.

Signed-off-by: Maya Rashish <mrashish@redhat.com>
2021-01-18 14:20:28 +01:00
Michael Henriksen
838ff7939a
update api for cert configuration (#1542)
Signed-off-by: Michael Henriksen <mhenriks@redhat.com>
2021-01-14 16:11:03 +01:00
akalenyu
bb1381c6e4
Add test ids to strict reconciliation tests (#1546)
Adding ids for recent tests + an id that was missed in bulk.

Signed-off-by: Alex Kalenyuk <akalenyu@redhat.com>
2020-12-27 04:46:51 +01:00
Maya Rashish
bbc490135f
Try updating the node taint in a loop (#1510)
Sometimes other things will influence the nodes so the update will
fail on an outdated generation number.

Signed-off-by: Maya Rashish <mrashish@redhat.com>
2020-12-14 16:30:45 +01:00
akalenyu
db4ecae9c4
Add strict reconciliation tests (#1505)
Ensure CDI operator continuously reconciles all the resources it created

Signed-off-by: Alex Kalenyuk <akalenyu@redhat.com>
2020-12-08 15:54:41 +01:00
Michael Henriksen
7c05e8f093
Designate CDI as CDIConfig authority (#1516)
* Formally designate CDI as owner of CDIConfig by adding annotation cdi.kubevirt.io/configAuthority

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

* More robust upgrade handling.  No error if beta api not installed yet.

Signed-off-by: Michael Henriksen <mhenriks@redhat.com>
2020-12-04 02:52:40 +01:00
Alexander Wels
1565c66818
In the operator test there is a critical addons test that removes and (#1513)
restarts the pod used in tests. It verified the pods where 'ready' but
not that the service using those pods had working endpoints. Due to the
changes where we start the next test without waiting for the namespace
to finish deleting, those services didn't have enough time to have their
endpoints be available. This ensures the endpoints are available before
moving onto the next tests.

Signed-off-by: Alexander Wels <awels@redhat.com>
2020-12-03 04:28:39 +01:00
Maya Rashish
36d79d1fec
Wait for stray pods to terminate, destroy/re-create at AfterEach. (#1459)
This suite creates stray pods by deleting/re-creating the CDI CR,
causing several pods to terminate & be re-created.

This disrupts the critical addons test, which counts the number of
pods before and after.

To avoid doing this, mimic the critical addons test and wait until
the number of pods is the same as before the test run.

While here, also destroy/re-create the CDI CR unconditionally in
AfterEach. We want all the CDI pods to be running at the end of
a test, and being sure that they were first terminated lets us
be certain that we are checking that the pods are the new ones,
not old pods that haven't started terminating yet.

Signed-off-by: Maya Rashish <mrashish@redhat.com>
2020-11-05 18:07:52 +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
Yan Du
449f8b13d0
Add test_id for the test cases (#1398)
Signed-off-by: Yan Du <yadu@redhat.com>
2020-09-25 13:23:29 +02:00
Jakub Dzon
7f368900de
Updated controller-lifecycle-operator-sdk dependency (#1389)
Signed-off-by: Jakub Dzon <jdzon@redhat.com>
2020-09-24 14:39:29 +02:00
Jakub Dzon
5aa47587d3
Introducing operator lifecycle sdk (#1350)
Signed-off-by: Jakub Dzon <jdzon@redhat.com>
2020-09-17 23:25:26 +02:00
Yan Du
49e2df5b5d
Add ref_id and test_id for CDI placement API tests (#1357)
Signed-off-by: Yan Du <yadu@redhat.com>
2020-09-11 08:29:23 +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
Michael Henriksen
75f4fd6f2f
update k8s deps to 18.6 and controller runtime to 0.6.2 (#1330)
* update k8s deps to 1.18.6 and controller runtime to 0.6.2

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

* remove building code generators from docker image.  This way the k8s ligray version only has to be updated in go.mod

Do more stuff in the bazel container.  Faster and better interop

Fix unit tests

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

* make format

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

* remove unnecessary rsync

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

* redo code generator dep management

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

* builder uses go modules

Signed-off-by: Michael Henriksen <mhenriks@redhat.com>
2020-08-07 14:09:52 +02:00
Michael Henriksen
8b9ce68262
enable webhooks for alpha resources (#1321)
* enable webhooks for alpha resources

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

* clean up transport test

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

* update alpha api test, webhook error message was changed

Signed-off-by: Michael Henriksen <mhenriks@redhat.com>
2020-08-01 16:09:50 +02:00
Alexander Wels
c7a3610769
Update cdi-builder to use go version 1.14.6 (current latest) (#1310)
* Update cdi-builder to use go version 1.14.6 (current latest)
Fix functional test framework to work with go >= 1.13. We were not
using the ginkgo ordering correctly, and our framework would call
flag.Parse() too soon, and mess with the go testing flag parsing.
As a result we had to alter some of the variables that we use to build
urls to be functions so that when called the required information is
available.
Fixed several tests not checking for errors.
Fixed dumping code being initialized several times messing with the
order in which failures were reported.

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

* Fixed failing tests.

Signed-off-by: Alexander Wels <awels@redhat.com>
2020-07-23 23:09:44 +02:00
Bartosz Rybacki
ab48911b9b
WaitForFirstConsumer handling for DataVolumes (#1242)
* Set the WaitForFirstConsumer phase on DataVolume when storage uses the WaitForFirstConsumer binding mode and is not bound yet.

Signed-off-by: Bartosz Rybacki <brybacki@redhat.com>

* Skip PVC if not bound in import|clone|upload controllers.

This is done so the VM pod(not the cdi pod) will be the first consumer, and the PVC can be scheduled on the same location as the pod.

Signed-off-by: Bartosz Rybacki <brybacki@redhat.com>

fixup! Skip PVC if not bound in import|clone|upload controllers.

Signed-off-by: Bartosz Rybacki <brybacki@redhat.com>

* Update importer tests to force bind the PCV by scheduling a pod for pvc, when storage class is wffc.

Signed-off-by: Bartosz Rybacki <brybacki@redhat.com>

* Update datavolume tests to force bind the PCV by scheduling a pod for pvc, when storage class is wffc.

Signed-off-by: Bartosz Rybacki <brybacki@redhat.com>

* Update upload controller and upload tests to correctly handle force binding the PCV by scheduling a pod for pvc, when storage class is wffc.

Signed-off-by: Bartosz Rybacki <brybacki@redhat.com>

* Update clone tests to force bind the PCV by scheduling a pod for pvc when the storage class is wffc.

Signed-off-by: Bartosz Rybacki <brybacki@redhat.com>

* Update cloner multi-node tests to force bind the PCV by scheduling a pod for pvc when storage class is wffc.

Signed-off-by: Bartosz Rybacki <brybacki@redhat.com>

* Correct after automerge

Signed-off-by: Bartosz Rybacki <brybacki@redhat.com>

* Improve/simplify tests

Signed-off-by: Bartosz Rybacki <brybacki@redhat.com>

* Fix error in import test.

Signed-off-by: Bartosz Rybacki <brybacki@redhat.com>

* Update transport_test,operator_test.go

Signed-off-by: Bartosz Rybacki <brybacki@redhat.com>

* Update rbac_test.go and leaderelection_test.go

Signed-off-by: Bartosz Rybacki <brybacki@redhat.com>

* Improve Datavolume and PVC Checks for WFFC.

Signed-off-by: Bartosz Rybacki <brybacki@redhat.com>

* Handle wffc only if feature gate is open - import-controller

Signed-off-by: Bartosz Rybacki <brybacki@redhat.com>

* TEST for Handle wffc only if feature gate is open - import-controller - TEST

Signed-off-by: Bartosz Rybacki <brybacki@redhat.com>

* Handle wffc only if feature gate is open - upload-controller with test

Signed-off-by: Bartosz Rybacki <brybacki@redhat.com>

* rename and simplify checks

Signed-off-by: Bartosz Rybacki <brybacki@redhat.com>

* cleanup after rebase

Signed-off-by: Bartosz Rybacki <brybacki@redhat.com>

* update tests after rebase

Signed-off-by: Bartosz Rybacki <brybacki@redhat.com>

* update tests after rebase

Signed-off-by: Bartosz Rybacki <brybacki@redhat.com>

* more cleanups

Signed-off-by: Bartosz Rybacki <brybacki@redhat.com>

* Document new WFFC behavior

Signed-off-by: Bartosz Rybacki <brybacki@redhat.com>

* Document new HonorWaitForFirstConsumer option

Signed-off-by: Bartosz Rybacki <brybacki@redhat.com>

* update docs according to comments

Signed-off-by: Bartosz Rybacki <brybacki@redhat.com>

* extract common function, cleanup - code review fixes

Signed-off-by: Bartosz Rybacki <brybacki@redhat.com>

* add comment for another pr - 1210, so it can have easier merge/rebase

Signed-off-by: Bartosz Rybacki <brybacki@redhat.com>

* typo

Signed-off-by: Bartosz Rybacki <brybacki@redhat.com>

* Simplify getStoragebindingMode - code review comments

Signed-off-by: Bartosz Rybacki <brybacki@redhat.com>

* Add FeatureGates interface - code review fix

Additionally pass the features gates instead of the particular feature gate value,
and let shouldReconcilePVC decide what to do with the feature gate. That way shouldReconcilePVC
contains all the logic, and the caller does not need to do additional calls to provide parameters.

Signed-off-by: Bartosz Rybacki <brybacki@redhat.com>

* Update matcher

Signed-off-by: Bartosz Rybacki <brybacki@redhat.com>
2020-07-22 16:23:44 +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
Adam Litke
724e9d8362
Add test-ids for new tests (#1256)
Signed-off-by: Adam Litke <alitke@redhat.com>
2020-06-24 22:16:11 +02:00