From 895a10c035e65399414938a613442969f12563e1 Mon Sep 17 00:00:00 2001 From: xing-yang Date: Tue, 7 May 2024 00:40:56 +0000 Subject: [PATCH] Update manifests --- ...ge.k8s.io_volumegroupsnapshotcontents.yaml | 22 ++--- ...t.storage.k8s.io_volumegroupsnapshots.yaml | 12 ++- ....storage.k8s.io_volumesnapshotclasses.yaml | 2 +- ...storage.k8s.io_volumesnapshotcontents.yaml | 12 ++- ...apshot.storage.k8s.io_volumesnapshots.yaml | 10 ++- client/hack/README.md | 89 +------------------ 6 files changed, 38 insertions(+), 109 deletions(-) diff --git a/client/config/crd/groupsnapshot.storage.k8s.io_volumegroupsnapshotcontents.yaml b/client/config/crd/groupsnapshot.storage.k8s.io_volumegroupsnapshotcontents.yaml index e813db1ba..62bf3df68 100644 --- a/client/config/crd/groupsnapshot.storage.k8s.io_volumegroupsnapshotcontents.yaml +++ b/client/config/crd/groupsnapshot.storage.k8s.io_volumegroupsnapshotcontents.yaml @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - api-approved.kubernetes.io: "https://github.com/kubernetes-csi/external-snapshotter/pull/814" + api-approved.kubernetes.io: "https://github.com/kubernetes-csi/external-snapshotter/pull/971" controller-gen.kubebuilder.io/version: v0.15.0 name: volumegroupsnapshotcontents.groupsnapshot.storage.k8s.io spec: @@ -148,7 +148,7 @@ spec: - volumeSnapshotHandles type: object x-kubernetes-validations: - - message: Spec.Source.GroupSnapshotHandles is immutable + - message: groupSnapshotHandles is immutable rule: self == oldSelf volumeHandles: description: |- @@ -159,14 +159,18 @@ spec: type: string type: array x-kubernetes-validations: - - message: Spec.Source.VolumeHandle is immutable + - message: volumeHandles is immutable rule: self == oldSelf type: object x-kubernetes-validations: - - message: volumeHandle is required once set - rule: '!has(oldSelf.volumeHandle) || has(self.volumeHandle)' + - message: volumeHandles is required once set + rule: '!has(oldSelf.volumeHandles) || has(self.volumeHandles)' - message: groupSnapshotHandles is required once set rule: '!has(oldSelf.groupSnapshotHandles) || has(self.groupSnapshotHandles)' + - message: exactly one of volumeHandles and groupSnapshotHandles must + be set + rule: (has(self.volumeHandles) && !has(self.groupSnapshotHandles)) + || (!has(self.volumeHandles) && has(self.groupSnapshotHandles)) volumeGroupSnapshotClassName: description: |- VolumeGroupSnapshotClassName is the name of the VolumeGroupSnapshotClass from @@ -230,13 +234,11 @@ spec: type: object x-kubernetes-map-type: atomic x-kubernetes-validations: - - message: both Spec.VolumeGroupSnapshotRef.Name and Spec.VolumeGroupSnapshotRef.Namespace + - message: both volumeGroupSnapshotRef.name and volumeGroupSnapshotRef.namespace must be set rule: has(self.name) && has(self.__namespace__) - - message: Spec.VolumeGroupSnapshotRef.Name is immutable - rule: self.name == oldSelf.name - - message: Spec.VolumeGroupSnapshotRef.Namespace is immutable - rule: self.__namespace__ == oldSelf.__namespace__ + - message: volumeGroupSnapshotRef is immutable + rule: self == oldSelf required: - deletionPolicy - driver diff --git a/client/config/crd/groupsnapshot.storage.k8s.io_volumegroupsnapshots.yaml b/client/config/crd/groupsnapshot.storage.k8s.io_volumegroupsnapshots.yaml index 04f4653d9..63808011e 100644 --- a/client/config/crd/groupsnapshot.storage.k8s.io_volumegroupsnapshots.yaml +++ b/client/config/crd/groupsnapshot.storage.k8s.io_volumegroupsnapshots.yaml @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - api-approved.kubernetes.io: "https://github.com/kubernetes-csi/external-snapshotter/pull/814" + api-approved.kubernetes.io: "https://github.com/kubernetes-csi/external-snapshotter/pull/995" controller-gen.kubebuilder.io/version: v0.15.0 name: volumegroupsnapshots.groupsnapshot.storage.k8s.io spec: @@ -132,7 +132,7 @@ spec: type: object x-kubernetes-map-type: atomic x-kubernetes-validations: - - message: Spec.Source.Selector is immutable + - message: selector is immutable rule: self == oldSelf volumeGroupSnapshotContentName: description: |- @@ -143,7 +143,7 @@ spec: This field is immutable. type: string x-kubernetes-validations: - - message: Spec.Source.VolumeGroupSnapshotContentName is immutable + - message: volumeGroupSnapshotContentName is immutable rule: self == oldSelf type: object x-kubernetes-validations: @@ -151,6 +151,10 @@ spec: rule: '!has(oldSelf.selector) || has(self.selector)' - message: volumeGroupSnapshotContentName is required once set rule: '!has(oldSelf.volumeGroupSnapshotContentName) || has(self.volumeGroupSnapshotContentName)' + - message: exactly one of selector and volumeGroupSnapshotContentName + must be set + rule: (has(self.selector) && !has(self.volumeGroupSnapshotContentName)) + || (!has(self.selector) && has(self.volumeGroupSnapshotContentName)) volumeGroupSnapshotClassName: description: |- VolumeGroupSnapshotClassName is the name of the VolumeGroupSnapshotClass @@ -160,7 +164,7 @@ spec: Empty string is not allowed for this field. type: string x-kubernetes-validations: - - message: VolumeGroupSnapshotClassName must not be the empty string + - message: volumeGroupSnapshotClassName must not be the empty string when set rule: size(self) > 0 required: diff --git a/client/config/crd/snapshot.storage.k8s.io_volumesnapshotclasses.yaml b/client/config/crd/snapshot.storage.k8s.io_volumesnapshotclasses.yaml index 453f075c0..8164952a4 100644 --- a/client/config/crd/snapshot.storage.k8s.io_volumesnapshotclasses.yaml +++ b/client/config/crd/snapshot.storage.k8s.io_volumesnapshotclasses.yaml @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - api-approved.kubernetes.io: "https://github.com/kubernetes-csi/external-snapshotter/pull/955" + api-approved.kubernetes.io: "https://github.com/kubernetes-csi/external-snapshotter/pull/814" controller-gen.kubebuilder.io/version: v0.15.0 name: volumesnapshotclasses.snapshot.storage.k8s.io spec: diff --git a/client/config/crd/snapshot.storage.k8s.io_volumesnapshotcontents.yaml b/client/config/crd/snapshot.storage.k8s.io_volumesnapshotcontents.yaml index 29b36369a..95a6e559b 100644 --- a/client/config/crd/snapshot.storage.k8s.io_volumesnapshotcontents.yaml +++ b/client/config/crd/snapshot.storage.k8s.io_volumesnapshotcontents.yaml @@ -3,8 +3,8 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - api-approved.kubernetes.io: "https://github.com/kubernetes-csi/external-snapshotter/pull/955" controller-gen.kubebuilder.io/version: v0.15.0 + api-approved.kubernetes.io: "https://github.com/kubernetes-csi/external-snapshotter/pull/955" name: volumesnapshotcontents.snapshot.storage.k8s.io spec: group: snapshot.storage.k8s.io @@ -123,7 +123,7 @@ spec: This field is immutable. type: string x-kubernetes-validations: - - message: Spec.Source.SnapshotHandle is immutable + - message: snapshotHandle is immutable rule: self == oldSelf volumeHandle: description: |- @@ -132,7 +132,7 @@ spec: This field is immutable. type: string x-kubernetes-validations: - - message: Spec.Source.VolumeHandle is immutable + - message: volumeHandle is immutable rule: self == oldSelf type: object x-kubernetes-validations: @@ -140,6 +140,10 @@ spec: rule: '!has(oldSelf.volumeHandle) || has(self.volumeHandle)' - message: snapshotHandle is required once set rule: '!has(oldSelf.snapshotHandle) || has(self.snapshotHandle)' + - message: exactly one of volumeHandle and snapshotHandle must be + set + rule: (has(self.volumeHandle) && !has(self.snapshotHandle)) || (!has(self.volumeHandle) + && has(self.snapshotHandle)) sourceVolumeMode: description: |- SourceVolumeMode is the mode of the volume whose snapshot is taken. @@ -149,7 +153,7 @@ spec: This field is an alpha field. type: string x-kubernetes-validations: - - message: Spec.sourceVolumeMode is immutable + - message: sourceVolumeMode is immutable rule: self == oldSelf volumeSnapshotClassName: description: |- diff --git a/client/config/crd/snapshot.storage.k8s.io_volumesnapshots.yaml b/client/config/crd/snapshot.storage.k8s.io_volumesnapshots.yaml index aace4b011..6b96d7082 100644 --- a/client/config/crd/snapshot.storage.k8s.io_volumesnapshots.yaml +++ b/client/config/crd/snapshot.storage.k8s.io_volumesnapshots.yaml @@ -3,8 +3,8 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - api-approved.kubernetes.io: "https://github.com/kubernetes-csi/external-snapshotter/pull/955" controller-gen.kubebuilder.io/version: v0.15.0 + api-approved.kubernetes.io: "https://github.com/kubernetes-csi/external-snapshotter/pull/814" name: volumesnapshots.snapshot.storage.k8s.io spec: group: snapshot.storage.k8s.io @@ -104,7 +104,7 @@ spec: This field is immutable. type: string x-kubernetes-validations: - - message: Spec.Source.PersistentVolumeClaimName is immutable + - message: persistentVolumeClaimName is immutable rule: self == oldSelf volumeSnapshotContentName: description: |- @@ -114,7 +114,7 @@ spec: This field is immutable. type: string x-kubernetes-validations: - - message: Spec.Source.VolumeSnapshotContentName is immutable + - message: volumeSnapshotContentName is immutable rule: self == oldSelf type: object x-kubernetes-validations: @@ -122,6 +122,10 @@ spec: rule: '!has(oldSelf.persistentVolumeClaimName) || has(self.persistentVolumeClaimName)' - message: volumeSnapshotContentName is required once set rule: '!has(oldSelf.volumeSnapshotContentName) || has(self.volumeSnapshotContentName)' + - message: exactly one of volumeSnapshotContentName and persistentVolumeClaimName + must be set + rule: (has(self.volumeSnapshotContentName) && !has(self.persistentVolumeClaimName)) + || (!has(self.volumeSnapshotContentName) && has(self.persistentVolumeClaimName)) volumeSnapshotClassName: description: |- VolumeSnapshotClassName is the name of the VolumeSnapshotClass diff --git a/client/hack/README.md b/client/hack/README.md index db61ed802..ca49e2ba7 100644 --- a/client/hack/README.md +++ b/client/hack/README.md @@ -64,7 +64,7 @@ Follow these steps to update the CRD: * Run ./hack/update-crd.sh from client directory, new yaml files should have been created under ./config/crd/ -* Add api-approved.kubernetes.io annotation value in all yaml files in the metadata section with the PR where the API is approved by the API reviewers. The current approved PR for snapshot v1 API is https://github.com/kubernetes-csi/external-snapshotter/pull/419. Refer to https://github.com/kubernetes/enhancements/pull/1111 for details about this annotation. +* Add api-approved.kubernetes.io annotation value in all yaml files in the metadata section with the PR where the API is approved by the API reviewers. Refer to https://github.com/kubernetes/enhancements/pull/1111 for details about this annotation. * Update the restoreSize property to string in snapshot.storage.k8s.io_volumesnapshots.yaml @@ -104,89 +104,4 @@ Update the restoreSize property to use type string only: ``` -* In `client/config/crd/snapshot.storage.k8s.io_volumesnapshots.yaml`, we need to add the `oneOf` constraint to make sure only one of `persistentVolumeClaimName` and `volumeSnapshotContentName` is specified in the `source` field of the `spec` of `VolumeSnapshot`. - -```bash - source: - description: source specifies where a snapshot will be created from. This field is immutable after creation. Required. - properties: - persistentVolumeClaimName: - description: persistentVolumeClaimName specifies the name of the PersistentVolumeClaim object representing the volume from which a snapshot should be created. This PVC is assumed to be in the same namespace as the VolumeSnapshot object. This field should be set if the snapshot does not exists, and should be created. This field is immutable. - type: string - volumeSnapshotContentName: - description: volumeSnapshotContentName specifies the name of a pre-existing VolumeSnapshotContent object representing an existing volume snapshot. This field should be set if the snapshot already exists. This field is immutable. - type: string - type: object - oneOf: - - required: ["persistentVolumeClaimName"] - - required: ["volumeSnapshotContentName"] - volumeSnapshotClassName: -``` - -* In `client/config/crd/snapshot.storage.k8s.io_volumesnapshotcontents.yaml `, we need to add the `oneOf` constraint to make sure only one of `snapshotHandle` and `volumeHandle` is specified in the `source` field of the `spec` of `VolumeSnapshotContent`. - -```bash - source: - description: source specifies from where a snapshot will be created. This field is immutable after creation. Required. - properties: - snapshotHandle: - description: snapshotHandle specifies the CSI "snapshot_id" of a pre-existing snapshot on the underlying storage system. This field is immutable. - type: string - volumeHandle: - description: volumeHandle specifies the CSI "volume_id" of the volume from which a snapshot should be dynamically taken from. This field is immutable. - type: string - type: object - oneOf: - - required: ["snapshotHandle"] - - required: ["volumeHandle"] - sourceVolumeMode: -``` - -* 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/groupsnapshot.storage.k8s.io_volumegroupsnapshotcontents.yaml `, we need to add the `oneOf` constraint to make sure only one of `volumeHandles` and `groupSnapshotHandles` 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: - groupSnapshotHandles: - description: GroupSnapshotHandles specifies the CSI "group_snapshot_id" - of a pre-existing group snapshot and a list of CSI "snapshot_id" - of pre-existing snapshots on the underlying storage system for - which a Kubernetes object representation was (or should be) - created. This field is immutable. - properties: - volumeGroupSnapshotHandle: - description: VolumeGroupSnapshotHandle specifies the CSI "group_snapshot_id" - of a pre-existing group snapshot on the underlying storage - system for which a Kubernetes object representation was - (or should be) created. This field is immutable. Required. - type: string - volumeSnapshotHandles: - description: VolumeSnapshotHandles is a list of CSI "snapshot_id" - of pre-existing snapshots on the underlying storage system - for which Kubernetes objects representation were (or should - be) created. This field is immutable. Required. - items: - type: string - type: array - required: - - volumeGroupSnapshotHandle - - volumeSnapshotHandles - type: object - volumeHandles: - description: VolumeHandles is a list of volume handles on the - backend to be snapshotted together. It is specified for dynamic - provisioning of the VolumeGroupSnapshot. This field is immutable. - items: - type: string - type: array - type: object - oneOf: - - required: ["volumeHandles"] - - required: ["groupSnapshotHandles"] - volumeGroupSnapshotClassName: -``` +* Add the VolumeSnapshot namespace to the `additionalPrinterColumns` section in `client/config/crd/snapshot.storage.k8s.io_volumesnapshotcontents.yaml`. Refer https://github.com/kubernetes-csi/external-snapshotter/pull/535 for more details.