Skip to content

Commit 895a10c

Browse files
committed
Update manifests
1 parent 2641e27 commit 895a10c

6 files changed

+38
-109
lines changed

client/config/crd/groupsnapshot.storage.k8s.io_volumegroupsnapshotcontents.yaml

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
33
kind: CustomResourceDefinition
44
metadata:
55
annotations:
6-
api-approved.kubernetes.io: "https://github.com/kubernetes-csi/external-snapshotter/pull/814"
6+
api-approved.kubernetes.io: "https://github.com/kubernetes-csi/external-snapshotter/pull/971"
77
controller-gen.kubebuilder.io/version: v0.15.0
88
name: volumegroupsnapshotcontents.groupsnapshot.storage.k8s.io
99
spec:
@@ -148,7 +148,7 @@ spec:
148148
- volumeSnapshotHandles
149149
type: object
150150
x-kubernetes-validations:
151-
- message: Spec.Source.GroupSnapshotHandles is immutable
151+
- message: groupSnapshotHandles is immutable
152152
rule: self == oldSelf
153153
volumeHandles:
154154
description: |-
@@ -159,14 +159,18 @@ spec:
159159
type: string
160160
type: array
161161
x-kubernetes-validations:
162-
- message: Spec.Source.VolumeHandle is immutable
162+
- message: volumeHandles is immutable
163163
rule: self == oldSelf
164164
type: object
165165
x-kubernetes-validations:
166-
- message: volumeHandle is required once set
167-
rule: '!has(oldSelf.volumeHandle) || has(self.volumeHandle)'
166+
- message: volumeHandles is required once set
167+
rule: '!has(oldSelf.volumeHandles) || has(self.volumeHandles)'
168168
- message: groupSnapshotHandles is required once set
169169
rule: '!has(oldSelf.groupSnapshotHandles) || has(self.groupSnapshotHandles)'
170+
- message: exactly one of volumeHandles and groupSnapshotHandles must
171+
be set
172+
rule: (has(self.volumeHandles) && !has(self.groupSnapshotHandles))
173+
|| (!has(self.volumeHandles) && has(self.groupSnapshotHandles))
170174
volumeGroupSnapshotClassName:
171175
description: |-
172176
VolumeGroupSnapshotClassName is the name of the VolumeGroupSnapshotClass from
@@ -230,13 +234,11 @@ spec:
230234
type: object
231235
x-kubernetes-map-type: atomic
232236
x-kubernetes-validations:
233-
- message: both Spec.VolumeGroupSnapshotRef.Name and Spec.VolumeGroupSnapshotRef.Namespace
237+
- message: both volumeGroupSnapshotRef.name and volumeGroupSnapshotRef.namespace
234238
must be set
235239
rule: has(self.name) && has(self.__namespace__)
236-
- message: Spec.VolumeGroupSnapshotRef.Name is immutable
237-
rule: self.name == oldSelf.name
238-
- message: Spec.VolumeGroupSnapshotRef.Namespace is immutable
239-
rule: self.__namespace__ == oldSelf.__namespace__
240+
- message: volumeGroupSnapshotRef is immutable
241+
rule: self == oldSelf
240242
required:
241243
- deletionPolicy
242244
- driver

client/config/crd/groupsnapshot.storage.k8s.io_volumegroupsnapshots.yaml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
33
kind: CustomResourceDefinition
44
metadata:
55
annotations:
6-
api-approved.kubernetes.io: "https://github.com/kubernetes-csi/external-snapshotter/pull/814"
6+
api-approved.kubernetes.io: "https://github.com/kubernetes-csi/external-snapshotter/pull/995"
77
controller-gen.kubebuilder.io/version: v0.15.0
88
name: volumegroupsnapshots.groupsnapshot.storage.k8s.io
99
spec:
@@ -132,7 +132,7 @@ spec:
132132
type: object
133133
x-kubernetes-map-type: atomic
134134
x-kubernetes-validations:
135-
- message: Spec.Source.Selector is immutable
135+
- message: selector is immutable
136136
rule: self == oldSelf
137137
volumeGroupSnapshotContentName:
138138
description: |-
@@ -143,14 +143,18 @@ spec:
143143
This field is immutable.
144144
type: string
145145
x-kubernetes-validations:
146-
- message: Spec.Source.VolumeGroupSnapshotContentName is immutable
146+
- message: volumeGroupSnapshotContentName is immutable
147147
rule: self == oldSelf
148148
type: object
149149
x-kubernetes-validations:
150150
- message: selector is required once set
151151
rule: '!has(oldSelf.selector) || has(self.selector)'
152152
- message: volumeGroupSnapshotContentName is required once set
153153
rule: '!has(oldSelf.volumeGroupSnapshotContentName) || has(self.volumeGroupSnapshotContentName)'
154+
- message: exactly one of selector and volumeGroupSnapshotContentName
155+
must be set
156+
rule: (has(self.selector) && !has(self.volumeGroupSnapshotContentName))
157+
|| (!has(self.selector) && has(self.volumeGroupSnapshotContentName))
154158
volumeGroupSnapshotClassName:
155159
description: |-
156160
VolumeGroupSnapshotClassName is the name of the VolumeGroupSnapshotClass
@@ -160,7 +164,7 @@ spec:
160164
Empty string is not allowed for this field.
161165
type: string
162166
x-kubernetes-validations:
163-
- message: VolumeGroupSnapshotClassName must not be the empty string
167+
- message: volumeGroupSnapshotClassName must not be the empty string
164168
when set
165169
rule: size(self) > 0
166170
required:

