Skip to content

Commit 3cec46d

Browse files
committed
Merge branch 'master' into dev/update-api
2 parents d273061 + 0932517 commit 3cec46d

File tree

851 files changed

+59696
-22803
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

851 files changed

+59696
-22803
lines changed

.github/workflows/trivy.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ jobs:
1616
- name: Install go
1717
uses: actions/setup-go@v5
1818
with:
19-
go-version: ^1.19
20-
19+
go-version: ^1.22.3
20+
2121
- name: Build images from Dockerfile
2222
run: |
2323
make

Makefile

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,16 @@
1717
CMDS=snapshot-controller csi-snapshotter snapshot-validation-webhook
1818
all: build
1919
include release-tools/build.make
20+
21+
# The test-vendor-client target performs vendor checks in both
22+
# the external-snapshotter module and the client module.
23+
# This target has been added for the following reasons:
24+
# 1. The test-vendor target does not perform vendor checks for the client module.
25+
# 2. The test-vendor target cannot detect if vendor updates have been made in
26+
# the external-snapshotter module when changes are made in the client module.
27+
.PHONY: test-vendor-client
28+
test: test-vendor-client
29+
test-vendor-client:
30+
@ echo; echo "### $@:"
31+
@ cd client && ../release-tools/verify-vendor.sh
32+
@ hack/verify-vendor.sh

client/apis/volumegroupsnapshot/v1alpha1/types.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ type VolumeGroupSnapshotSpec struct {
3636
// class will be used.
3737
// Empty string is not allowed for this field.
3838
// +optional
39+
// +kubebuilder:validation:XValidation:rule="size(self) > 0",message="volumeGroupSnapshotClassName must not be the empty string when set"
3940
VolumeGroupSnapshotClassName *string `json:"volumeGroupSnapshotClassName,omitempty" protobuf:"bytes,2,opt,name=volumeGroupSnapshotClassName"`
4041
}
4142

