Add oneOf constraint to VolumeGroupSnapshotContent

This commit is contained in:
Raunak Pradip Shah
2023-02-28 12:39:44 +05:30
parent e231c81e52
commit db21ddde42
2 changed files with 31 additions and 0 deletions

View File

@@ -78,6 +78,9 @@ spec:
be) created. This field is immutable. be) created. This field is immutable.
type: string type: string
type: object type: object
oneOf:
- required: ["persistentVolumeNames"]
- required: ["volumeGroupSnapshotHandle"]
volumeGroupSnapshotClassName: volumeGroupSnapshotClassName:
description: VolumeGroupSnapshotClassName is the name of the VolumeGroupSnapshotClass description: VolumeGroupSnapshotClassName is the name of the VolumeGroupSnapshotClass
from which this group snapshot was (or will be) created. Note that from which this group snapshot was (or will be) created. Note that

View File

@@ -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. * 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:
```