client/config/crd/snapshot.storage.k8s.io_volumesnapshotclasses.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
33
kind: CustomResourceDefinition
44
metadata:
55
annotations:
6-
api-approved.kubernetes.io: "https://github.com/kubernetes-csi/external-snapshotter/pull/955"
6+
api-approved.kubernetes.io: "https://github.com/kubernetes-csi/external-snapshotter/pull/814"
77
controller-gen.kubebuilder.io/version: v0.15.0
88
name: volumesnapshotclasses.snapshot.storage.k8s.io
99
spec:

client/config/crd/snapshot.storage.k8s.io_volumesnapshotcontents.yaml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ apiVersion: apiextensions.k8s.io/v1
33
kind: CustomResourceDefinition
44
metadata:
55
annotations:
6-
api-approved.kubernetes.io: "https://github.com/kubernetes-csi/external-snapshotter/pull/955"
76
controller-gen.kubebuilder.io/version: v0.15.0
7+
api-approved.kubernetes.io: "https://github.com/kubernetes-csi/external-snapshotter/pull/955"
88
name: volumesnapshotcontents.snapshot.storage.k8s.io
99
spec:
1010
group: snapshot.storage.k8s.io
@@ -123,7 +123,7 @@ spec:
123123
This field is immutable.
124124
type: string
125125
x-kubernetes-validations:
126-
- message: Spec.Source.SnapshotHandle is immutable
126+
- message: snapshotHandle is immutable
127127
rule: self == oldSelf
128128
volumeHandle:
129129
description: |-
@@ -132,14 +132,18 @@ spec:
132132
This field is immutable.
133133
type: string
134134
x-kubernetes-validations:
135-
- message: Spec.Source.VolumeHandle is immutable
135+
- message: volumeHandle is immutable
136136
rule: self == oldSelf
137137
type: object
138138
x-kubernetes-validations:
139139
- message: volumeHandle is required once set
140140
rule: '!has(oldSelf.volumeHandle) || has(self.volumeHandle)'
141141
- message: snapshotHandle is required once set
142142
rule: '!has(oldSelf.snapshotHandle) || has(self.snapshotHandle)'
143+
- message: exactly one of volumeHandle and snapshotHandle must be
144+
set
145+
rule: (has(self.volumeHandle) && !has(self.snapshotHandle)) || (!has(self.volumeHandle)
146+
&& has(self.snapshotHandle))
143147
sourceVolumeMode:
144148
description: |-
145149
SourceVolumeMode is the mode of the volume whose snapshot is taken.
@@ -149,7 +153,7 @@ spec:
149153
This field is an alpha field.
150154
type: string
151155
x-kubernetes-validations:
152-
- message: Spec.sourceVolumeMode is immutable
156+
- message: sourceVolumeMode is immutable
153157
rule: self == oldSelf
154158
volumeSnapshotClassName:
155159
description: |-

client/config/crd/snapshot.storage.k8s.io_volumesnapshots.yaml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ apiVersion: apiextensions.k8s.io/v1
33
kind: CustomResourceDefinition
44
metadata:
55
annotations:
6-
api-approved.kubernetes.io: "https://github.com/kubernetes-csi/external-snapshotter/pull/955"
76
controller-gen.kubebuilder.io/version: v0.15.0
7+
api-approved.kubernetes.io: "https://github.com/kubernetes-csi/external-snapshotter/pull/814"
88
name: volumesnapshots.snapshot.storage.k8s.io
99
spec:
1010
group: snapshot.storage.k8s.io
@@ -104,7 +104,7 @@ spec:
104104
This field is immutable.
105105
type: string
106106
x-kubernetes-validations:
107-
- message: Spec.Source.PersistentVolumeClaimName is immutable
107+
- message: persistentVolumeClaimName is immutable
108108
rule: self == oldSelf
109109
volumeSnapshotContentName:
110110
description: |-
@@ -114,14 +114,18 @@ spec:
114114
This field is immutable.
115115
type: string
116116
x-kubernetes-validations:
117-
- message: Spec.Source.VolumeSnapshotContentName is immutable
117+
- message: volumeSnapshotContentName is immutable
118118
rule: self == oldSelf
119119
type: object
120120
x-kubernetes-validations:
121121
- message: persistentVolumeClaimName is required once set
122122
rule: '!has(oldSelf.persistentVolumeClaimName) || has(self.persistentVolumeClaimName)'
123123
- message: volumeSnapshotContentName is required once set
124124
rule: '!has(oldSelf.volumeSnapshotContentName) || has(self.volumeSnapshotContentName)'
125+
- message: exactly one of volumeSnapshotContentName and persistentVolumeClaimName
126+
must be set
127+
rule: (has(self.volumeSnapshotContentName) && !has(self.persistentVolumeClaimName))
128+
|| (!has(self.volumeSnapshotContentName) && has(self.persistentVolumeClaimName))
125129
volumeSnapshotClassName:
126130
description: |-
127131
VolumeSnapshotClassName is the name of the VolumeSnapshotClass

