containerized-data-importer/pkg/controller/datavolume
Arnon Gilboa 221469d062
Add PVC spec mutating webhook rendering based on StorageProfiles (#2813)
* Add PVC mutating webhook using StorageProfiles

The webhook mutates the PVC Spec based on the available StorageProfiles,
so for example you can create PVC without accessModes and it will be
auto-completed.

To use this feature, enable the `WebhookPvcRendering` feature gate.

For any PVC you want to use StorageProfile, label it with:
    cdi.kubevirt.io/useStorageProfile: "true"

If you want to use volumeMode preferred by CDI according to
StorageProfiles, set it to FromStorageProfile. Otherwise if not
explicitly set to Block, it will be Filesystem by k8s default.

E.g.:

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: pvc-test
  labels:
    cdi.kubevirt.io/useStorageProfile: "true"
spec:
  storageClassName: rook-ceph-block
  volumeMode: FromStorageProfile
  resources:
    requests:
      storage: 1Mi

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

* Move webhook create/delete to callback

plus some CR fixes and cleanups

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

* Move webhook CR creation to sit with callbacks

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

* Update existing webhook if modified

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

* Eliminate unnecessary CR update

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

---------

Signed-off-by: Arnon Gilboa <agilboa@redhat.com>
2024-02-12 15:26:28 +01:00
..
BUILD.bazel Refactor monitoring code (#3009) 2024-01-02 09:17:18 +01:00
clone-controller-base.go update k8s & related libraries to 1.28 (#3078) 2024-01-23 17:52:05 +01:00
conditions_test.go Update to ginkgo v2 (#2788) 2023-07-26 02:35:55 +02:00
conditions.go Create PVC if possible even if the StorageClass is missing (#2683) 2023-05-02 22:16:04 +02:00
controller_suite_test.go Update to ginkgo v2 (#2788) 2023-07-26 02:35:55 +02:00
controller-base.go Add PVC spec mutating webhook rendering based on StorageProfiles (#2813) 2024-02-12 15:26:28 +01:00
external-population-controller_test.go update k8s & related libraries to 1.28 (#3078) 2024-01-23 17:52:05 +01:00
external-population-controller.go increase controller cuncurrency and cpu requests (#2862) 2023-08-24 02:48:34 +02:00
garbagecollect.go add annotation cdi.kubevirt.io/garbageCollected to PVCs when DVs are garbage collected (#3059) 2024-01-14 12:11:57 +01:00
import-controller_test.go Add PVC spec mutating webhook rendering based on StorageProfiles (#2813) 2024-02-12 15:26:28 +01:00
import-controller.go update k8s & related libraries to 1.28 (#3078) 2024-01-23 17:52:05 +01:00
pvc-clone-controller_test.go Add PVC spec mutating webhook rendering based on StorageProfiles (#2813) 2024-02-12 15:26:28 +01:00
pvc-clone-controller.go Add PVC spec mutating webhook rendering based on StorageProfiles (#2813) 2024-02-12 15:26:28 +01:00
snapshot-clone-controller_test.go update k8s & related libraries to 1.28 (#3078) 2024-01-23 17:52:05 +01:00
snapshot-clone-controller.go Add PVC spec mutating webhook rendering based on StorageProfiles (#2813) 2024-02-12 15:26:28 +01:00
static-volume_test.go update k8s & related libraries to 1.28 (#3078) 2024-01-23 17:52:05 +01:00
upload-controller_test.go update k8s & related libraries to 1.28 (#3078) 2024-01-23 17:52:05 +01:00
upload-controller.go update k8s & related libraries to 1.28 (#3078) 2024-01-23 17:52:05 +01:00
util_test.go Add PVC spec mutating webhook rendering based on StorageProfiles (#2813) 2024-02-12 15:26:28 +01:00
util.go Add PVC spec mutating webhook rendering based on StorageProfiles (#2813) 2024-02-12 15:26:28 +01:00