restore

package
Version: v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2021 License: Apache-2.0 Imports: 57 Imported by: 14

Documentation

Overview

Copyright 2018 the Velero contributors.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

View Source
const KubeAnnBindCompleted = "pv.kubernetes.io/bind-completed"

These annotations are taken from the Kubernetes persistent volume/persistent volume claim controller. They cannot be directly importing because they are part of the kubernetes/kubernetes package, and importing that package is unsupported. Their values are well-known and slow changing. They're duplicated here as constants to provide compile-time checking. Originals can be found in kubernetes/kubernetes/pkg/controller/volume/persistentvolume/util/util.go.

View Source
const KubeAnnBoundByController = "pv.kubernetes.io/bound-by-controller"
View Source
const KubeAnnDynamicallyProvisioned = "pv.kubernetes.io/provisioned-by"

Variables

This section is empty.

Functions

This section is empty.

Types

type APIServiceAction added in v1.6.3

type APIServiceAction struct {
	// contains filtered or unexported fields
}

func NewAPIServiceAction added in v1.6.3

func NewAPIServiceAction(logger logrus.FieldLogger) *APIServiceAction

NewAPIServiceAction returns an APIServiceAction which is a RestoreItemAction plugin that will skip the restore of any APIServices which are managed by Kubernetes. This is determined by looking for the "kube-aggregator.kubernetes.io/automanaged" label on the APIService.

func (*APIServiceAction) AppliesTo added in v1.6.3

func (a *APIServiceAction) AppliesTo() (velero.ResourceSelector, error)

func (*APIServiceAction) Execute added in v1.6.3

type AddPVCFromPodAction added in v1.0.0

type AddPVCFromPodAction struct {
	// contains filtered or unexported fields
}

func NewAddPVCFromPodAction added in v1.0.0

func NewAddPVCFromPodAction(logger logrus.FieldLogger) *AddPVCFromPodAction

func (*AddPVCFromPodAction) AppliesTo added in v1.0.0

func (*AddPVCFromPodAction) Execute added in v1.0.0

type AddPVFromPVCAction added in v1.0.0

type AddPVFromPVCAction struct {
	// contains filtered or unexported fields
}

func NewAddPVFromPVCAction added in v1.0.0

func NewAddPVFromPVCAction(logger logrus.FieldLogger) *AddPVFromPVCAction

func (*AddPVFromPVCAction) AppliesTo added in v1.0.0

func (a *AddPVFromPVCAction) AppliesTo() (velero.ResourceSelector, error)

func (*AddPVFromPVCAction) Execute added in v1.0.0

type CRDV1PreserveUnknownFieldsAction added in v1.3.0

type CRDV1PreserveUnknownFieldsAction struct {
	// contains filtered or unexported fields
}

CRDV1PreserveUnknownFieldsAction will take a CRD and inspect it for the API version and the PreserveUnknownFields value. If the API Version is 1 and the PreserveUnknownFields value is True, then the x-preserve-unknown-fields value in the OpenAPIV3 schema will be set to True and PreserveUnknownFields set to False in order to allow Kubernetes 1.16+ servers to accept the object.

func NewCRDV1PreserveUnknownFieldsAction added in v1.3.0

func NewCRDV1PreserveUnknownFieldsAction(logger logrus.FieldLogger) *CRDV1PreserveUnknownFieldsAction

func (*CRDV1PreserveUnknownFieldsAction) AppliesTo added in v1.3.0

func (*CRDV1PreserveUnknownFieldsAction) Execute added in v1.3.0

type ChangePVCNodeSelectorAction added in v1.4.0

type ChangePVCNodeSelectorAction struct {
	// contains filtered or unexported fields
}

ChangePVCNodeSelectorAction updates/reset PVC's node selector if a mapping is found in the plugin's config map.

func NewChangePVCNodeSelectorAction added in v1.4.0

func NewChangePVCNodeSelectorAction(
	logger logrus.FieldLogger,
	configMapClient corev1client.ConfigMapInterface,
	nodeClient corev1client.NodeInterface,
) *ChangePVCNodeSelectorAction

NewChangePVCNodeSelectorAction is the constructor for ChangePVCNodeSelectorAction.

