Commit Graph

16 Commits

Author SHA1 Message Date
Arnon Gilboa
bfe30a8964
Split and refactor DV controller (#2483)
- Split the huge DV controller into smaller op-specific DV controllers -
  import, clone, upload
- Add common watch-adding function so each controller watches only its
  relevant DVs
- Refactor the common Reconcile() to use interface DataVolumeReconciler
  implemented by each controller
- Move all functions, structs, consts to the relevant controller
- Split the utests per controller

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

Signed-off-by: Arnon Gilboa <agilboa@redhat.com>
2022-12-22 01:03:15 +00:00
Adam Litke
1532ae9ace
Suppress alerting for unsupported provisioners (#2476)
Certain storage provisioners are known not to work with CDI.  The main
example is provisioners that implement object storage (ie. buckets).  We
don't want to populate the StorageProfile with ClaimPropertySets but
there is also no need to raise an "incomplete" alert about such a
StorageProfile.  The simplest approach is to simply not count these
unsupported provisioners when setting the IncompleteProfileGauge.

Signed-off-by: Adam Litke <alitke@redhat.com>

Signed-off-by: Adam Litke <alitke@redhat.com>
2022-11-23 20:24:40 +00:00
akalenyu
4d4ad12df5
Only list Ingresses/Routes in CDI namespace instead of cluster level (#2371)
* Only list Ingresses/Routes in CDI namespace instead of cluster level

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

* Change the way we initialize cache for cdi controller

This gives us flexibility to cache only exactly what we need.
The error that led me to this was that we were attempting to Watch()
Routes/Ingresses which is basically caching all namespaces. We only want to cache the CDI namespace for those.
Source/feature from https://github.com/kubernetes-sigs/controller-runtime/issues/1708

Signed-off-by: Alex Kalenyuk <akalenyu@redhat.com>
2022-08-01 22:12:47 +02:00
Alexander Wels
bbee324537
Make CDI clone strategy strings correct types (#2277)
Noticed the consts were strings instead of the right types
this changes the type to the right type and modifies the usage
to not have to cast to the right type all over the place.

Signed-off-by: Alexander Wels <awels@redhat.com>
2022-05-17 14:19:25 +02:00
Maya Rashish
c05a750a9a
Detect storage capabilities for no-provisioner storage classes (#2226)
* Detect storage capabilities for no-provisioner storage classes

Assume there's a persistent volume that we can look up to infer the
correct values for volume mode and access modes.

Limit ourselves to detecting no-provisioner capabilities on LSO to
avoid greatly increasing the number of storage classes we provide
capabilities for. This is similar to our current flow where we
only provide capabilities for known storage classes.

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

* Regenerate bazel stuff for pkg/monitoring's existence

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

* Add a watcher for no-provisioner PVs

We maintain a map of storage class names and provisioners whenever
storage classes are changed.

If a PV has one of the storage classes with no-provisioner as a
provisioner, reconcile that storage class.

This is because we infer the storage profile based on PVs, and
new ones might have different storage capabilities.

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

* Use a client to do our storage class caching

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

* Pass a client as an argument, not global.

Suggested by awels, thanks!

Signed-off-by: Maya Rashish <mrashish@redhat.com>
2022-05-12 14:00:02 +02:00
João Vilaça
1ad70c2ec2
Gather all metrics info in a single location (#2231)
* Gather all metrics info in a single location

Signed-off-by: João Vilaça <jvilaca@redhat.com>

* Add comments to exported monitoring vars

Signed-off-by: João Vilaça <jvilaca@redhat.com>
2022-04-13 01:46:19 +02:00
Michael Henriksen
d56e0cca05
23 libs (#2077)
Signed-off-by: Michael Henriksen <mhenriks@redhat.com>
2022-01-07 16:56:25 +01:00
Prajith Kesava Prasad
7a85f2c18c
Trigger Host Assisted Cloning for encrypted ocs sc. (#2004)
* Trigger Host Assisted Cloning for encrypted ocs sc.

Signed-off-by: Prajith Kesava Prasad <pkesavap@redhat.com>

* Add functional tests

Signed-off-by: Prajith Kesava Prasad <pkesavap@redhat.com>
2021-12-11 00:52:00 +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
eb639a6ac5
Change some relationship labels on update as well (#2018)
* Update operator-lifecycle-sdk to get fix for labels on upgrade

Update dep to get https://github.com/kubevirt/controller-lifecycle-operator-sdk/pull/19

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

* Reconcile labels also for CDIConfig

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

* Reconcile labels on storageprofile

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

* Reconcile remaining operator resources for updated labels

BZ#2017478

Signed-off-by: Alex Kalenyuk <akalenyu@redhat.com>
2021-11-23 16:16:49 +01:00
Shelly Kagan
e7dd62eb26
Upload archive (#1969)
* Add support for archive upload

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

* fix golang errors

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

* Change storage profile property set to support more then one set

So far CDI supported only 1 claim propery set. We want to be able
to support more then one so in case the user provides to the
DV storage volumeMode without accessMode or vice versa cdi
will be able to fit to it the most appropriate match.
Added to rook ceph block a second default of filesystem
volume mode with RWO access mode, it will support archive
upload which has default of filesystem mode.

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

* CR fix - change to one endpoint for the user

upload proxy will identify if the upload is archive
or not by looking at the content type annotation on
the pvc. If the content type is archive it will route
the uplaod to upload server to a new archive upload uri.

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

* Add storage profile and data volume controllers unit tests

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

* CR fixes

* add default volume mode to archive content type
* upload server use data processor for archive upload
* tests for volume mode with archive content type
* tests for archive upload of compressed tar

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

* Adjust imports acording to new apis dir

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

* CR small fixes

Signed-off-by: Shelly Kagan <skagan@redhat.com>
2021-11-03 20:11:47 +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
Bartosz Rybacki
a82a0a7a59
Correct the cloneStrategy on StorageProfile (#1951)
Moves the cloneStrategy up one level from claimPropertySet to
StorageProfile.spec and StorageProfile.status.

Signed-off-by: Bartosz Rybacki <brybacki@redhat.com>
2021-09-22 18:06:18 +02:00
akalenyu
2254cf0c1f
Add relationship labels (#1864)
Users don't want 👽 resources in clusters,
and we should also be able to tell if were part of a broader installation.

Note:
- Operator created resources were handled in https://github.com/kubevirt/controller-lifecycle-operator-sdk/pull/18
as these labels will be common to all resources deployed by the HCO.
- Now that the controller is guaranteed to have the labels, we can set env vars
that reference the label values (fieldRef) to spare calling GET on the CR in the controllers.
(thanks mhenriks).

Signed-off-by: Alex Kalenyuk <akalenyu@redhat.com>
2021-07-28 20:05:24 +02:00
Michael Henriksen
d92c2f459d
update deps and bazel (#1815)
* update deps and bazel

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

* fix apidocs and unit tests

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

* fix generate-verify

Signed-off-by: Michael Henriksen <mhenriks@redhat.com>
2021-06-08 01:31:59 +02:00
Bartosz Rybacki
1a6697b618
Provide storage profiles (#1734)
* Fix cluster scope for StorageProfile

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

* Automatically provide StorageProfiles based on well known providers

A new controller scans Storage Classes and creates a new StorageProfile for each. It provides recommended parameters for storage classes with well known providers.

Add StorageProfiles CRD to "make generate-verify" target

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

* Refactor - extracted getStorageProfile to make code readable

Signed-off-by: Bartosz Rybacki <brybacki@redhat.com>
2021-04-08 13:40:58 +02:00