From b331712a6d61a5679cdd903b06d752fccacc8a75 Mon Sep 17 00:00:00 2001 From: xing-yang Date: Thu, 12 Jul 2018 20:49:04 -0700 Subject: [PATCH] Modify the Transition to New Snapshot Design section. --- .../design-proposals/storage/csi-snapshot.md | 39 ++++++++++--------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/contributors/design-proposals/storage/csi-snapshot.md b/contributors/design-proposals/storage/csi-snapshot.md index d8bbd9253a6..a56249f2a97 100644 --- a/contributors/design-proposals/storage/csi-snapshot.md +++ b/contributors/design-proposals/storage/csi-snapshot.md @@ -57,7 +57,7 @@ The API design of VolumeSnapshot and VolumeSnapshotData is modeled after Persist // the VolumeSnapshotSpec type VolumeSnapshot struct { metav1.TypeMeta `json:",inline"` - Metadata metav1.ObjectMeta `json:"metadata"` + metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` // Spec represents the desired state of the snapshot // +optional @@ -70,7 +70,8 @@ type VolumeSnapshot struct { type VolumeSnapshotList struct { metav1.TypeMeta `json:",inline"` - Metadata metav1.ListMeta `json:"metadata"` + metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + Items []VolumeSnapshot `json:"items"` } @@ -146,7 +147,7 @@ type VolumeSnapshotCondition struct { type VolumeSnapshotData struct { metav1.TypeMeta `json:",inline"` // +optional - Metadata metav1.ObjectMeta `json:"metadata"` + metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` // Spec represents the desired state of the snapshot // +optional @@ -160,7 +161,7 @@ type VolumeSnapshotDataList struct { Items []VolumeSnapshotData `json:"items"` } -// The desired state of the volume snapshot +// The desired state of the volume snapshot data type VolumeSnapshotDataSpec struct { // Source represents the location and type of the volume snapshot VolumeSnapshotSource `json:",inline" protobuf:"bytes,1,opt,name=volumeSnapshotSource"` @@ -244,7 +245,7 @@ A new SnapshotClass API object will be added to avoid mixing parameters between type SnapshotClass struct { metav1.TypeMeta `json:",inline"` // +optional - Metadata metav1.ObjectMeta `json:"metadata"` + metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` // Snapshotter is the driver expected to handle this SnapshotClass. // This value may not be empty. @@ -328,19 +329,11 @@ Refer to [Container Storage Interface (CSI)](https://github.com/container-storag ## Transition to the New Snapshot Support -To use the snapshot implementation in [external storage repo](https://github.com/kubernetes-incubator/external-storage/tree/master/snapshot), an external snapshot controller and external provisioner need to bedeployed. - -To use the new snapshot implementation for CSI, a sidecar container for the external snapshot controller needs to be deployed in addition to the sidecar container for the external provisioner. - -The differences between the two are as follows from a user's point of view: +### Existing Implementation in External Storage Repo -New Design -* Supports CSI volume drivers. -* To create a snapshot for CSI, a SnapshotClass can be created and specified in the spec of VolumeSnapshot. -* To restore a volume from the snapshot, user should use the same StorageClass that is used for the original PVC. +For the snapshot implementation in [external storage repo](https://github.com/kubernetes-incubator/external-storage/tree/master/snapshot), an external snapshot controller and an external provisioner need to be deployed. -Old Design -* Does not support CSI volume drivers. +* The old implementation does not support CSI volume drivers. * SnapshotClass is not needed to create a snapshot and this concept does not exist in the old design. * To restore a volume from the snapshot, however, user needs to create a new StorageClass that is different from the original one for the PVC. @@ -357,7 +350,15 @@ spec: ``` -Here is an example to create a SnapshotClass and create a snapshot in the new design: +### New Snapshot Design for CSI + +For the new snapshot model, a sidecar "Kubernetes to CSI" proxy container called "external-snapshotter" needs to be deployed in addition to the sidecar container for the external provisioner. This deployment model is shown in the CSI Snapshot Diagram in the CSI External Snapshot Controller section. + +* The new design supports CSI volume drivers. +* To create a snapshot for CSI, a SnapshotClass can be created and specified in the spec of VolumeSnapshot. +* To restore a volume from the snapshot, user should use the same StorageClass that is used for the original PVC. + +Here is an example to create a SnapshotClass and to create a snapshot in the new design: ```GO @@ -366,7 +367,7 @@ kind: SnapshotClass metadata: name: csi-hostpath-snapclass snapshotter: csi-hostpath - +--- apiVersion: volumesnapshot.csi.k8s.io/v1alpha1 kind: VolumeSnapshot metadata: @@ -377,4 +378,4 @@ spec: ``` -To transition from the old to the new snapshot support, user needs to deploy the CSI external snapshot controller as a side car container along with the external provisioner and use the new definitions for the SnapshotClass, VolumeSnapshot, and PVC yaml files. +To transition from the old model to the new model, user needs to stop using the old deployment, and follow the new design to deploy the snapshot controller and create VolumeSnapshots.