summaryrefslogtreecommitdiff
path: root/contributors
diff options
context:
space:
mode:
authorJing Xu <jinxu@google.com>2018-08-07 16:49:11 -0700
committerGitHub <noreply@github.com>2018-08-07 16:49:11 -0700
commit0bdaa171386b65dc30b56eb8ef7df4e474d4dab6 (patch)
tree6b9c648b57c0d9fd7f40bc16e1f83308881a6616 /contributors
parent216e4d444b202c183949f74fe92f1e7f5c5e7a0c (diff)
Update data-source.md
Diffstat (limited to 'contributors')
-rw-r--r--contributors/design-proposals/storage/data-source.md80
1 files changed, 79 insertions, 1 deletions
diff --git a/contributors/design-proposals/storage/data-source.md b/contributors/design-proposals/storage/data-source.md
index 108502d2..d3f5038d 100644
--- a/contributors/design-proposals/storage/data-source.md
+++ b/contributors/design-proposals/storage/data-source.md
@@ -1,10 +1,88 @@
# Add DataSource for Volume Operations
-## Goal
+Note: this proposal is part of [Volume Snapshot](https://github.com/kubernetes/community/pull/2335) feature design, and also relevant to recently proposed Volume Clone feature.
+## Goal
+In Volume Snapshot proposal, a snapshot is now represented as first-class CRD objects and an external snapshot controller is responsible for managing its lifecycle. With Snapshot API available, users could provision volumes from snapshot and data will be prepopulated to the volumes. Also considering clone and other possible storage operations, there could be many different types of sources used for populating the data to the volumes. In this proposal, we add a general "DataSource" which could be used to represent different types of data sources.
## Design
+The following are the APIs we propose to add
+
+```
+
+type PersistentVolumeClaimSpec struct {
+ // If specified, volume will be prepopulated with data from the DataSource.
+ // +optional
+ DataSource *TypedLocalObjectReference `json:"dataSource" protobuf:"bytes,2,opt,name=dataSource"`
+}
+
+// TypedLocalObjectReference contains enough information to let you locate the referenced object inside the same namespace.
+type TypedLocalObjectReference struct {
+ // Name of the object reference.
+ Name string
+ // Kind indicates the type of the object reference.
+ Kind string
+}
+```
## Use cases
+* Use snapshot to backup data: Alice wants to take a snapshot of his Mongo database, and accidentally delete her tables, she wants to restore her volumes from the snapshot.
+To create a snapshot for a volume (represented by PVC), use the snapshot.yaml
+
+```
+apiVersion: snapshot.storage.k8s.io/v1alpha1
+kind: VolumeSnapshot
+metadata:
+ name: snapshot-pd-1
+ namespace: myns
+spec:
+ source:
+ Kind: PersistentVolumeClaim
+ Name: podpvc
+ snapshotClassName: snapshot-class
+
+ ```
+ After snapshot is ready, create a new volume from the snapshot
+
+```
+kind: PersistentVolumeClaim
+apiVersion: v1
+metadata:
+ name: snapshot-pvc
+ Namespace: myns
+spec:
+ accessModes:
+ - ReadWriteOnce
+ storageClassName: csi-gce-pd
+ dataSource:
+ type: VolumeSnapshot
+ name: snapshot-pd-1
+ resources:
+ requests:
+ storage: 6Gi
+
+```
+
+* Clone volume: Bob want to copy the data from one volume to another by cloning the volume.
+
+```
+kind: PersistentVolumeClaim
+apiVersion: v1
+metadata:
+ name: clone-pvc
+ Namespace: myns
+spec:
+ accessModes:
+ - ReadWriteOnce
+ storageClassName: csi-gce-pd
+ dataSource:
+ type: PersistentVolumeClaim
+ name: pvc-1
+ resources:
+ requests:
+ storage: 10Gi
+
+```
+