backup

package
v0.11.1-beta.1 Latest Latest
Warning

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

Go to latest
Published: May 3, 2019 License: Apache-2.0 Imports: 35 Imported by: 0

Documentation

Index

Constants

View Source
const BackupVersion = 1

BackupVersion is the current backup version for Velero.

Variables

This section is empty.

Functions

func NewClusterRoleBindingListerMap added in v0.9.1

func NewClusterRoleBindingListerMap(clientset kubernetes.Interface) map[string]ClusterRoleBindingLister

NewClusterRoleBindingListerMap creates a map of RBAC version strings to their associated ClusterRoleBindingLister structs. Necessary so that callers to the ClusterRoleBindingLister interfaces don't need the kubernetes.Interface.

func NewDeleteBackupRequest added in v0.8.0

func NewDeleteBackupRequest(name string, uid string) *v1.DeleteBackupRequest

NewDeleteBackupRequest creates a DeleteBackupRequest for the backup identified by name and uid.

func NewDeleteBackupRequestListOptions added in v0.8.0

func NewDeleteBackupRequestListOptions(name, uid string) metav1.ListOptions

NewDeleteBackupRequestListOptions creates a ListOptions with a label selector configured to find DeleteBackupRequests for the backup identified by name and uid.

Types

type Backupper

type Backupper interface {
	// Backup takes a backup using the specification in the api.Backup and writes backup and log data
	// to the given writers.
	Backup(logger logrus.FieldLogger, backup *Request, backupFile io.Writer, actions []ItemAction, blockStoreGetter BlockStoreGetter) error
}

Backupper performs backups.

func NewKubernetesBackupper

func NewKubernetesBackupper(
	discoveryHelper discovery.Helper,
	dynamicFactory client.DynamicFactory,
	podCommandExecutor podexec.PodCommandExecutor,
	resticBackupperFactory restic.BackupperFactory,
	resticTimeout time.Duration,
) (Backupper, error)

NewKubernetesBackupper creates a new kubernetesBackupper.

type BlockStoreGetter added in v0.10.0

type BlockStoreGetter interface {
	GetBlockStore(name string) (cloudprovider.BlockStore, error)
}

type ClusterRoleBinding added in v0.9.1

type ClusterRoleBinding interface {
	// Name returns the name of a ClusterRoleBinding.
	Name() string
	// ServiceAccountSubjects returns the names of subjects that are service accounts in the given namespace.
	ServiceAccountSubjects(namespace string) []string
	// RoleRefName returns the name of a ClusterRoleBinding's RoleRef.
	RoleRefName() string
}

ClusterRoleBinding abstracts access to ClusterRoleBindings whether they're v1 or v1beta1.

type ClusterRoleBindingLister added in v0.9.1

type ClusterRoleBindingLister interface {
	// List returns a slice of ClusterRoleBindings which can represent either v1 or v1beta1 ClusterRoleBindings.
	List() ([]ClusterRoleBinding, error)
}

ClusterRoleBindingLister allows for listing ClusterRoleBindings in a version-independent way.

type ItemAction added in v0.6.0

type ItemAction interface {
	// AppliesTo returns information about which resources this action should be invoked for.
	// An ItemAction'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 backed up,
	// including mutating the item itself prior to backup. The item (unmodified or modified)
	// should be returned, along with an optional slice of ResourceIdentifiers specifying
	// additional related items that should be backed up.
	Execute(item runtime.Unstructured, backup *api.Backup) (runtime.Unstructured, []ResourceIdentifier, error)
}

ItemAction is an actor that performs an operation on an individual item being backed up.

func NewBackupPVAction added in v0.5.0

func NewBackupPVAction(logger logrus.FieldLogger) ItemAction

func NewPodAction added in v0.7.0

func NewPodAction(logger logrus.FieldLogger) ItemAction

NewPodAction creates a new ItemAction for pods.

func NewServiceAccountAction added in v0.9.0

func NewServiceAccountAction(logger logrus.FieldLogger, clusterRoleBindingListers map[string]ClusterRoleBindingLister, discoveryHelper velerodiscovery.Helper) (ItemAction, error)

NewServiceAccountAction creates a new ItemAction for service accounts.

type ItemBackupper added in v0.5.0

type ItemBackupper interface {
	// contains filtered or unexported methods
}

type Request added in v0.10.0

type Request struct {
	*velerov1api.Backup

	StorageLocation           *velerov1api.BackupStorageLocation
	SnapshotLocations         []*velerov1api.VolumeSnapshotLocation
	NamespaceIncludesExcludes *collections.IncludesExcludes
	ResourceIncludesExcludes  *collections.IncludesExcludes
	ResourceHooks             []resourceHook
	ResolvedActions           []resolvedAction

	VolumeSnapshots []*volume.Snapshot
}

Request is a request for a backup, with all references to other objects materialized (e.g. backup/snapshot locations, includes/excludes, etc.)

type ResourceIdentifier added in v0.5.0

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

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

type ResourceSelector added in v0.6.0

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") or abbreviations
	// (e.g. "svc"). 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") or
	// abbreviations (e.g. "svc"). 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.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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