Skip to content

Commit

Permalink
Add a section for transitioning from old to new design
Browse files Browse the repository at this point in the history
Add a section to explain how to transition from old to new
snapshot support.
  • Loading branch information
xing-yang committed Jul 15, 2018
1 parent b0b8548 commit 036202c
Showing 1 changed file with 54 additions and 0 deletions.
54 changes: 54 additions & 0 deletions contributors/design-proposals/storage/csi-snapshot.md
Original file line number Diff line number Diff line change
Expand Up @@ -324,3 +324,57 @@ CreateSnapshot is a synchronous function and it must be blocking until the snaps
Create volume from snapshot will be handled by the CreateVolume controller function in the CSI Volume Driver.

Refer to [Container Storage Interface (CSI)](https://github.com/container-storage-interface/spec) for detailed instructions on how CSI Volume Driver shall implement snapshot functions.


## 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:

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.

Old Design
* 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.

Here is an example yaml file to create a snapshot in the old design:

```GO

apiVersion: volumesnapshot.external-storage.k8s.io/v1
kind: VolumeSnapshot
metadata:
name: hostpath-test-snapshot
spec:
persistentVolumeClaimName: pvc-test-hostpath

```

Here is an example to create a SnapshotClass and create a snapshot in the new design:

```GO

apiVersion: volumesnapshot.csi.k8s.io/v1alpha1
kind: SnapshotClass
metadata:
name: csi-hostpath-snapclass
snapshotter: csi-hostpath

apiVersion: volumesnapshot.csi.k8s.io/v1alpha1
kind: VolumeSnapshot
metadata:
name: snapshot-demo
spec:
snapshotClassName: csi-hostpath-snapclass
persistentVolumeClaimName: hpvc

```

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.

0 comments on commit 036202c

Please sign in to comment.