Skip to content

Commit 526232e

Browse files
committed
Update volume group snapshot KEP
1 parent 61abddc commit 526232e

File tree

1 file changed

+75
-45
lines changed
  • keps/sig-storage/3476-volume-group-snapshot

1 file changed

+75
-45
lines changed

keps/sig-storage/3476-volume-group-snapshot/README.md

Lines changed: 75 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
- [CreateVolumeGroupSnapshot](#createvolumegroupsnapshot)
4242
- [DeleteVolumeGroupSnapshot](#deletevolumegroupsnapshot)
4343
- [GetVolumeGroupSnapshot](#getvolumegroupsnapshot)
44+
- [GetSnapshot](#getsnapshot)
4445
- [Production Readiness Review Questionnaire](#production-readiness-review-questionnaire)
4546
- [Feature enablement and rollback](#feature-enablement-and-rollback)
4647
- [Rollout, Upgrade and Rollback Planning](#rollout-upgrade-and-rollback-planning)
@@ -82,7 +83,7 @@ Items marked with (R) are required *prior to targeting to a milestone / release*
8283
- [x] (R) Production readiness review completed
8384
- [x] Production readiness review approved
8485
- [x] "Implementation History" section is up-to-date for milestone
85-
- [ ] User-facing documentation has been created in [kubernetes/website], for publication to [kubernetes.io]
86+
- [x] User-facing documentation has been created in [kubernetes/website], for publication to [kubernetes.io]
8687
- [ ] Supporting documentation e.g., additional design documents, links to mailing list discussions/SIG meetings, relevant PRs/issues, release notes
8788

8889
<!--
@@ -134,13 +135,15 @@ Note: In the following, we will use VolumeGroupSnapshot Controller to refer to t
134135
* Admin creates a VolumeGroupSnapshotClass.
135136
* User creates a VolumeGroupSnapshot with label selector that matches the label applied to all PVCs to be snapshotted together.
136137
* This will trigger the VolumeGroupSnapshot controller to create a VolumeGroupSnapshotContent API object. The group snapshot logic in the csi-snapshotter sidecar will call the CreateVolumeGroupSnapshot CSI function.
137-
* The group snapshot logic in csi-snapshotter will retrieve all volumeSnapshotHandles and their source volumeHandles in the Volume Group Snapshot from the CSI CreateVolumeGroupSnapshotResponse, and populate the VolumeSnapshotHandlePairList field in the VolumeGroupSnapshotContent status.
138+
* The group snapshot logic in csi-snapshotter will retrieve all volumeSnapshotHandles, their source volumeHandles, and other information in the Volume Group Snapshot from the CSI CreateVolumeGroupSnapshotResponse, and update the VolumeGroupSnapshotContent status.
139+
* In v1beta1, it populates the VolumeSnapshotHandlePairList field in the VolumeGroupSnapshotContent status.
140+
* In v1beta2, it populates the VolumeSnapshotInfoList field in the VolumeGroupSnapshotContent status for the new v1beta2 API objects. The existing v1beta1 API objects will be converted to the new v1beta2 API objects. The conversion logic will only populate the VolumeHandle and SnapshotHandle fields and will leave the remaining fields empty. A conversion webhook will be developed to make the conversion.
138141
* The VolumeGroupSnapshot controller will be watching the VolumeGroupSnapshotContent, and create VolumeSnapshotContents pointing to the volumeSnapshotHandles once they are available in the VolumeGroupSnapshotContent status. Then the controller will create VolumeSnapshots pointing to the VolumeSnapshotContents.
139142
* CreateVolumeGroupSnapshot CSI function response
140-
* The CreateVolumeGroupSnapshot CSI function should return a list of snapshots (Snapshot message defined in CSI Spec) in its response. The group snapshot logic in the csi-snapshotter sidecar will update the VolumeSnapshotHandlePairList field in the VolumeGroupSnapshotContent status based on the returned list of snapshots from the CSI call. The VolumeGroupSnapshot controller can use VolumeSnapshotHandles to construct corresponding individual VolumeSnapshotContents and VolumeSnapshots, wait for VolumeSnapshots and VolumeSnapshotContents to be bound, and update PVCVolumeSnapshotRefList in the VolumeGroupSnapshot Status and PVVolumeSnapshotContentList in the VolumeGroupSnapshotContent Status.
143+
* The CreateVolumeGroupSnapshot CSI function should return a list of snapshots (Snapshot message defined in CSI Spec) in its response. The group snapshot logic in the csi-snapshotter sidecar will update the VolumeSnapshotInfoList field in the VolumeGroupSnapshotContent status based on the returned list of snapshots from the CSI call. The VolumeGroupSnapshot controller can use VolumeSnapshotInfo to construct corresponding individual VolumeSnapshotContents and VolumeSnapshots, wait for VolumeSnapshots and VolumeSnapshotContents to be bound.
141144
* Individual VolumeSnapshots will be named in this format:
142-
* <snap>-<hash of VolumeGroupSnapshot UUID+PVC UUID+timestamp>
143-
* A label with VolumeGroupSnapshot name will also be added to the VolumeSnapshot
145+
* <snap>-<hash of VolumeGroupSnapshotContent UUID + volume handle>
146+
* VolumeGroupSnapshot will also be added as an OwnerReference for the VolumeSnapshot
144147

145148
```
146149
apiVersion: snapshot.storage.k8s.io/v1
@@ -156,7 +159,7 @@ status:
156159
volumeGroupSnapshotName: groupSnapshot1
157160
```
158161

159-
* An admissions controller or finalizer should be added to prevent an individual snapshot from being deleted that belongs to a VolumeGroupSnapshot. Note that there is a [KEP](https://github.com/kubernetes/enhancements/pull/2840/files) that is proposing the Liens feature which could potentially be used for this purpose.
162+
* A finalizer should be added to prevent an individual snapshot from being deleted that belongs to a VolumeGroupSnapshot. Note that there is a [KEP](https://github.com/kubernetes/enhancements/pull/2840/files) that is proposing the Liens feature which could potentially be used for this purpose.
160163
* In the CSI spec, it is specified that it is required for individual snapshots to be returned along with the group snapshot.
161164

162165
#### Pre-provisioned VolumeGroupSnapshot
@@ -165,6 +168,8 @@ Admin can create a VolumeGroupSnapshotContent, specifying an existing VolumeGrou
165168

166169
The controller will call the CSI GetVolumeGroupSnapshot method to retrieve all volumeSnapshotHandles in the Volume Group Snapshot from the storage system, create VolumeSnapshotContents pointing to the volumeSnapshotHandles. Then the controller will create VolumeSnapshots pointing to the VolumeSnapshotContents.
167170

171+
Note: The automatic creation of individual VolumeSnapshots and VolumeSnapshotContents are not done in Beta. For now, the admin will need to manually construct these individual API objects. We plan to work on this before the feature moves to GA. We have information for all the individual snapshots from CSI [GetVolumeGroupSnapshot](https://github.com/kubernetes-csi/external-snapshotter/blob/release-8.2/pkg/sidecar-controller/groupsnapshot_helper.go#L781). We should be able to populate individual VolumeSnapshots and VolumeSnapshotContents based on this information.
172+
168173
### Delete VolumeGroupSnapshot
169174

170175
A VolumeGroupSnapshot can be deleted if the CSI driver supports the CREATE_DELETE_GET_VOLUME_GROUP_SNAPSHOT capability.
@@ -373,21 +378,6 @@ Type VolumeGroupSnapshotStatus struct {
373378
374379
// +optional
375380
Error *VolumeSnapshotError
376-
377-
// VolumeSnapshotRefList is the list of PVC and VolumeSnapshot pairs that
378-
// is part of this group snapshot.
379-
// The maximum number of allowed snapshots in the group is 100.
380-
// +optional
381-
PVCVolumeSnapshotRefList []PVCVolumeSnapshotPair
382-
}
383-
384-
// PVCVolumeSnapshotPair defines a pair of a PVC reference and a Volume Snapshot Reference
385-
type PVCVolumeSnapshotPair struct {
386-
// PersistentVolumeClaimRef is a reference to the PVC this pair is referring to
387-
PersistentVolumeClaimRef core_v1.LocalObjectReference
388-
389-
// VolumeSnapshotRef is a reference to the VolumeSnapshot this pair is referring to
390-
VolumeSnapshotRef core_v1.LocalObjectReference
391381
}
392382
```
393383

@@ -464,6 +454,8 @@ type GroupSnapshotHandles struct {
464454
VolumeSnapshotHandles []string
465455
}
466456
457+
// The VolumeSnapshotHandlePair struct is added in v1beta1 but removed in v1beta2
458+
// It is replaced by the VolumeSnapshotInfo struct
467459
// VolumeSnapshotHandlePair defines a pair of a source volume handle and a snapshot handle
468460
type VolumeSnapshotHandlePair struct {
469461
// VolumeHandle is a unique id returned by the CSI driver to identify a volume
@@ -475,6 +467,31 @@ type VolumeSnapshotHandlePair struct {
475467
SnapshotHandle string
476468
}
477469
470+
// The VolumeSnapshotInfo struct is added in v1beta2
471+
// VolumeSnapshotInfo contains information for a snapshot
472+
type VolumeSnapshotInfo struct {
473+
// VolumeHandle is a unique id returned by the CSI driver to identify a volume
474+
// on the storage system
475+
VolumeHandle string
476+
477+
// SnapshotHandle is a unique id returned by the CSI driver to identify a volume
478+
// snapshot on the storage system
479+
SnapshotHandle string
480+
481+
// creationTime is the timestamp when the point-in-time snapshot is taken
482+
// by the underlying storage system.
483+
// +optional
484+
CreationTime *int64
485+
486+
// ReadyToUse indicates if the snapshot is ready to be used to restore a volume.
487+
// +optional
488+
ReadyToUse *bool
489+
490+
// RestoreSize represents the complete size of the snapshot in bytes.
491+
// +optional
492+
RestoreSize *int64
493+
}
494+
478495
Type VolumeGroupSnapshotContentStatus struct {
479496
// VolumeGroupSnapshotHandle is a unique id returned by the CSI driver
480497
// to identify the VolumeGroupSnapshot on the storage system.
@@ -483,28 +500,32 @@ Type VolumeGroupSnapshotContentStatus struct {
483500
// +optional
484501
VolumeGroupSnapshotHandle *string
485502
503+
// This field is introduced in v1beta1 but removed in v1beta2
504+
// It is replaced by VolumeSnapshotInfoList
505+
// Information in this field from an existing v1beta1 API object
506+
// will be copied to VolumeSnapshotInfoList by the conversion logic
486507
// VolumeSnapshotHandlePairList is a list of CSI "volume_id" and "snapshot_id"
487508
// pair returned by the CSI driver to identify snapshots and their source volumes
488509
// on the storage system.
489510
// +optional
490-
VolumeSnapshotHandlePairList []VolumeSnapshotHandlePair
511+
// VolumeSnapshotHandlePairList []VolumeSnapshotHandlePair
512+
513+
// This field is introduced in v1beta2
514+
// It is replacing VolumeSnapshotHandlePairList
515+
// VolumeSnapshotInfoList is a list of snapshot information returned by
516+
// by the CSI driver to identify snapshots on the storage system.
517+
// +optional
518+
VolumeSnapshotInfoList []VolumeSnapshotInfo
491519
492520
// ReadyToUse becomes true when ReadyToUse on all individual snapshots become true
493521
// +optional
494522
ReadyToUse *bool
495523
496524
// +optional
497-
CreationTime *int64
525+
CreationTime *metav1.Time
498526
499527
// +optional
500528
Error *VolumeSnapshotError
501-
502-
// NOTE: We will consider removing this field after testing.
503-
// PVVolumeSnapshotContentList is the list of pairs of PV and
504-
// VolumeSnapshotContent for this group snapshot
505-
// The maximum number of allowed snapshots in the group is 100.
506-
// +optional
507-
PVVolumeSnapshotContentList []PVVolumeSnapshotContentPair
508529
}
509530
```
510531

@@ -569,24 +590,23 @@ A new group controller service will be added with a new controller capability CR
569590
Indicates that the controller plugin supports creating, deleting, and getting details of a snapshot of
570591
multiple volumes.
571592

593+
A new controller capability GET_SNAPSHOT will also be added. This indicates that the controller plugin supports getting details of a snapshot of multiple volumes.
594+
572595
#### CSI Group Controller RPC
573596

574597
```
575598
service Controller {
576599
577600
rpc CreateVolumeGroupSnapshot(CreateVolumeGroupSnapshotRequest)
578601
returns (CreateVolumeGroupSnapshotResponse) {
579-
option (alpha_method) = true;
580602
}
581603
582604
rpc DeleteVolumeGroupSnapshot(DeleteVolumeGroupSnapshotRequest)
583605
returns (DeleteVolumeGroupSnapshotResponse) {
584-
option (alpha_method) = true;
585606
}
586607
587608
rpc GetVolumeGroupSnapshot(GetVolumeGroupSnapshotRequest)
588609
returns (GetVolumeGroupSnapshotResponse) {
589-
option (alpha_method) = true;
590610
}
591611
592612
}
@@ -598,8 +618,6 @@ The purpose of this call is to request the creation of a multi-volume snapshot.
598618

599619
```
600620
message CreateVolumeGroupSnapshotRequest {
601-
option (alpha_message) = true;
602-
603621
// The suggested name for the group snapshot. This field is REQUIRED
604622
// for idempotency.
605623
// Any Unicode string that conforms to the length limit is allowed
@@ -627,16 +645,12 @@ message CreateVolumeGroupSnapshotRequest {
627645
}
628646
629647
message CreateVolumeGroupSnapshotResponse {
630-
option (alpha_message) = true;
631-
632648
// Contains all attributes of the newly created group snapshot.
633649
// This field is REQUIRED.
634650
VolumeGroupSnapshot group_snapshot = 1;
635651
}
636652
637653
message VolumeGroupSnapshot {
638-
option (alpha_message) = true;
639-
640654
// The identifier for this group snapshot, generated by the plugin.
641655
// This field MUST contain enough information to uniquely identify
642656
// this specific snapshot vs all other group snapshots supported by
@@ -673,8 +687,6 @@ message VolumeGroupSnapshot {
673687

674688
```
675689
message DeleteVolumeGroupSnapshotRequest {
676-
option (alpha_message) = true;
677-
678690
// The ID of the group snapshot to be deleted.
679691
// This field is REQUIRED.
680692
string group_snapshot_id = 1;
@@ -706,8 +718,6 @@ message DeleteVolumeGroupSnapshotResponse {
706718

707719
```
708720
message GetVolumeGroupSnapshotRequest {
709-
option (alpha_message) = true;
710-
711721
// The ID of the group snapshot to fetch current group snapshot
712722
// information for.
713723
// This field is REQUIRED.
@@ -725,13 +735,33 @@ message GetVolumeGroupSnapshotRequest {
725735
}
726736
727737
message GetVolumeGroupSnapshotResponse {
728-
option (alpha_message) = true;
729-
730738
// This field is REQUIRED
731739
VolumeGroupSnapshot group_snapshot = 1;
732740
}
733741
```
734742

743+
#### GetSnapshot
744+
745+
GetSnapshot is an optional controller capability that can help retrieve snapshot information. It can be used by Kubernetes to populate fields in individual VolumeSnapshotContents and VolumeSnapshots API objects that belong to a VolumeGroupSnapshot.
746+
747+
```
748+
message GetSnapshotRequest {
749+
// The ID of the snapshot to fetch current snapshot information for.
750+
// This field is REQUIRED.
751+
string snapshot_id = 1;
752+
753+
// Secrets required by plugin to complete GetSnapshot request.
754+
// This field is OPTIONAL. Refer to the `Secrets Requirements`
755+
// section on how to use this field.
756+
map<string, string> secrets = 2 [(csi_secret) = true];
757+
}
758+
759+
message GetSnapshotResponse {
760+
// This field is REQUIRED
761+
Snapshot snapshot = 1;
762+
}
763+
```
764+
735765
## Production Readiness Review Questionnaire
736766

737767
### Feature enablement and rollback

0 commit comments

Comments
 (0)