client/hack/README.md

Lines changed: 2 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ Follow these steps to update the CRD:
6464

6565
* Run ./hack/update-crd.sh from client directory, new yaml files should have been created under ./config/crd/
6666

67-
* 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.
67+
* 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.
6868

6969
* Update the restoreSize property to string in snapshot.storage.k8s.io_volumesnapshots.yaml
7070

@@ -104,89 +104,4 @@ Update the restoreSize property to use type string only:
104104
105105
```
106106
107-
* 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`.
108-
109-
```bash
110-
source:
111-
description: source specifies where a snapshot will be created from. This field is immutable after creation. Required.
112-
properties:
113-
persistentVolumeClaimName:
114-
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.
115-
type: string
116-
volumeSnapshotContentName:
117-
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.
118-
type: string
119-
type: object
120-
oneOf:
121-
- required: ["persistentVolumeClaimName"]
122-
- required: ["volumeSnapshotContentName"]
123-
volumeSnapshotClassName:
124-
```
125-
126-
* 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`.
127-
128-
```bash
129-
source:
130-
description: source specifies from where a snapshot will be created. This field is immutable after creation. Required.
131-
properties:
132-
snapshotHandle:
133-
description: snapshotHandle specifies the CSI "snapshot_id" of a pre-existing snapshot on the underlying storage system. This field is immutable.
134-
type: string
135-
volumeHandle:
136-
description: volumeHandle specifies the CSI "volume_id" of the volume from which a snapshot should be dynamically taken from. This field is immutable.
137-
type: string
138-
type: object
139-
oneOf:
140-
- required: ["snapshotHandle"]
141-
- required: ["volumeHandle"]
142-
sourceVolumeMode:
143-
```
144-
145-
* Add the VolumeSnapshot namespace to the `additionalPrinterColumns` section. Refer https://github.com/kubernetes-csi/external-snapshotter/pull/535 for more details.
146-
147-
* 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`.
148-
149-
```bash
150-
source:
151-
description: Source specifies whether the snapshot is (or should be)
152-
dynamically provisioned or already exists, and just requires a Kubernetes
153-
object representation. This field is immutable after creation. Required.
154-
properties:
155-
groupSnapshotHandles:
156-
description: GroupSnapshotHandles specifies the CSI "group_snapshot_id"
157-
of a pre-existing group snapshot and a list of CSI "snapshot_id"
158-
of pre-existing snapshots on the underlying storage system for
159-
which a Kubernetes object representation was (or should be)
160-
created. This field is immutable.
161-
properties:
162-
volumeGroupSnapshotHandle:
163-
description: VolumeGroupSnapshotHandle specifies the CSI "group_snapshot_id"
164-
of a pre-existing group snapshot on the underlying storage
165-
system for which a Kubernetes object representation was
166-
(or should be) created. This field is immutable. Required.
167-
type: string
168-
volumeSnapshotHandles:
169-
description: VolumeSnapshotHandles is a list of CSI "snapshot_id"
170-
of pre-existing snapshots on the underlying storage system
171-
for which Kubernetes objects representation were (or should
172-
be) created. This field is immutable. Required.
173-
items:
174-
type: string
175-
type: array
176-
required:
177-
- volumeGroupSnapshotHandle
178-
- volumeSnapshotHandles
179-
type: object
180-
volumeHandles:
181-
description: VolumeHandles is a list of volume handles on the
182-
backend to be snapshotted together. It is specified for dynamic
183-
provisioning of the VolumeGroupSnapshot. This field is immutable.
184-
items:
185-
type: string
186-
type: array
187-
type: object
188-
oneOf:
189-
- required: ["volumeHandles"]
190-
- required: ["groupSnapshotHandles"]
191-
volumeGroupSnapshotClassName:
192-
```
107+
* 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 commit comments

Comments
 (0)