Skip to content

Commit

Permalink
Modify the Transition to New Snapshot Design section.
Browse files Browse the repository at this point in the history
  • Loading branch information
xing-yang committed Jul 13, 2018
1 parent 5254e3d commit a9528e3
Showing 1 changed file with 20 additions and 19 deletions.
39 changes: 20 additions & 19 deletions contributors/design-proposals/storage/csi-snapshot.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"`
}

Expand Down Expand Up @@ -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
Expand All @@ -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"`
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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.

Expand All @@ -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

Expand All @@ -366,7 +367,7 @@ kind: SnapshotClass
metadata:
name: csi-hostpath-snapclass
snapshotter: csi-hostpath

---
apiVersion: volumesnapshot.csi.k8s.io/v1alpha1
kind: VolumeSnapshot
metadata:
Expand All @@ -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.

0 comments on commit a9528e3

Please sign in to comment.