func (*ChangePVCNodeSelectorAction) AppliesTo added in v1.4.0

AppliesTo returns the resources that ChangePVCNodeSelectorAction should be run for

func (*ChangePVCNodeSelectorAction) Execute added in v1.4.0

Execute updates the pvc's selected-node annotation:

   a) if node mapping found in the config map for the plugin
	  b) if node mentioned in annotation doesn't exist

type ChangeStorageClassAction added in v1.0.1

type ChangeStorageClassAction struct {
	// contains filtered or unexported fields
}

ChangeStorageClassAction updates a PV or PVC's storage class name if a mapping is found in the plugin's config map.

func NewChangeStorageClassAction added in v1.0.1

func NewChangeStorageClassAction(
	logger logrus.FieldLogger,
	configMapClient corev1client.ConfigMapInterface,
	storageClassClient storagev1client.StorageClassInterface,
) *ChangeStorageClassAction

NewChangeStorageClassAction is the constructor for ChangeStorageClassAction.

func (*ChangeStorageClassAction) AppliesTo added in v1.0.1

AppliesTo returns the resources that ChangeStorageClassAction should be run for.

func (*ChangeStorageClassAction) Execute added in v1.0.1

Execute updates the item's spec.storageClassName if a mapping is found in the config map for the plugin.

type ChosenGroupVersion added in v1.6.0

type ChosenGroupVersion struct {
	Group   string
	Version string
	Dir     string
}

ChosenGroupVersion is the API Group version that was selected to restore from potentially multiple backed up version enabled by the feature flag APIGroupVersionsFeatureFlag

type ClusterRoleBindingAction added in v1.2.0

type ClusterRoleBindingAction struct {
	// contains filtered or unexported fields
}

ClusterRoleBindingAction handle namespace remappings for role bindings

func NewClusterRoleBindingAction added in v1.2.0

func NewClusterRoleBindingAction(logger logrus.FieldLogger) *ClusterRoleBindingAction

func (*ClusterRoleBindingAction) AppliesTo added in v1.2.0

func (*ClusterRoleBindingAction) Execute added in v1.2.0

type InitRestoreHookPodAction added in v1.5.0

type InitRestoreHookPodAction struct {
	// contains filtered or unexported fields
}

InitRestoreHookPodAction is a RestoreItemAction plugin applicable to pods that runs restore hooks to add init containers to pods prior to them being restored.

func NewInitRestoreHookPodAction added in v1.5.0

func NewInitRestoreHookPodAction(logger logrus.FieldLogger) *InitRestoreHookPodAction

NewInitRestoreHookPodAction returns a new InitRestoreHookPodAction.

func (*InitRestoreHookPodAction) AppliesTo added in v1.5.0

AppliesTo implements the RestoreItemAction plugin interface method.

func (*InitRestoreHookPodAction) Execute added in v1.5.0

Execute implements the RestoreItemAction plugin interface method.

type JobAction added in v1.0.0

type JobAction struct {
	// contains filtered or unexported fields
}

func NewJobAction added in v0.6.0

func NewJobAction(logger logrus.FieldLogger) *JobAction

func (*JobAction) AppliesTo added in v1.0.0

func (a *JobAction) AppliesTo() (velero.ResourceSelector, error)

func (*JobAction) Execute added in v1.0.0

type PVRestorer added in v0.9.0

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

type PodAction added in v1.0.0

type PodAction struct {
	// contains filtered or unexported fields
}

func NewPodAction added in v0.6.0

func NewPodAction(logger logrus.FieldLogger) *PodAction

func (*PodAction) AppliesTo added in v1.0.0

func (a *PodAction) AppliesTo() (velero.ResourceSelector, error)

func (*PodAction) Execute added in v1.0.0

type Request added in v1.0.1

type Request struct {
	*velerov1api.Restore

	Log              logrus.FieldLogger
	Backup           *velerov1api.Backup
	PodVolumeBackups []*velerov1api.PodVolumeBackup
	VolumeSnapshots  []*volume.Snapshot
	BackupReader     io.Reader
}

type ResticRestoreAction added in v1.0.0

type ResticRestoreAction struct {
	// contains filtered or unexported fields
}

