Skip to content

Kubernetes Volume Snapshot Controller using Custom Resource Definition

License

Notifications You must be signed in to change notification settings

rootfs/snapshot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Volume Snapshot Controller

Status

No longer maintained. Please use https://github.com/kubernetes-incubator/external-storage/

Demo

Quick Howto

Snapshot Volume Plugin Interface

As illustrated in example plugin hostPath

Plugin API

A Volume plugin must provide RegisterPlugin() to return plugin struct, GetPluginName() to return plugin name, and implement the following interface as illustrated in hostPath

import (
	"k8s.io/client-go/pkg/api/v1"

	crdv1 "github.com/rootfs/snapshot/pkg/apis/crd/v1"
	"github.com/rootfs/snapshot/pkg/cloudprovider"
)

type VolumePlugin interface {
	// Init inits volume plugin
	Init(cloudprovider.Interface)
	// SnapshotCreate creates a VolumeSnapshot from a PersistentVolumeSpec
	SnapshotCreate(*v1.PersistentVolume) (*crdv1.VolumeSnapshotDataSource, error)
	// SnapshotDelete deletes a VolumeSnapshot
	// PersistentVolume is provided for volume types, if any, that need PV Spec to delete snapshot
	SnapshotDelete(*crdv1.VolumeSnapshotDataSource, *v1.PersistentVolume) error
	// SnapshotRestore restores (promotes) a volume snapshot into a volume
	SnapshotRestore(*crdv1.VolumeSnapshotData, *v1.PersistentVolumeClaim, string, map[string]string) (*v1.PersistentVolumeSource, map[string]string, error)
	// Describe volume snapshot status.
	// return true if the snapshot is ready
	DescribeSnapshot(snapshotData *crdv1.VolumeSnapshotData) (isCompleted bool, err error)
	// VolumeDelete deletes a PV
	// TODO in the future pass kubernetes client for certain volumes (e.g. rbd) so they can access storage class to retrieve secret
	VolumeDelete(pv *v1.PersistentVolume) error
}

Volume Snapshot Data Source Spec

Each volume must also provide a Snapshot Data Source Spec and add to VolumeSnapshotDataSource, then declare support in GetSupportedVolumeFromPVC by returning the exact name as returned by the plugin's GetPluginName()

Invocation

The plugins are added to Snapshot controller cmd pkg.

About

Kubernetes Volume Snapshot Controller using Custom Resource Definition

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published