Skip to content

Instantly share code, notes, and snippets.

@satyamz
Created August 13, 2018 10:07
Show Gist options
  • Save satyamz/3f61121fef9186cf7be2a1cdc0c8607d to your computer and use it in GitHub Desktop.
Save satyamz/3f61121fef9186cf7be2a1cdc0c8607d to your computer and use it in GitHub Desktop.

Proposal: Add snapshot & clone support for k8s volumes to Weave Scope

Now that weave scope supports Kubernetes Volumes, it would be great to have snapshot and clone support built in Weave Scope.

Feature:

  • Allow user to take a snapshot for the Kubernetes Volume using Weave Scope.
  • Allow user to restore a snapshot i.e. create a clone from the snapshot using Weave Scope.
  • Allow user to visualize and manage the snapshot & clone resources through Weave Scope.

Specification:

Snapshot

Snapshot is the current state of the Kubernetes persistent volume. Kubernetes snapshotting proposal can be found here. Snapshot creates two types of objects,

  1. VolumeSnapshot
  2. VolumeSnapshotData

                          Snapshot            Clone


+--------+              +---------+         +---------+
|        |              |         |         |         |
|  PV    +------------> |Volume   +-------> |  PVC    |
|        |              |Sanpshot |         |         |
+----+---+              +----+----+         +----+----+
     |                       |                   |
     |                       |                   |
+----+---+              +----+----+         +----+----+
|        |              |Volume   |         |         |
|  PVC   |              |Snapshot |         |   PV    |
|        |              |Data     |         |         |
+--------+              +---------+         +---------+


  • Snapshot is a Kubernetes CRD known as volumesnapshots.volumesnapshot.external-storage.k8s.io and implemented in the kubernetes-incubator/external-storage.

  • Add control on the PVC Node in Weave Scope for snapshot.

  • Name for VolumeSnapshot Node:

    Name for the snapshot object should be unique and should contain timestamp. Hence, snapshot-timestamp-uuid

  • Shape for snapshot object:

    (Need suggestion)

  • Shape for control icon:

    (Need suggestion)

  • Adjacency for the snapshot:

    VolumeSnapshot k8s resource contain name of the VolumeSnapshotData. Hence, link can be shown among these two objects. VolumeSnapshot can be connected to the PVC object.

Clones

Snapshot can be restored to PVC & PV, these restored PVC & PV objects are known as clones. Data restoration should be done using Weave Scope. Add control to VolumeSnapshot node to restore the data in the form of PVC & PV.

  • Add control on the VolumeSnapshot Node in Weave Scope for snapshot.
  • Name for VolumeSnapshot Node:

    snapshotdata-timestamp-uuid

  • Shape for snapshot object:

    Shape will be similar to the existing PVC & PV objects.

  • Shape for control icon:

    (Need suggestion)

  • Adjacency for the snapshot:

    Adjacency should be drawn as per current adjacency of PVC & PV objects.

Solution:

  • Upgrade client-go to 8.0.0

    Snapshot support is recently added to the Kubernetes as a external plugin/out-tree here which uses client-go version 8.0.0 .

    To implement snapshot support in Weave Scope, we need clientset for the Kubernetes API Object, that's Snapshot CRD in this case. As of today, snapshot CRD lacks implementation of versioned kubernetes client i.e clientset. There's ongoing PR for the same. It seems PR is in the pending state. Hence, We've created external repo which contains generated clientset.

  • Add support to show VolumeSnapshot & VolumeSnapshotData on Weave Scope

  • Add control to PVC to create a VolumeSnapshot

  • Add control to VolumeSnapshot to create a clone

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment