Skip to content

Commit

Permalink
Update manifests
Browse files Browse the repository at this point in the history
  • Loading branch information
xing-yang committed May 7, 2024
1 parent 2641e27 commit 895a10c
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 109 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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: |-
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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: |-
Expand All @@ -143,14 +143,18 @@ 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:
- message: selector is required once set
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
Expand All @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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: |-
Expand All @@ -132,14 +132,18 @@ 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:
- message: volumeHandle is required once set
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.
Expand All @@ -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: |-
Expand Down
10 changes: 7 additions & 3 deletions client/config/crd/snapshot.storage.k8s.io_volumesnapshots.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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: |-
Expand All @@ -114,14 +114,18 @@ 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:
- message: persistentVolumeClaimName is required once set
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
Expand Down
89 changes: 2 additions & 87 deletions client/hack/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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.

0 comments on commit 895a10c

Please sign in to comment.