Skip to content

Commit bffa5ae

Browse files
committed
Update to API for static group volume snapshots
1 parent b44a6b0 commit bffa5ae

File tree

4 files changed

+72
-15
lines changed

4 files changed

+72
-15
lines changed

client/apis/volumegroupsnapshot/v1alpha1/types.go

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -354,10 +354,27 @@ type VolumeGroupSnapshotContentSource struct {
354354
// +optional
355355
PersistentVolumeNames []string `json:"persistentVolumeNames,omitempty" protobuf:"bytes,1,opt,name=persistentVolumeNames"`
356356

357+
// GroupSnapshotHandleSource specifies the CSI "group_snapshot_id" of a pre-existing
358+
// group snapshot and a list of CSI "snapshot_id" of pre-existing snapshots
359+
// on the underlying storage system for which a Kubernetes object
360+
// representation was (or should be) created.
361+
// This field is immutable.
362+
// +optional
363+
GroupSnapshotHandleSource *VolumeGroupSnapshotHandleSource `json:"groupSnapshotHandleSource,omitempty" protobuf:"bytes,2,opt,name=groupSnapshotHandleSource"`
364+
}
365+
366+
type VolumeGroupSnapshotHandleSource struct {
357367
// VolumeGroupSnapshotHandle specifies the CSI "group_snapshot_id" of a pre-existing
358368
// group snapshot on the underlying storage system for which a Kubernetes object
359369
// representation was (or should be) created.
360370
// This field is immutable.
361-
// +optional
362-
VolumeGroupSnapshotHandle *string `json:"volumeGroupSnapshotHandle,omitempty" protobuf:"bytes,2,opt,name=volumeGroupSnapshotHandle"`
371+
// Required.
372+
VolumeGroupSnapshotHandle string `json:"volumeGroupSnapshotHandle" protobuf:"bytes,1,opt,name=volumeGroupSnapshotHandle"`
373+
374+
// VolumeSnapshotHandles is a list of CSI "snapshot_id" of pre-existing
375+
// snapshots on the underlying storage system for which Kubernetes objects
376+
// representation were (or should be) created.
377+
// This field is immutable.
378+
// Required.
379+
VolumeSnapshotHandles []string `json:"volumeSnapshotHandles" protobuf:"bytes,2,opt,name=volumeSnapshotHandles"`
363380
}

client/apis/volumegroupsnapshot/v1alpha1/zz_generated.deepcopy.go

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

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

Lines changed: 27 additions & 8 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.12.0
88
creationTimestamp: null
99
name: volumegroupsnapshotcontents.groupsnapshot.storage.k8s.io
@@ -104,23 +104,42 @@ spec:
104104
dynamically provisioned or already exists, and just requires a Kubernetes
105105
object representation. This field is immutable after creation. Required.
106106
properties:
107+
groupSnapshotHandleSource:
108+
description: GroupSnapshotHandleSource specifies the CSI "group_snapshot_id"
109+
of a pre-existing group snapshot and a list of CSI "snapshot_id"
110+
of pre-existing snapshots on the underlying storage system for
111+
which a Kubernetes object representation was (or should be)
112+
created. This field is immutable.
113+
properties:
114+
volumeGroupSnapshotHandle:
115+
description: VolumeGroupSnapshotHandle specifies the CSI "group_snapshot_id"
116+
of a pre-existing group snapshot on the underlying storage
117+
system for which a Kubernetes object representation was
118+
(or should be) created. This field is immutable. Required.
119+
type: string
120+
volumeSnapshotHandles:
121+
description: VolumeSnapshotHandles is a list of CSI "snapshot_id"
122+
of pre-existing snapshots on the underlying storage system
123+
for which Kubernetes objects representation were (or should
124+
be) created. This field is immutable. Required.
125+
items:
126+
type: string
127+
type: array
128+
required:
129+
- volumeGroupSnapshotHandle
130+
- volumeSnapshotHandles
131+
type: object
107132
persistentVolumeNames:
108133
description: PersistentVolumeNames is a list of names of PersistentVolumes
109134
to be snapshotted together. It is specified for dynamic provisioning
110135
of the VolumeGroupSnapshot. This field is immutable.
111136
items:
112137
type: string
113138
type: array
114-
volumeGroupSnapshotHandle:
115-
description: VolumeGroupSnapshotHandle specifies the CSI "group_snapshot_id"
116-
of a pre-existing group snapshot on the underlying storage system
117-
for which a Kubernetes object representation was (or should
118-
be) created. This field is immutable.
119-
type: string
120139
type: object
121140
oneOf:
122141
- required: ["persistentVolumeNames"]
123-
- required: ["volumeGroupSnapshotHandle"]
142+
- required: ["groupSnapshotHandleSource"]
124143
volumeGroupSnapshotClassName:
125144
description: VolumeGroupSnapshotClassName is the name of the VolumeGroupSnapshotClass
126145
from which this group snapshot was (or will be) created. Note that

pkg/common-controller/groupsnapshot_controller_helper.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1161,7 +1161,7 @@ func (ctrl *csiSnapshotCommonController) processGroupSnapshotWithDeletionTimesta
11611161
// Delete the individual snapshots part of the group snapshot
11621162
for _, snapshot := range groupSnapshot.Status.VolumeSnapshotRefList {
11631163
err := ctrl.clientset.SnapshotV1().VolumeSnapshots(snapshot.Namespace).Delete(context.TODO(), snapshot.Name, metav1.DeleteOptions{})
1164-
if err != nil {
1164+
if err != nil && !apierrs.IsNotFound(err) {
11651165
msg := fmt.Sprintf("failed to delete snapshot API object %s/%s part of group snapshot %s: %v", snapshot.Namespace, snapshot.Name, utils.GroupSnapshotKey(groupSnapshot), err)
11661166
klog.Error(msg)
11671167
ctrl.eventRecorder.Event(groupSnapshot, v1.EventTypeWarning, "SnapshotDeleteError", msg)

0 commit comments

Comments
 (0)