You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -44,6 +45,9 @@ type VolumeGroupSnapshotSpec struct {
44
45
// object should be used.
45
46
// Exactly one of its members must be set.
46
47
// Members in VolumeGroupSnapshotSource are immutable.
48
+
// +kubebuilder:validation:XValidation:rule="!has(oldSelf.selector) || has(self.selector)", message="selector is required once set"
49
+
// +kubebuilder:validation:XValidation:rule="!has(oldSelf.volumeGroupSnapshotContentName) || has(self.volumeGroupSnapshotContentName)", message="volumeGroupSnapshotContentName is required once set"
50
+
// +kubebuilder:validation:XValidation:rule="(has(self.selector) && !has(self.volumeGroupSnapshotContentName)) || (!has(self.selector) && has(self.volumeGroupSnapshotContentName))", message="exactly one of selector and volumeGroupSnapshotContentName must be set"
47
51
typeVolumeGroupSnapshotSourcestruct {
48
52
// Selector is a label query over persistent volume claims that are to be
49
53
// grouped together for snapshotting.
@@ -53,6 +57,7 @@ type VolumeGroupSnapshotSource struct {
53
57
// Once a VolumeGroupSnapshotContent is created and the sidecar starts to process
54
58
// it, the volume list will not change with retries.
55
59
// +optional
60
+
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="selector is immutable"
@@ -265,6 +271,8 @@ type VolumeGroupSnapshotContentSpec struct {
265
271
// VolumeGroupSnapshot object MUST be provided for binding to happen.
266
272
// This field is immutable after creation.
267
273
// Required.
274
+
// +kubebuilder:validation:XValidation:rule="has(self.name) && has(self.__namespace__)",message="both volumeGroupSnapshotRef.name and volumeGroupSnapshotRef.namespace must be set"
275
+
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="volumeGroupSnapshotRef is immutable"
// DeletionPolicy determines whether this VolumeGroupSnapshotContent and the
@@ -347,11 +355,15 @@ type VolumeGroupSnapshotContentStatus struct {
347
355
// VolumeGroupSnapshotContentSource represents the CSI source of a group snapshot.
348
356
// Exactly one of its members must be set.
349
357
// Members in VolumeGroupSnapshotContentSource are immutable.
358
+
// +kubebuilder:validation:XValidation:rule="!has(oldSelf.volumeHandles) || has(self.volumeHandles)", message="volumeHandles is required once set"
359
+
// +kubebuilder:validation:XValidation:rule="!has(oldSelf.groupSnapshotHandles) || has(self.groupSnapshotHandles)", message="groupSnapshotHandles is required once set"
360
+
// +kubebuilder:validation:XValidation:rule="(has(self.volumeHandles) && !has(self.groupSnapshotHandles)) || (!has(self.volumeHandles) && has(self.groupSnapshotHandles))", message="exactly one of volumeHandles and groupSnapshotHandles must be set"
350
361
typeVolumeGroupSnapshotContentSourcestruct {
351
362
// VolumeHandles is a list of volume handles on the backend to be snapshotted
352
363
// together. It is specified for dynamic provisioning of the VolumeGroupSnapshot.
353
364
// This field is immutable.
354
365
// +optional
366
+
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="volumeHandles is immutable"
@@ -99,6 +100,9 @@ type VolumeSnapshotSpec struct {
99
100
// object should be used.
100
101
// Exactly one of its members must be set.
101
102
// Members in VolumeSnapshotSource are immutable.
103
+
// +kubebuilder:validation:XValidation:rule="!has(oldSelf.persistentVolumeClaimName) || has(self.persistentVolumeClaimName)", message="persistentVolumeClaimName is required once set"
104
+
// +kubebuilder:validation:XValidation:rule="!has(oldSelf.volumeSnapshotContentName) || has(self.volumeSnapshotContentName)", message="volumeSnapshotContentName is required once set"
105
+
// +kubebuilder:validation:XValidation:rule="(has(self.volumeSnapshotContentName) && !has(self.persistentVolumeClaimName)) || (!has(self.volumeSnapshotContentName) && has(self.persistentVolumeClaimName))", message="exactly one of volumeSnapshotContentName and persistentVolumeClaimName must be set"
102
106
typeVolumeSnapshotSourcestruct {
103
107
// persistentVolumeClaimName specifies the name of the PersistentVolumeClaim
104
108
// object representing the volume from which a snapshot should be created.
@@ -108,13 +112,15 @@ type VolumeSnapshotSource struct {
108
112
// created.
109
113
// This field is immutable.
110
114
// +optional
115
+
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="persistentVolumeClaimName is immutable"
@@ -289,6 +295,7 @@ type VolumeSnapshotContentList struct {
289
295
}
290
296
291
297
// VolumeSnapshotContentSpec is the specification of a VolumeSnapshotContent
298
+
// +kubebuilder:validation:XValidation:rule="!has(oldSelf.sourceVolumeMode) || has(self.sourceVolumeMode)", message="sourceVolumeMode is required once set"
292
299
typeVolumeSnapshotContentSpecstruct {
293
300
// volumeSnapshotRef specifies the VolumeSnapshot object to which this
294
301
// VolumeSnapshotContent object is bound.
@@ -298,6 +305,7 @@ type VolumeSnapshotContentSpec struct {
298
305
// VolumeSnapshot object MUST be provided for binding to happen.
299
306
// This field is immutable after creation.
300
307
// Required.
308
+
// +kubebuilder:validation:XValidation:rule="has(self.name) && has(self.__namespace__)",message="both spec.volumeSnapshotRef.name and spec.volumeSnapshotRef.namespace must be set"
// VolumeSnapshotContentSource represents the CSI source of a snapshot.
347
356
// Exactly one of its members must be set.
348
357
// Members in VolumeSnapshotContentSource are immutable.
358
+
// +kubebuilder:validation:XValidation:rule="!has(oldSelf.volumeHandle) || has(self.volumeHandle)", message="volumeHandle is required once set"
359
+
// +kubebuilder:validation:XValidation:rule="!has(oldSelf.snapshotHandle) || has(self.snapshotHandle)", message="snapshotHandle is required once set"
360
+
// +kubebuilder:validation:XValidation:rule="(has(self.volumeHandle) && !has(self.snapshotHandle)) || (!has(self.volumeHandle) && has(self.snapshotHandle))", message="exactly one of volumeHandle and snapshotHandle must be set"
349
361
typeVolumeSnapshotContentSourcestruct {
350
362
// volumeHandle specifies the CSI "volume_id" of the volume from which a snapshot
351
363
// should be dynamically taken from.
352
364
// This field is immutable.
353
365
// +optional
366
+
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="volumeHandle is immutable"
0 commit comments