snapshot/

directory
v0.0.0-...-96c79a7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 5, 2021 License: Apache-2.0, Apache-2.0

README

Volume Snapshot Controller

Deprecated

Please note the volume snapshotting feature is now part of the Container Storage Interface API which makes this implementation obsolete. Consider using a CSI driver in case you need volume snapshots.

Status

Pre-alpha

Demo

Quick Howto

Docs

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/kubernetes-incubator/external-storage/snapshot/pkg/apis/crd/v1"
	"github.com/kubernetes-incubator/external-storage/snapshot/pkg/cloudprovider"
)

type VolumePlugin interface {
	// Init inits volume plugin
	Init(cloudprovider.Interface)
	// SnapshotCreate creates a VolumeSnapshot from a PersistentVolumeSpec
	SnapshotCreate(*v1.PersistentVolume, *map[string]string) (*crdv1.VolumeSnapshotDataSource, *[]crdv1.VolumeSnapshotCondition, 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) (snapConditions *[]crdv1.VolumeSnapshotCondition, isCompleted bool, err error)
	// FindSnapshot finds a VolumeSnapshot by matching metadata
	FindSnapshot(tags *map[string]string) (*crdv1.VolumeSnapshotDataSource, *[]crdv1.VolumeSnapshotCondition, 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.

Directories

Path Synopsis
cmd
pkg
cloudprovider/providers/gce
Package gce is an implementation of Interface, LoadBalancer and Instances for Google Compute Engine.
Package gce is an implementation of Interface, LoadBalancer and Instances for Google Compute Engine.
controller/cache
Package cache implements data structures used by the snapshot controller to keep track of volume snapshots.
Package cache implements data structures used by the snapshot controller to keep track of volume snapshots.
controller/populator
Package populator implements interfaces that monitor and keep the states of the desired_state_of_word in sync with the "ground truth" from informer.
Package populator implements interfaces that monitor and keep the states of the desired_state_of_word in sync with the "ground truth" from informer.
controller/reconciler
Package reconciler implements interfaces that attempt to reconcile the desired state of the with the actual state of the world by triggering actions.
Package reconciler implements interfaces that attempt to reconcile the desired state of the with the actual state of the world by triggering actions.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL