velero

package
v1.13.1 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2024 License: Apache-2.0 Imports: 5 Imported by: 97

Documentation

Overview

Package velero contains the interfaces necessary to implement all of the Velero plugins. Users create their own binary containing implementations of the plugin kinds in this package. Multiple plugins of any type can be implemented.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Applicable added in v1.8.0

type Applicable interface {
	// AppliesTo returns information about which resources this Responder should be invoked for.
	AppliesTo() (ResourceSelector, error)
}

Applicable allows actions and plugins to specify which resources they should be invoked for

type DeleteItemAction added in v1.5.0

type DeleteItemAction interface {
	// AppliesTo returns information about which resources this action should be invoked for.
	// A DeleteItemAction's Execute function will only be invoked on items that match the returned
	// selector. A zero-valued ResourceSelector matches all resources.
	AppliesTo() (ResourceSelector, error)

	// Execute allows the ItemAction to perform arbitrary logic with the item being deleted.
	// An error should be returned if there were problems with the deletion process, but the
	// overall deletion process cannot be stopped.
	// Returned errors are logged.
	Execute(input *DeleteItemActionExecuteInput) error
}

DeleteItemAction is an actor that performs an operation on an individual item being restored.

type DeleteItemActionExecuteInput added in v1.5.0

type DeleteItemActionExecuteInput struct {
	// Item is the item taken from the pristine backed up version of resource.
	Item runtime.Unstructured
	// Backup is the representation of the restore resource processed by Velero.
	Backup *velerov1api.Backup
}

DeleteItemActionExecuteInput contains the input parameters for the ItemAction's Execute function.

type ObjectStore

type ObjectStore interface {
	// Init prepares the ObjectStore for usage using the provided map of
	// configuration key-value pairs. It returns an error if the ObjectStore
	// cannot be initialized from the provided config.
	Init(config map[string]string) error

	// PutObject creates a new object using the data in body within the specified
	// object storage bucket with the given key.
	PutObject(bucket, key string, body io.Reader) error

	// ObjectExists checks if there is an object with the given key in the object storage bucket.
	ObjectExists(bucket, key string) (bool, error)

	// GetObject retrieves the object with the given key from the specified
	// bucket in object storage.
	GetObject(bucket, key string) (io.ReadCloser, error)

	// ListCommonPrefixes gets a list of all object key prefixes that start with
	// the specified prefix and stop at the next instance of the provided delimiter.
	//
	// For example, if the bucket contains the following keys:
	//		a-prefix/foo-1/bar
	// 		a-prefix/foo-1/baz
	//		a-prefix/foo-2/baz
	// 		some-other-prefix/foo-3/bar
	// and the provided prefix arg is "a-prefix/", and the delimiter is "/",
	// this will return the slice {"a-prefix/foo-1/", "a-prefix/foo-2/"}.
	ListCommonPrefixes(bucket, prefix, delimiter string) ([]string, error)

	// ListObjects gets a list of all keys in the specified bucket
	// that have the given prefix.
	ListObjects(bucket, prefix string) ([]string, error)

	// DeleteObject removes the object with the specified key from the given
	// bucket.
	DeleteObject(bucket, key string) error

	// CreateSignedURL creates a pre-signed URL for the given bucket and key that expires after ttl.
	CreateSignedURL(bucket, key string, ttl time.Duration) (string, error)
}

ObjectStore exposes basic object-storage operations required by Velero.

type OperationProgress added in v1.11.0

type OperationProgress struct {
	// True when the operation has completed, either successfully or with a failure
	Completed bool
	// Set when the operation has failed
	Err string
	// Quantity completed so far and the total quantity associated with the operation
	// in OperationUnits. For data mover and volume snapshotter use cases, this will
	// usually be in bytes. On successful completion, NCompleted and NTotal should be
	// the same
	NCompleted, NTotal int64
	// Units represented by NCompleted and NTotal -- for data mover and item
	// snapshotters, this will usually be bytes.
	OperationUnits string
	// Optional description of operation progress (i.e. "Current phase: Running")
	Description string
	// When the operation was started and when the last update was seen.  Not all
	// systems retain when the upload was begun, return Time 0 (time.Unix(0, 0))
	// if unknown.
	Started, Updated time.Time
}

OperationProgress describes progress of an asynchronous plugin operation.

type ResourceIdentifier

type ResourceIdentifier struct {
	schema.GroupResource
	Namespace string
	Name      string
}

ResourceIdentifier describes a single item by its group, resource, namespace, and name.

func (*ResourceIdentifier) DeepCopy added in v1.11.0

func (in *ResourceIdentifier) DeepCopy() *ResourceIdentifier

