Skip to content

Commit 119cfa7

Browse files
committed
Address API review comments
Signed-off-by: Leonardo Cecchi <[email protected]>
1 parent 20bb89a commit 119cfa7

File tree

5 files changed

+48
-28
lines changed

5 files changed

+48
-28
lines changed

client/apis/volumegroupsnapshot/v1beta2/types.go

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -80,16 +80,14 @@ type VolumeGroupSnapshotStatus struct {
8080
// VolumeGroupSnapshot and VolumeGroupSnapshotContent objects is successful
8181
// (by validating that both VolumeGroupSnapshot and VolumeGroupSnapshotContent
8282
// point at each other) before using this object.
83+
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="boundVolumeGroupSnapshotContentName is immutable once set"
8384
// +optional
8485
BoundVolumeGroupSnapshotContentName *string `json:"boundVolumeGroupSnapshotContentName,omitempty" protobuf:"bytes,1,opt,name=boundVolumeGroupSnapshotContentName"`
8586

8687
// CreationTime is the timestamp when the point-in-time group snapshot is taken
8788
// by the underlying storage system.
8889
// If not specified, it may indicate that the creation time of the group snapshot
8990
// is unknown.
90-
// The format of this field is a Unix nanoseconds time encoded as an int64.
91-
// On Unix, the command date +%s%N returns the current time in nanoseconds
92-
// since 1970-01-01 00:00:00 UTC.
9391
// This field is updated based on the CreationTime field in VolumeGroupSnapshotContentStatus
9492
// +optional
9593
CreationTime *metav1.Time `json:"creationTime,omitempty" protobuf:"bytes,2,opt,name=creationTime"`
@@ -177,11 +175,13 @@ type VolumeGroupSnapshotClass struct {
177175

178176
// Driver is the name of the storage driver expected to handle this VolumeGroupSnapshotClass.
179177
// Required.
178+
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="driver is immutable once set"
180179
Driver string `json:"driver" protobuf:"bytes,2,opt,name=driver"`
181180

182181
// Parameters is a key-value map with storage driver specific parameters for
183182
// creating group snapshots.
184183
// These values are opaque to Kubernetes and are passed directly to the driver.
184+
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="parameters are immutable once set"
185185
// +optional
186186
Parameters map[string]string `json:"parameters,omitempty" protobuf:"bytes,3,rep,name=parameters"`
187187

@@ -194,6 +194,7 @@ type VolumeGroupSnapshotClass struct {
194194
// "Delete" means that the VolumeGroupSnapshotContent and its physical group
195195
// snapshot on underlying storage system are deleted.
196196
// Required.
197+
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="deletionPolicy is immutable once set"
197198
DeletionPolicy snapshotv1.DeletionPolicy `json:"deletionPolicy" protobuf:"bytes,4,opt,name=deletionPolicy"`
198199
}
199200

@@ -293,6 +294,7 @@ type VolumeGroupSnapshotContentSpec struct {
293294
// This MUST be the same as the name returned by the CSI GetPluginName() call for
294295
// that driver.
295296
// Required.
297+
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="driver is immutable once set"
296298
Driver string `json:"driver" protobuf:"bytes,3,opt,name=driver"`
297299

298300
// VolumeGroupSnapshotClassName is the name of the VolumeGroupSnapshotClass from
@@ -303,6 +305,7 @@ type VolumeGroupSnapshotContentSpec struct {
303305
// For dynamic provisioning, this field must be set.
304306
// This field may be unset for pre-provisioned snapshots.
305307
// +optional
308+
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="volumeGroupSnapshotClassName is immutable once set"
306309
VolumeGroupSnapshotClassName *string `json:"volumeGroupSnapshotClassName,omitempty" protobuf:"bytes,4,opt,name=volumeGroupSnapshotClassName"`
307310

308311
// Source specifies whether the snapshot is (or should be) dynamically provisioned
@@ -344,15 +347,13 @@ type VolumeGroupSnapshotContentStatus struct {
344347
// If a storage system does not provide such an id, the
345348
// CSI driver can choose to return the VolumeGroupSnapshot name.
346349
// +optional
350+
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="volumeGroupSnapshotHandle is immutable once set"
347351
VolumeGroupSnapshotHandle *string `json:"volumeGroupSnapshotHandle,omitempty" protobuf:"bytes,1,opt,name=volumeGroupSnapshotHandle"`
348352

349353
// CreationTime is the timestamp when the point-in-time group snapshot is taken
350354
// by the underlying storage system.
351355
// If not specified, it indicates the creation time is unknown.
352356
// If not specified, it means the readiness of a group snapshot is unknown.
353-
// The format of this field is a Unix nanoseconds time encoded as an int64.
354-
// On Unix, the command date +%s%N returns the current time in nanoseconds
355-
// since 1970-01-01 00:00:00 UTC.
356357
// This field is the source for the CreationTime field in VolumeGroupSnapshotStatus
357358
// +optional
358359
CreationTime *metav1.Time `json:"creationTime,omitempty" protobuf:"bytes,2,opt,name=creationTime"`

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

Lines changed: 11 additions & 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/1150"
6+
api-approved.kubernetes.io: "https://github.com/kubernetes-csi/external-snapshotter/pull/1337"
77
controller-gen.kubebuilder.io/version: v0.15.0
88
name: volumegroupsnapshotclasses.groupsnapshot.storage.k8s.io
99
spec:
@@ -91,6 +91,7 @@ spec:
9191
type: object
9292
served: true
9393
storage: false
94+
deprecated: true
9495
subresources: {}
9596
- additionalPrinterColumns:
9697
- jsonPath: .driver
@@ -136,11 +137,17 @@ spec:
136137
- Delete
137138
- Retain
138139
type: string
140+
x-kubernetes-validations:
141+
- message: deletionPolicy is immutable once set
142+
rule: self == oldSelf
139143
driver:
140144
description: |-
141145
Driver is the name of the storage driver expected to handle this VolumeGroupSnapshotClass.
142146
Required.
143147
type: string
148+
x-kubernetes-validations:
149+
- message: driver is immutable once set
150+
rule: self == oldSelf
144151
kind:
145152
description: |-
146153
Kind is a string value representing the REST resource this object represents.
@@ -159,6 +166,9 @@ spec:
159166
creating group snapshots.
160167
These values are opaque to Kubernetes and are passed directly to the driver.
161168
type: object
169+
x-kubernetes-validations:
170+
- message: parameters are immutable once set
171+
rule: self == oldSelf
162172
required:
163173
- deletionPolicy
164174
- driver

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

Lines changed: 18 additions & 11 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/1150"
6+
api-approved.kubernetes.io: "https://github.com/kubernetes-csi/external-snapshotter/pull/1337"
77
controller-gen.kubebuilder.io/version: v0.15.0
88
name: volumegroupsnapshotcontents.groupsnapshot.storage.k8s.io
99
spec:
@@ -329,6 +329,7 @@ spec:
329329
type: object
330330
served: true
331331
storage: false
332+
deprecated: true
332333
subresources:
333334
status: {}
334335
- additionalPrinterColumns:
@@ -423,6 +424,9 @@ spec:
423424
that driver.
424425
Required.
425426
type: string
427+
x-kubernetes-validations:
428+
- message: driver is immutable once set
429+
rule: self == oldSelf
426430
source:
427431
description: |-
428432
Source specifies whether the snapshot is (or should be) dynamically provisioned
@@ -494,6 +498,9 @@ spec:
494498
For dynamic provisioning, this field must be set.
495499
This field may be unset for pre-provisioned snapshots.
496500
type: string
501+
x-kubernetes-validations:
502+
- message: volumeGroupSnapshotClassName is immutable once set
503+
rule: self == oldSelf
497504
volumeGroupSnapshotRef:
498505
description: |-
499506
VolumeGroupSnapshotRef specifies the VolumeGroupSnapshot object to which this
@@ -565,9 +572,6 @@ spec:
565572
by the underlying storage system.
566573
If not specified, it indicates the creation time is unknown.
567574
If not specified, it means the readiness of a group snapshot is unknown.
568-
The format of this field is a Unix nanoseconds time encoded as an int64.
569-
On Unix, the command date +%s%N returns the current time in nanoseconds
570-
since 1970-01-01 00:00:00 UTC.
571575
This field is the source for the CreationTime field in VolumeGroupSnapshotStatus
572576
format: date-time
573577
type: string
@@ -601,6 +605,9 @@ spec:
601605
If a storage system does not provide such an id, the
602606
CSI driver can choose to return the VolumeGroupSnapshot name.
603607
type: string
608+
x-kubernetes-validations:
609+
- message: volumeGroupSnapshotHandle is immutable once set
610+
rule: self == oldSelf
604611
volumeSnapshotInfoList:
605612
description: |-
606613
This field is introduced in v1beta2
@@ -623,19 +630,19 @@ spec:
623630
be used to restore a volume.
624631
type: boolean
625632
restoreSize:
626-
description: RestoreSize represents the complete size of the
627-
snapshot in bytes.
633+
description: |-
634+
RestoreSize represents the minimum size of volume required to create a volume
635+
from this snapshot.
628636
format: int64
629637
type: integer
630638
snapshotHandle:
631-
description: |-
632-
SnapshotHandle is a unique id returned by the CSI driver to identify a volume
633-
snapshot on the storage system
639+
description: SnapshotHandle is the CSI "snapshot_id" of this
640+
snapshot on the underlying storage system.
634641
type: string
635642
volumeHandle:
636643
description: |-
637-
VolumeHandle is a unique id returned by the CSI driver to identify a volume
638-
on the storage system
644+
VolumeHandle specifies the CSI "volume_id" of the volume from which this snapshot
645+
was taken from.
639646
type: string
640647
type: object
641648
type: array

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

Lines changed: 5 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/1150"
6+
api-approved.kubernetes.io: "https://github.com/kubernetes-csi/external-snapshotter/pull/1337"
77
controller-gen.kubebuilder.io/version: v0.15.0
88
name: volumegroupsnapshots.groupsnapshot.storage.k8s.io
99
spec:
@@ -235,6 +235,7 @@ spec:
235235
type: object
236236
served: true
237237
storage: false
238+
deprecated: true
238239
subresources:
239240
status: {}
240241
- additionalPrinterColumns:
@@ -409,15 +410,15 @@ spec:
409410
(by validating that both VolumeGroupSnapshot and VolumeGroupSnapshotContent
410411
point at each other) before using this object.
411412
type: string
413+
x-kubernetes-validations:
414+
- message: boundVolumeGroupSnapshotContentName is immutable once set
415+
rule: self == oldSelf
412416
creationTime:
413417
description: |-
414418
CreationTime is the timestamp when the point-in-time group snapshot is taken
415419
by the underlying storage system.
416420
If not specified, it may indicate that the creation time of the group snapshot
417421
is unknown.
418-
The format of this field is a Unix nanoseconds time encoded as an int64.
419-
On Unix, the command date +%s%N returns the current time in nanoseconds
420-
since 1970-01-01 00:00:00 UTC.
421422
This field is updated based on the CreationTime field in VolumeGroupSnapshotContentStatus
422423
format: date-time
423424
type: string

vendor/github.com/kubernetes-csi/external-snapshotter/client/v8/apis/volumegroupsnapshot/v1beta2/types.go

Lines changed: 7 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)