func NewResticRestoreAction added in v0.9.0

func NewResticRestoreAction(logger logrus.FieldLogger, client corev1client.ConfigMapInterface, podVolumeBackupClient velerov1client.PodVolumeBackupInterface) *ResticRestoreAction

func (*ResticRestoreAction) AppliesTo added in v1.0.0

func (*ResticRestoreAction) Execute added in v1.0.0

type Restorer

type Restorer interface {
	// Restore restores the backup data from backupReader, returning warnings and errors.
	Restore(req Request,
		actions []velero.RestoreItemAction,
		snapshotLocationLister listers.VolumeSnapshotLocationLister,
		volumeSnapshotterGetter VolumeSnapshotterGetter,
	) (Result, Result)
}

Restorer knows how to restore a backup.

func NewKubernetesRestorer

func NewKubernetesRestorer(
	restoreClient velerov1client.RestoresGetter,
	discoveryHelper discovery.Helper,
	dynamicFactory client.DynamicFactory,
	resourcePriorities []string,
	namespaceClient corev1.NamespaceInterface,
	resticRestorerFactory restic.RestorerFactory,
	resticTimeout time.Duration,
	resourceTerminatingTimeout time.Duration,
	logger logrus.FieldLogger,
	podCommandExecutor podexec.PodCommandExecutor,
	podGetter cache.Getter,
) (Restorer, error)

NewKubernetesRestorer creates a new kubernetesRestorer.

type Result added in v1.0.0

type Result struct {
	// Velero is a slice of messages related to the operation of Velero
	// itself (for example, messages related to connecting to the
	// cloud, reading a backup file, etc.)
	Velero []string `json:"velero,omitempty"`

	// Cluster is a slice of messages related to restoring cluster-
	// scoped resources.
	Cluster []string `json:"cluster,omitempty"`

	// Namespaces is a map of namespace name to slice of messages
	// related to restoring namespace-scoped resources.
	Namespaces map[string][]string `json:"namespaces,omitempty"`
}

Result is a collection of messages that were generated during execution of a restore. This will typically store either warning or error messages.

func (*Result) Add added in v1.3.0

func (r *Result) Add(ns string, e error)

Add appends an error to the provided Result, either within the cluster-scoped list (if ns == "") or within the provided namespace's entry.

func (*Result) AddVeleroError added in v1.3.0

func (r *Result) AddVeleroError(err error)

AddVeleroError appends an error to the provided Result's Velero list.

func (*Result) Merge added in v1.3.0

func (r *Result) Merge(other *Result)

Merge combines two Result objects into one by appending the corresponding lists to one another.

type RoleBindingAction added in v1.2.0

type RoleBindingAction struct {
	// contains filtered or unexported fields
}

RoleBindingAction handle namespace remappings for role bindings

func NewRoleBindingAction added in v1.2.0

func NewRoleBindingAction(logger logrus.FieldLogger) *RoleBindingAction

func (*RoleBindingAction) AppliesTo added in v1.2.0

func (a *RoleBindingAction) AppliesTo() (velero.ResourceSelector, error)

func (*RoleBindingAction) Execute added in v1.2.0

type ServiceAccountAction added in v1.0.0

type ServiceAccountAction struct {
	// contains filtered or unexported fields
}

func NewServiceAccountAction added in v0.10.1

func NewServiceAccountAction(logger logrus.FieldLogger) *ServiceAccountAction

func (*ServiceAccountAction) AppliesTo added in v1.0.0

func (*ServiceAccountAction) Execute added in v1.0.0

type ServiceAction added in v1.0.0

type ServiceAction struct {
	// contains filtered or unexported fields
}

func NewServiceAction added in v0.6.0

func NewServiceAction(logger logrus.FieldLogger) *ServiceAction

func (*ServiceAction) AppliesTo added in v1.0.0

func (a *ServiceAction) AppliesTo() (velero.ResourceSelector, error)

func (*ServiceAction) Execute added in v1.0.0

type VolumeSnapshotterGetter added in v1.0.0

type VolumeSnapshotterGetter interface {
	GetVolumeSnapshotter(name string) (velero.VolumeSnapshotter, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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