func (*ResourceIdentifier) DeepCopyInto added in v1.11.0

func (in *ResourceIdentifier) DeepCopyInto(out *ResourceIdentifier)

type ResourceSelector

type ResourceSelector struct {
	// IncludedNamespaces is a slice of namespace names to match. All
	// namespaces in this slice, except those in ExcludedNamespaces,
	// will be matched. A nil/empty slice matches all namespaces.
	IncludedNamespaces []string
	// ExcludedNamespaces is a slice of namespace names to exclude.
	// All namespaces in IncludedNamespaces, *except* those in
	// this slice, will be matched.
	ExcludedNamespaces []string
	// IncludedResources is a slice of resources to match. Resources may be specified
	// as full names (e.g. "services"), abbreviations (e.g. "svc"), or with the
	// groups they are in (e.g. "ingresses.extensions"). All resources in this slice,
	// except those in ExcludedResources, will be matched. A nil/empty slice matches
	// all resources.
	IncludedResources []string
	// ExcludedResources is a slice of resources to exclude. Resources may be specified
	// as full names (e.g. "services"), abbreviations (e.g. "svc"), or with the
	// groups they are in (e.g. "ingresses.extensions"). All resources in IncludedResources,
	// *except* those in this slice, will be matched.
	ExcludedResources []string
	// LabelSelector is a string representation of a selector to apply
	// when matching resources. See "k8s.io/apimachinery/pkg/labels".Parse()
	// for details on syntax.
	LabelSelector string
}

ResourceSelector is a collection of included/excluded namespaces, included/excluded resources, and a label-selector that can be used to match a set of items from a cluster.

type RestoreItemActionExecuteInput

type RestoreItemActionExecuteInput struct {
	// Item is the item being restored. It is likely different from the pristine backed up version
	// (metadata reset, changed by various restore item action plugins, etc.).
	Item runtime.Unstructured
	// ItemFromBackup is the item taken from the pristine backed up version of resource.
	ItemFromBackup runtime.Unstructured
	// Restore is the representation of the restore resource processed by Velero.
	Restore *api.Restore
}

RestoreItemActionExecuteInput contains the input parameters for the ItemAction's Execute function.

type RestoreItemActionExecuteOutput

type RestoreItemActionExecuteOutput struct {
	// UpdatedItem is the item being restored mutated by ItemAction.
	UpdatedItem runtime.Unstructured

	// AdditionalItems is a list of additional related items that should
	// be restored.
	AdditionalItems []ResourceIdentifier

	// SkipRestore tells velero to stop executing further actions
	// on this item, and skip the restore step. When this field's
	// value is true, AdditionalItems will be ignored.
	SkipRestore bool

	// v2 and later
	// OperationID is an identifier which indicates an ongoing asynchronous action which Velero will
	// continue to monitor after restoring this item. If left blank, then there is no ongoing operation.
	OperationID string

	// v2 and later
	// WaitForAdditionalItems determines whether velero will wait
	// until AreAdditionalItemsReady returns true before restoring
	// this item. If this field's value is true, then after restoring
	// the returned AdditionalItems, velero will not restore this item
	// until AreAdditionalItemsReady returns true or the timeout is
	// reached. Otherwise, AreAdditionalItemsReady is not called.
	WaitForAdditionalItems bool

	// v2 and later
	// AdditionalItemsReadyTimeout will override serverConfig.additionalItemsReadyTimeout
	// if specified. This value specifies how long velero will wait
	// for additional items to be ready before moving on.
	AdditionalItemsReadyTimeout time.Duration
}

RestoreItemActionExecuteOutput contains the output variables for the ItemAction's Execution function.

func NewRestoreItemActionExecuteOutput

func NewRestoreItemActionExecuteOutput(item runtime.Unstructured) *RestoreItemActionExecuteOutput

NewRestoreItemActionExecuteOutput creates a new RestoreItemActionExecuteOutput

func (*RestoreItemActionExecuteOutput) WithItemsWait added in v1.11.0

WithItemsWait returns RestoreItemActionExecuteOutput with WaitForAdditionalItems set to true.

func (*RestoreItemActionExecuteOutput) WithOperationID added in v1.11.0

func (r *RestoreItemActionExecuteOutput) WithOperationID(operationID string) *RestoreItemActionExecuteOutput

WithOperationID returns RestoreItemActionExecuteOutput with OperationID set.

func (*RestoreItemActionExecuteOutput) WithoutRestore

WithoutRestore returns SkipRestore for RestoreItemActionExecuteOutput

Directories

Path Synopsis
backupitemaction
v1
v2
restoreitemaction
v1
v2
volumesnapshotter
v1

Jump to

Keyboard shortcuts

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