@@ -44,6 +45,9 @@ type VolumeGroupSnapshotSpec struct {
4445
// object should be used.
4546
// Exactly one of its members must be set.
4647
// 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"
4751
type VolumeGroupSnapshotSource struct {
4852
// Selector is a label query over persistent volume claims that are to be
4953
// grouped together for snapshotting.
@@ -53,6 +57,7 @@ type VolumeGroupSnapshotSource struct {
5357
// Once a VolumeGroupSnapshotContent is created and the sidecar starts to process
5458
// it, the volume list will not change with retries.
5559
// +optional
60+
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="selector is immutable"
5661
Selector *metav1.LabelSelector `json:"selector,omitempty" protobuf:"bytes,1,opt,name=selector"`
5762

5863
// VolumeGroupSnapshotContentName specifies the name of a pre-existing VolumeGroupSnapshotContent
@@ -61,6 +66,7 @@ type VolumeGroupSnapshotSource struct {
6166
// only needs a representation in Kubernetes.
6267
// This field is immutable.
6368
// +optional
69+
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="volumeGroupSnapshotContentName is immutable"
6470
VolumeGroupSnapshotContentName *string `json:"volumeGroupSnapshotContentName,omitempty" protobuf:"bytes,2,opt,name=volumeGroupSnapshotContentName"`
6571
}
6672

@@ -274,6 +280,8 @@ type VolumeGroupSnapshotContentSpec struct {
274280
// VolumeGroupSnapshot object MUST be provided for binding to happen.
275281
// This field is immutable after creation.
276282
// Required.
283+
// +kubebuilder:validation:XValidation:rule="has(self.name) && has(self.__namespace__)",message="both volumeGroupSnapshotRef.name and volumeGroupSnapshotRef.namespace must be set"
284+
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="volumeGroupSnapshotRef is immutable"
277285
VolumeGroupSnapshotRef core_v1.ObjectReference `json:"volumeGroupSnapshotRef" protobuf:"bytes,1,opt,name=volumeGroupSnapshotRef"`
278286

279287
// DeletionPolicy determines whether this VolumeGroupSnapshotContent and the
@@ -366,11 +374,15 @@ type PVVolumeSnapshotContentPair struct {
366374
// VolumeGroupSnapshotContentSource represents the CSI source of a group snapshot.
367375
// Exactly one of its members must be set.
368376
// Members in VolumeGroupSnapshotContentSource are immutable.
377+
// +kubebuilder:validation:XValidation:rule="!has(oldSelf.volumeHandles) || has(self.volumeHandles)", message="volumeHandles is required once set"
378+
// +kubebuilder:validation:XValidation:rule="!has(oldSelf.groupSnapshotHandles) || has(self.groupSnapshotHandles)", message="groupSnapshotHandles is required once set"
379+
// +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"
369380
type VolumeGroupSnapshotContentSource struct {
370381
// VolumeHandles is a list of volume handles on the backend to be snapshotted
371382
// together. It is specified for dynamic provisioning of the VolumeGroupSnapshot.
372383
// This field is immutable.
373384
// +optional
385+
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="volumeHandles is immutable"
374386
VolumeHandles []string `json:"volumeHandles,omitempty" protobuf:"bytes,1,opt,name=volumeHandles"`
375387

376388
// GroupSnapshotHandles specifies the CSI "group_snapshot_id" of a pre-existing
@@ -379,6 +391,7 @@ type VolumeGroupSnapshotContentSource struct {
379391
// representation was (or should be) created.
380392
// This field is immutable.
381393
// +optional
394+
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="groupSnapshotHandles is immutable"
382395
GroupSnapshotHandles *GroupSnapshotHandles `json:"groupSnapshotHandles,omitempty" protobuf:"bytes,2,opt,name=groupSnapshotHandles"`
383396
}
384397

client/apis/volumesnapshot/v1/types.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ type VolumeSnapshotSpec struct {
9191
// CreateSnapshot will fail and generate an event.
9292
// Empty string is not allowed for this field.
9393
// +optional
94+
// +kubebuilder:validation:XValidation:rule="size(self) > 0",message="volumeSnapshotClassName must not be the empty string when set"
9495
VolumeSnapshotClassName *string `json:"volumeSnapshotClassName,omitempty" protobuf:"bytes,2,opt,name=volumeSnapshotClassName"`
9596
}
9697

@@ -99,6 +100,9 @@ type VolumeSnapshotSpec struct {
99100
// object should be used.
100101
// Exactly one of its members must be set.
101102
// 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"
102106
type VolumeSnapshotSource struct {
103107
// persistentVolumeClaimName specifies the name of the PersistentVolumeClaim
104108
// object representing the volume from which a snapshot should be created.
@@ -108,13 +112,15 @@ type VolumeSnapshotSource struct {
108112
// created.
109113
// This field is immutable.
110114
// +optional
115+
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="persistentVolumeClaimName is immutable"
111116
PersistentVolumeClaimName *string `json:"persistentVolumeClaimName,omitempty" protobuf:"bytes,1,opt,name=persistentVolumeClaimName"`
112117

113118
// volumeSnapshotContentName specifies the name of a pre-existing VolumeSnapshotContent
114119
// object representing an existing volume snapshot.
115120
// This field should be set if the snapshot already exists and only needs a representation in Kubernetes.
116121
// This field is immutable.
117122
// +optional
123+
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="volumeSnapshotContentName is immutable"
118124
VolumeSnapshotContentName *string `json:"volumeSnapshotContentName,omitempty" protobuf:"bytes,2,opt,name=volumeSnapshotContentName"`
119125
}
120126

@@ -289,6 +295,7 @@ type VolumeSnapshotContentList struct {
289295
}
290296

291297
// VolumeSnapshotContentSpec is the specification of a VolumeSnapshotContent
298+
// +kubebuilder:validation:XValidation:rule="!has(oldSelf.sourceVolumeMode) || has(self.sourceVolumeMode)", message="sourceVolumeMode is required once set"
292299
type VolumeSnapshotContentSpec struct {
293300
// volumeSnapshotRef specifies the VolumeSnapshot object to which this
294301
// VolumeSnapshotContent object is bound.
@@ -298,6 +305,7 @@ type VolumeSnapshotContentSpec struct {
298305
// VolumeSnapshot object MUST be provided for binding to happen.
299306
// This field is immutable after creation.
300307
// Required.
308+
// +kubebuilder:validation:XValidation:rule="has(self.name) && has(self.__namespace__)",message="both spec.volumeSnapshotRef.name and spec.volumeSnapshotRef.namespace must be set"
301309
VolumeSnapshotRef core_v1.ObjectReference `json:"volumeSnapshotRef" protobuf:"bytes,1,opt,name=volumeSnapshotRef"`
302310

303311
// deletionPolicy determines whether this VolumeSnapshotContent and its physical snapshot on
@@ -340,24 +348,30 @@ type VolumeSnapshotContentSpec struct {
340348
// This field is immutable.
341349
// This field is an alpha field.
342350
// +optional
351+
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="sourceVolumeMode is immutable"
343352
SourceVolumeMode *core_v1.PersistentVolumeMode `json:"sourceVolumeMode" protobuf:"bytes,6,opt,name=sourceVolumeMode"`
344353
}
345354

346355
// VolumeSnapshotContentSource represents the CSI source of a snapshot.
347356
// Exactly one of its members must be set.
348357
// 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"
349361
type VolumeSnapshotContentSource struct {
350362
// volumeHandle specifies the CSI "volume_id" of the volume from which a snapshot
351363
// should be dynamically taken from.
352364
// This field is immutable.
353365
// +optional
366+
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="volumeHandle is immutable"
354367
VolumeHandle *string `json:"volumeHandle,omitempty" protobuf:"bytes,1,opt,name=volumeHandle"`
355368

356369
// snapshotHandle specifies the CSI "snapshot_id" of a pre-existing snapshot on
357370
// the underlying storage system for which a Kubernetes object representation
358371
// was (or should be) created.
359372
// This field is immutable.
360373
// +optional
374+
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="snapshotHandle is immutable"
361375
SnapshotHandle *string `json:"snapshotHandle,omitempty" protobuf:"bytes,2,opt,name=snapshotHandle"`
362376
}
363377

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

Lines changed: 34 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ kind: CustomResourceDefinition
44
metadata:
55
annotations:
66
api-approved.kubernetes.io: "https://github.com/kubernetes-csi/external-snapshotter/pull/814"
7-
controller-gen.kubebuilder.io/version: v0.12.0
8-
creationTimestamp: null
7+
controller-gen.kubebuilder.io/version: v0.15.0
98
name: volumegroupsnapshotclasses.groupsnapshot.storage.k8s.io
109
spec:
1110
group: groupsnapshot.storage.k8s.io
@@ -35,45 +34,56 @@ spec:
3534
name: v1alpha1
3635
schema:
3736
openAPIV3Schema:
38-
description: VolumeGroupSnapshotClass specifies parameters that a underlying
39-
storage system uses when creating a volume group snapshot. A specific VolumeGroupSnapshotClass
40-
is used by specifying its name in a VolumeGroupSnapshot object. VolumeGroupSnapshotClasses
41-
are non-namespaced.
37+
description: |-
38+
VolumeGroupSnapshotClass specifies parameters that a underlying storage system
39+
uses when creating a volume group snapshot. A specific VolumeGroupSnapshotClass
40+
is used by specifying its name in a VolumeGroupSnapshot object.
41+
VolumeGroupSnapshotClasses are non-namespaced.
4242
properties:
4343
apiVersion:
44-
description: 'APIVersion defines the versioned schema of this representation
45-
of an object. Servers should convert recognized schemas to the latest
46-
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
44+
description: |-
45+
APIVersion defines the versioned schema of this representation of an object.
46+
Servers should convert recognized schemas to the latest internal value, and
47+
may reject unrecognized values.
48+
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
4749
type: string
4850
deletionPolicy:
49-
description: DeletionPolicy determines whether a VolumeGroupSnapshotContent
50-
created through the VolumeGroupSnapshotClass should be deleted when
51-
its bound VolumeGroupSnapshot is deleted. Supported values are "Retain"
52-
and "Delete". "Retain" means that the VolumeGroupSnapshotContent and
53-
its physical group snapshot on underlying storage system are kept. "Delete"
54-
means that the VolumeGroupSnapshotContent and its physical group snapshot
55-
on underlying storage system are deleted. Required.
51+
description: |-
52+
DeletionPolicy determines whether a VolumeGroupSnapshotContent created
53+
through the VolumeGroupSnapshotClass should be deleted when its bound
54+
VolumeGroupSnapshot is deleted.
55+
Supported values are "Retain" and "Delete".
56+
"Retain" means that the VolumeGroupSnapshotContent and its physical group
57+
snapshot on underlying storage system are kept.
58+
"Delete" means that the VolumeGroupSnapshotContent and its physical group
59+
snapshot on underlying storage system are deleted.
60+
Required.
5661
enum:
5762
- Delete
5863
- Retain
5964
type: string
6065
driver:
61-
description: Driver is the name of the storage driver expected to handle
62-
this VolumeGroupSnapshotClass. Required.
66+
description: |-
67+
Driver is the name of the storage driver expected to handle this VolumeGroupSnapshotClass.
68+
Required.
6369
type: string
6470
kind:
65-
description: 'Kind is a string value representing the REST resource this
66-
object represents. Servers may infer this from the endpoint the client
67-
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
71+
description: |-
72+
Kind is a string value representing the REST resource this object represents.
73+
Servers may infer this from the endpoint the client submits requests to.
74+
Cannot be updated.
75+
In CamelCase.
76+
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
6877
type: string
6978
metadata:
7079
type: object
7180
parameters:
7281
additionalProperties:
7382
type: string
74-
description: Parameters is a key-value map with storage driver specific
75-
parameters for creating group snapshots. These values are opaque to
76-
Kubernetes and are passed directly to the driver.
83+
description: |-
84+
Parameters is a key-value map with storage driver specific parameters for
85+
creating group snapshots.
86+
These values are opaque to Kubernetes and are passed directly to the driver.
7787
type: object
7888
required:
7989
- deletionPolicy

0 commit comments

Comments
 (0)