Update to API for static group volume snapshots
This commit is contained in:
@@ -354,10 +354,27 @@ type VolumeGroupSnapshotContentSource struct {
|
||||
// +optional
|
||||
PersistentVolumeNames []string `json:"persistentVolumeNames,omitempty" protobuf:"bytes,1,opt,name=persistentVolumeNames"`
|
||||
|
||||
// GroupSnapshotHandleSource specifies the CSI "group_snapshot_id" of a pre-existing
|
||||
// group snapshot and a list of CSI "snapshot_id" of pre-existing snapshots
|
||||
// on the underlying storage system for which a Kubernetes object
|
||||
// representation was (or should be) created.
|
||||
// This field is immutable.
|
||||
// +optional
|
||||
GroupSnapshotHandleSource *VolumeGroupSnapshotHandleSource `json:"groupSnapshotHandleSource,omitempty" protobuf:"bytes,2,opt,name=groupSnapshotHandleSource"`
|
||||
}
|
||||
|
||||
type VolumeGroupSnapshotHandleSource struct {
|
||||
// VolumeGroupSnapshotHandle specifies the CSI "group_snapshot_id" of a pre-existing
|
||||
// group snapshot on the underlying storage system for which a Kubernetes object
|
||||
// representation was (or should be) created.
|
||||
// This field is immutable.
|
||||
// +optional
|
||||
VolumeGroupSnapshotHandle *string `json:"volumeGroupSnapshotHandle,omitempty" protobuf:"bytes,2,opt,name=volumeGroupSnapshotHandle"`
|
||||
// Required.
|
||||
VolumeGroupSnapshotHandle string `json:"volumeGroupSnapshotHandle" protobuf:"bytes,1,opt,name=volumeGroupSnapshotHandle"`
|
||||
|
||||
// VolumeSnapshotHandles is a list of CSI "snapshot_id" of pre-existing
|
||||
// snapshots on the underlying storage system for which Kubernetes objects
|
||||
// representation were (or should be) created.
|
||||
// This field is immutable.
|
||||
// Required.
|
||||
VolumeSnapshotHandles []string `json:"volumeSnapshotHandles" protobuf:"bytes,2,opt,name=volumeSnapshotHandles"`
|
||||
}
|
||||
|
@@ -198,10 +198,10 @@ func (in *VolumeGroupSnapshotContentSource) DeepCopyInto(out *VolumeGroupSnapsho
|
||||
*out = make([]string, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
if in.VolumeGroupSnapshotHandle != nil {
|
||||
in, out := &in.VolumeGroupSnapshotHandle, &out.VolumeGroupSnapshotHandle
|
||||
*out = new(string)
|
||||
**out = **in
|
||||
if in.GroupSnapshotHandleSource != nil {
|
||||
in, out := &in.GroupSnapshotHandleSource, &out.GroupSnapshotHandleSource
|
||||
*out = new(VolumeGroupSnapshotHandleSource)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
return
|
||||
}
|
||||
@@ -280,6 +280,27 @@ func (in *VolumeGroupSnapshotContentStatus) DeepCopy() *VolumeGroupSnapshotConte
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *VolumeGroupSnapshotHandleSource) DeepCopyInto(out *VolumeGroupSnapshotHandleSource) {
|
||||
*out = *in
|
||||
if in.VolumeSnapshotHandles != nil {
|
||||
in, out := &in.VolumeSnapshotHandles, &out.VolumeSnapshotHandles
|
||||
*out = make([]string, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VolumeGroupSnapshotHandleSource.
|
||||
func (in *VolumeGroupSnapshotHandleSource) DeepCopy() *VolumeGroupSnapshotHandleSource {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(VolumeGroupSnapshotHandleSource)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *VolumeGroupSnapshotList) DeepCopyInto(out *VolumeGroupSnapshotList) {
|
||||
*out = *in
|
||||
|
@@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
|
||||
kind: CustomResourceDefinition
|
||||
metadata:
|
||||
annotations:
|
||||
api-approved.kubernetes.io: "https://github.com/kubernetes-csi/external-snapshotter/pull/814"
|
||||
api-approved.kubernetes.io: "https://github.com/kubernetes-csi/external-snapshotter/pull/971"
|
||||
controller-gen.kubebuilder.io/version: v0.12.0
|
||||
creationTimestamp: null
|
||||
name: volumegroupsnapshotcontents.groupsnapshot.storage.k8s.io
|
||||
@@ -104,6 +104,31 @@ spec:
|
||||
dynamically provisioned or already exists, and just requires a Kubernetes
|
||||
object representation. This field is immutable after creation. Required.
|
||||
properties:
|
||||
groupSnapshotHandleSource:
|
||||
description: GroupSnapshotHandleSource specifies the CSI "group_snapshot_id"
|
||||
of a pre-existing group snapshot and a list of CSI "snapshot_id"
|
||||
of pre-existing snapshots on the underlying storage system for
|
||||
which a Kubernetes object representation was (or should be)
|
||||
created. This field is immutable.
|
||||
properties:
|
||||
volumeGroupSnapshotHandle:
|
||||
description: VolumeGroupSnapshotHandle specifies the CSI "group_snapshot_id"
|
||||
of a pre-existing group snapshot on the underlying storage
|
||||
system for which a Kubernetes object representation was
|
||||
(or should be) created. This field is immutable. Required.
|
||||
type: string
|
||||
volumeSnapshotHandles:
|
||||
description: VolumeSnapshotHandles is a list of CSI "snapshot_id"
|
||||
of pre-existing snapshots on the underlying storage system
|
||||
for which Kubernetes objects representation were (or should
|
||||
be) created. This field is immutable. Required.
|
||||
items:
|
||||
type: string
|
||||
type: array
|
||||
required:
|
||||
- volumeGroupSnapshotHandle
|
||||
- volumeSnapshotHandles
|
||||
type: object
|
||||
persistentVolumeNames:
|
||||
description: PersistentVolumeNames is a list of names of PersistentVolumes
|
||||
to be snapshotted together. It is specified for dynamic provisioning
|
||||
@@ -111,16 +136,10 @@ spec:
|
||||
items:
|
||||
type: string
|
||||
type: array
|
||||
volumeGroupSnapshotHandle:
|
||||
description: VolumeGroupSnapshotHandle specifies the CSI "group_snapshot_id"
|
||||
of a pre-existing group snapshot on the underlying storage system
|
||||
for which a Kubernetes object representation was (or should
|
||||
be) created. This field is immutable.
|
||||
type: string
|
||||
type: object
|
||||
oneOf:
|
||||
- required: ["persistentVolumeNames"]
|
||||
- required: ["volumeGroupSnapshotHandle"]
|
||||
- required: ["groupSnapshotHandleSource"]
|
||||
volumeGroupSnapshotClassName:
|
||||
description: VolumeGroupSnapshotClassName is the name of the VolumeGroupSnapshotClass
|
||||
from which this group snapshot was (or will be) created. Note that
|
||||
|
@@ -1161,7 +1161,7 @@ func (ctrl *csiSnapshotCommonController) processGroupSnapshotWithDeletionTimesta
|
||||
// Delete the individual snapshots part of the group snapshot
|
||||
for _, snapshot := range groupSnapshot.Status.VolumeSnapshotRefList {
|
||||
err := ctrl.clientset.SnapshotV1().VolumeSnapshots(snapshot.Namespace).Delete(context.TODO(), snapshot.Name, metav1.DeleteOptions{})
|
||||
if err != nil {
|
||||
if err != nil && !apierrs.IsNotFound(err) {
|
||||
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)
|
||||
klog.Error(msg)
|
||||
ctrl.eventRecorder.Event(groupSnapshot, v1.EventTypeWarning, "SnapshotDeleteError", msg)
|
||||
|
Reference in New Issue
Block a user