From db21ddde42fc3b5b313d96bde2a8484d7d09be8b Mon Sep 17 00:00:00 2001 From: Raunak Pradip Shah Date: Tue, 28 Feb 2023 12:39:44 +0530 Subject: [PATCH] Add oneOf constraint to VolumeGroupSnapshotContent --- ...ge.k8s.io_volumegroupsnapshotcontents.yaml | 3 ++ client/hack/README.md | 28 +++++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/client/config/crd/snapshot.storage.k8s.io_volumegroupsnapshotcontents.yaml b/client/config/crd/snapshot.storage.k8s.io_volumegroupsnapshotcontents.yaml index c766be24..1771a5a9 100644 --- a/client/config/crd/snapshot.storage.k8s.io_volumegroupsnapshotcontents.yaml +++ b/client/config/crd/snapshot.storage.k8s.io_volumegroupsnapshotcontents.yaml @@ -78,6 +78,9 @@ spec: be) created. This field is immutable. type: string type: object + oneOf: + - required: ["persistentVolumeNames"] + - required: ["volumeGroupSnapshotHandle"] volumeGroupSnapshotClassName: description: VolumeGroupSnapshotClassName is the name of the VolumeGroupSnapshotClass from which this group snapshot was (or will be) created. Note that diff --git a/client/hack/README.md b/client/hack/README.md index 161bf9b9..d46773c6 100644 --- a/client/hack/README.md +++ b/client/hack/README.md @@ -187,3 +187,31 @@ Update the restoreSize property to use type string only: ``` * Add the VolumeSnapshot namespace to the `additionalPrinterColumns` section. Refer https://github.com/kubernetes-csi/external-snapshotter/pull/535 for more details. + +* In `client/config/crd/snapshot.storage.k8s.io_volumegroupsnapshotcontents.yaml `, we need to add the `oneOf` constraint to make sure only one of `persistentVolumeNames` and `volumeGroupSnapshotHandle` is specified in the `source` field of the `spec` of `VolumeGroupSnapshotContent`. + +```bash + source: + description: Source specifies whether the snapshot is (or should be) + dynamically provisioned or already exists, and just requires a Kubernetes + object representation. This field is immutable after creation. Required. + properties: + persistentVolumeNames: + description: PersistentVolumeNames is a list of names of PersistentVolumes + to be snapshotted together. Signifies dynamic provisioning of + the VolumeGroupSnapshot. This field is immutable. + items: + type: string + type: array + volumeGroupSnapshotHandle: + description: VolumeGroupSnapshotHandle specifies the CSI "snapshot_id" + of a pre-existing snapshot on the underlying storage system + for which a Kubernetes object representation was (or should + be) created. This field is immutable. + type: string + type: object + oneOf: + - required: ["persistentVolumeNames"] + - required: ["volumeGroupSnapshotHandle"] + volumeGroupSnapshotClassName: +``` \ No newline at end of file