Documentation ¶
Index ¶
- Constants
- func DeleteOldMaintenanceJobs(cli client.Client, repo string, keep int) error
- func GenerateJobName(repo string) string
- func GetBackupRepository(ctx context.Context, cli client.Client, namespace string, ...) (*velerov1api.BackupRepository, error)
- func GetLatestMaintenanceJob(cli client.Client, ns string) (*batchv1.Job, error)
- func GetMaintenanceResultFromJob(cli client.Client, job *batchv1.Job) (string, error)
- func NewBackupRepository(namespace string, key BackupRepositoryKey) *velerov1api.BackupRepository
- func WaitForJobComplete(ctx context.Context, client client.Client, job *batchv1.Job) error
- type BackupRepositoryKey
- type Ensurer
- type JobConfigs
- type RepoLocker
Constants ¶
const ( RepositoryNameLabel = "velero.io/repo-name" GlobalKeyForRepoMaintenanceJobCM = "global" )
Variables ¶
This section is empty.
Functions ¶
func DeleteOldMaintenanceJobs ¶ added in v1.15.0
DeleteOldMaintenanceJobs deletes old maintenance jobs and keeps the latest N jobs
func GenerateJobName ¶ added in v1.15.0
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 GetLatestMaintenanceJob ¶ added in v1.15.0
func GetMaintenanceResultFromJob ¶ added in v1.15.0
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 (*Ensurer) EnsureRepo ¶ added in v1.12.0
func (r *Ensurer) EnsureRepo(ctx context.Context, namespace, volumeNamespace, backupLocation, repositoryType string) (*velerov1api.BackupRepository, error)
type JobConfigs ¶ added in v1.15.0
type JobConfigs struct { // LoadAffinities is the config for repository maintenance job load affinity. LoadAffinities []*kube.LoadAffinity `json:"loadAffinity,omitempty"` // PodResources is the config for the CPU and memory resources setting. PodResources *kube.PodResources `json:"podResources,omitempty"` }
func GetMaintenanceJobConfig ¶ added in v1.15.0
func GetMaintenanceJobConfig( ctx context.Context, client client.Client, logger logrus.FieldLogger, veleroNamespace string, repoMaintenanceJobConfig string, repo *velerov1api.BackupRepository, ) (*JobConfigs, error)
GetMaintenanceJobConfig is called to get the Maintenance Job Config for the BackupRepository specified by the repo parameter.
Params:
ctx: the Go context used for controller-runtime client. client: the controller-runtime client. logger: the logger. veleroNamespace: the Velero-installed namespace. It's used to retrieve the BackupRepository. repoMaintenanceJobConfig: the repository maintenance job ConfigMap name. repo: the BackupRepository needs to run the maintenance Job.
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.