repository

package
v1.14.1 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2024 License: Apache-2.0 Imports: 25 Imported by: 6

Documentation

Index

Constants

View Source
const DefaultKeepLatestMaitenanceJobs = 3
View Source
const DefaultMaintenanceJobCPULimit = "0"
View Source
const DefaultMaintenanceJobCPURequest = "0"
View Source
const DefaultMaintenanceJobMemLimit = "0"
View Source
const DefaultMaintenanceJobMemRequest = "0"
View Source
const RepositoryNameLabel = "velero.io/repo-name"

Variables

This section is empty.

Functions

func GetBackupRepository

func GetBackupRepository(ctx context.Context, cli client.Client, namespace string, key BackupRepositoryKey, options ...bool) (*velerov1api.BackupRepository, error)

GetBackupRepository gets a backup repository through BackupRepositoryKey and ensure ready if required.

func NewBackupRepository added in v1.12.0

func NewBackupRepository(namespace string, key BackupRepositoryKey) *velerov1api.BackupRepository

Types

type BackupRepositoryKey

type BackupRepositoryKey struct {
	VolumeNamespace string
	BackupLocation  string
	RepositoryType  string
}

A BackupRepositoryKey uniquely identify a backup repository

type Ensurer added in v1.12.0

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

Ensurer ensures that backup repositories are created and ready.

func NewEnsurer added in v1.12.0

func NewEnsurer(repoClient client.Client, log logrus.FieldLogger, resourceTimeout time.Duration) *Ensurer

func (*Ensurer) EnsureRepo added in v1.12.0

func (r *Ensurer) EnsureRepo(ctx context.Context, namespace, volumeNamespace, backupLocation, repositoryType string) (*velerov1api.BackupRepository, error)

type MaintenanceConfig added in v1.14.0

type MaintenanceConfig struct {
	KeepLatestMaitenanceJobs int
	CPURequest               string
	MemRequest               string
	CPULimit                 string
	MemLimit                 string
	LogLevelFlag             *logging.LevelFlag
	FormatFlag               *logging.FormatFlag
}

MaintenanceConfig is the configuration for the repo maintenance job

type Manager

type Manager interface {
	// InitRepo initializes a repo with the specified name and identifier.
	InitRepo(repo *velerov1api.BackupRepository) error

	// ConnectToRepo tries to connect to the specified repo, and returns an error if it fails.
	// This is intended to be used to ensure that the repo exists/can be authenticated to.
	ConnectToRepo(repo *velerov1api.BackupRepository) error

	// PrepareRepo tries to connect to the specific repo first, if it fails because of the
	// repo is not initialized, it turns to initialize the repo
	PrepareRepo(repo *velerov1api.BackupRepository) error

	// PruneRepo deletes unused data from a repo.
	PruneRepo(repo *velerov1api.BackupRepository) error

	// UnlockRepo removes stale locks from a repo.
	UnlockRepo(repo *velerov1api.BackupRepository) error

	// Forget removes a snapshot from the list of
	// available snapshots in a repo.
	Forget(context.Context, *velerov1api.BackupRepository, string) error

	// BatchForget removes a list of snapshots from the list of
	// available snapshots in a repo.
	BatchForget(context.Context, *velerov1api.BackupRepository, []string) []error

	// DefaultMaintenanceFrequency returns the default maintenance frequency from the specific repo
	DefaultMaintenanceFrequency(repo *velerov1api.BackupRepository) (time.Duration, error)
}

Manager manages backup repositories.

func NewManager

func NewManager(
	namespace string,
	client client.Client,
	repoLocker *RepoLocker,
	repoEnsurer *Ensurer,
	credentialFileStore credentials.FileStore,
	credentialSecretStore credentials.SecretStore,
	maintenanceCfg MaintenanceConfig,
	log logrus.FieldLogger,
) Manager

NewManager create a new repository manager.

type RepoLocker

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

RepoLocker manages exclusive/non-exclusive locks for operations against backup repositories. The semantics of exclusive/non-exclusive locks are the same as for a sync.RWMutex, where a non-exclusive lock is equivalent to a read lock, and an exclusive lock is equivalent to a write lock.

func NewRepoLocker

func NewRepoLocker() *RepoLocker

func (*RepoLocker) Lock

func (rl *RepoLocker) Lock(name string)

Lock acquires a non-exclusive lock for the specified repository. This function blocks until no exclusive locks exist for the repo.

func (*RepoLocker) LockExclusive

func (rl *RepoLocker) LockExclusive(name string)

LockExclusive acquires an exclusive lock for the specified repository. This function blocks until no other locks exist for the repo.

func (*RepoLocker) Unlock

func (rl *RepoLocker) Unlock(name string)

Unlock releases a non-exclusive lock for the repo.

func (*RepoLocker) UnlockExclusive

func (rl *RepoLocker) UnlockExclusive(name string)

UnlockExclusive releases an exclusive lock for the repo.

type SnapshotIdentifier

type SnapshotIdentifier struct {
	// VolumeNamespace is the namespace of the pod/volume that
	// the snapshot is for.
	VolumeNamespace string `json:"volumeNamespace"`

	// BackupStorageLocation is the backup's storage location
	// name.
	BackupStorageLocation string `json:"backupStorageLocation"`

	// SnapshotID is the short ID of the snapshot.
	SnapshotID string `json:"snapshotID"`

	// RepositoryType is the type of the repository where the
	// snapshot is stored
	RepositoryType string `json:"repositoryType"`

	// Source is the source of the data saved in the repo by the snapshot
	Source string `json:"source"`

	// UploaderType is the type of uploader which saved the snapshot data
	UploaderType string `json:"uploaderType"`

	// RepoIdentifier is the identifier of the repository where the
	// snapshot is stored
	RepoIdentifier string `json:"repoIdentifier"`
}

SnapshotIdentifier uniquely identifies a snapshot taken by Velero.

Jump to

Keyboard shortcuts

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