Documentation ¶
Index ¶
- Constants
- Variables
- type Driver
- type Option
- func Annotations(annotations map[string]string) Option
- func Labels(labels map[string]string) Option
- func Name(name string) Option
- func Namespace(name string) Option
- func PVC(pvc v1.PersistentVolumeClaim) Option
- func PVCName(name string) Option
- func PVCNamespace(ns string) Option
- func RestoreNamespace(namespace string) Option
- func RestoreSnapshotName(name string) Option
- func SnapshotClassName(name string) Option
- type Options
- type RestoreInfo
- type SnapshotInfo
- type Snapshotter
- type Status
Constants ¶
const ( // StorkSnapshotRestoreNamespacesAnnotation is annotation used to specify the // comma separated list of namespaces to which the snapshot can be restored StorkSnapshotRestoreNamespacesAnnotation = "stork.libopenstorage.org/snapshot-restore-namespaces" // StorkSnapshotSourceNamespaceAnnotation Annotation used to specify the // source of the snapshot when creating a PVC StorkSnapshotSourceNamespaceAnnotation = "stork.libopenstorage.org/snapshot-source-namespace" )
Variables ¶
var (
ExternalStorage = "external-storage"
)
List of supported snapshot drivers.
Functions ¶
This section is empty.
Types ¶
type Driver ¶
type Driver interface { // CreateSnapshot creates a volume snapshot for a pvc. CreateSnapshot(opts ...Option) (snapName, namespace, driverName string, err error) // DeleteSnapshot removes a snapshot. DeleteSnapshot(name, namespace string, retain bool) error // SnapshotStatus returns a status for a snapshot. SnapshotStatus(name, namespace string) (SnapshotInfo, error) // RestoreVolumeClaim creates a persistent volume claim from a provided snapshot. RestoreVolumeClaim(opts ...Option) (*v1.PersistentVolumeClaim, error) // RestoreStatus returns the status of a restore operation RestoreStatus(pvcName, namespace string) (RestoreInfo, error) // CancelRestore cancels a restore operation CancelRestore(pvcName, namespace string) error // Upload objects to cloud UploadSnapshotObjects(backupLocation *storkapi.BackupLocation, snapshotInfoList []SnapshotInfo, objectPath, objectName string) error // Download objects from cloud DownloadSnapshotObjects(backupLocation *storkapi.BackupLocation, objectPath string) ([]SnapshotInfo, error) // Delete objects in cloud DeleteSnapshotObject(backupLocation *storkapi.BackupLocation, objectPath string) error // Recreate snapshot resources before doing snapshot restore RecreateSnapshotResources(snapshotInfo SnapshotInfo, snapshotDriverName, namespace string, retain bool) (SnapshotInfo, error) // Retain local snapshots if required RetainLocalSnapshots(backupLocation *storkapi.BackupLocation, snapshotDriverName, snapshotClassName, namespace, pvcUID, objectPath string, retain bool) error // Restore from local snapshot if present RestoreFromLocalSnapshot(backupLocation *storkapi.BackupLocation, pvc *v1.PersistentVolumeClaim, snapshotDriverName, pvcUID, backupUID, objectPath, namespace string) (bool, error) // Cleanup resources if restore from localsnapshot fails CleanUpRestoredResources(backupLocation *storkapi.BackupLocation, pvc *v1.PersistentVolumeClaim, pvcUID, backupUID, objectPath, namespace string) error }
Driver interface provides APIs for a storage provider to take a local snapshot and create a PVC referencing it.
func NewCSIDriver ¶
NewCSIDriver returns the csi implementation of Driver object
type Option ¶
Option is used for snapshot configuration.
func Annotations ¶
Annotations are the annotations applied on the snapshot related objects
func PVC ¶
func PVC(pvc v1.PersistentVolumeClaim) Option
PVC is a persistent volume claim spec to restore snapshot to.
func PVCNamespace ¶
PVCNamespace is a persistent volume claim namespace to make snapshot from.
func RestoreNamespace ¶
RestoreNamespace is the namespace to which a snapshot should be restored to.
func RestoreSnapshotName ¶
RestoreSnapshotName is the snapshot name from which a PVC will be restored
func SnapshotClassName ¶
SnapshotClassName is the name of the VolumeSnapshotClass requested by the VolumeSnapshot.
type Options ¶
type Options struct { // Name is a snapshot name. Name string // Namespace is a snapshot namespace. Namespace string // PVCName is a persistent volume claim name to make snapshot from or restore to. PVCName string // PVCName is a persistent volume claim namespace to make snapshot from or restore to. PVCNamespace string // PVC is a persistent volume claim spec to restore snapshot to. PVC v1.PersistentVolumeClaim // RestoreNamespace is the namespace to which a snapshot should be restored to. RestoreNamespace string // SnapshotClassName is the name of the VolumeSnapshotClass requested by the VolumeSnapshot. SnapshotClassName string // RestoreSnapshotName is the name of the snapshot from which restore will be performed RestoreSnapshotName string // Annotations are the annotations that can be applied on the snapshot related objects Annotations map[string]string // Labels are the labels that can be applied on the snapshot related objects Labels map[string]string }
Options defines all snapshot parameters.
type RestoreInfo ¶
type RestoreInfo struct { // Status provides the current status of snapshot Status Status // Reason provides additional context to the status of the snapshot Reason string // VolumeName is the name of the volume being restored VolumeName string // Size is the size of the PVC being restored Size uint64 }
RestoreInfo provides the current status of Restore operation from a snapshot
type SnapshotInfo ¶
type SnapshotInfo struct { // Status provides the current status of snapshot Status Status // Reason provides additional context to the status of the snapshot Reason string // Size is the actual size of the snapshot Size uint64 // Class defines the driver specific snapshot attributes Class interface{} // SnapshotRequest is the original driver specific snapshot request SnapshotRequest interface{} // Content is the actual volume snapshot of a volume Content interface{} }
SnapshotInfo provides the current state of Snapshot
type Snapshotter ¶
type Snapshotter interface { // Driver returns the driver based on the provided name Driver(name string) (Driver, error) }
Snapshotter inteface returns a Driver object
func NewDefaultSnapshotter ¶
func NewDefaultSnapshotter() Snapshotter
NewDefaultSnapshotter returns the default implementation of Snapshotter