backup

package
v1.15.0 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2023 License: Apache-2.0 Imports: 25 Imported by: 3

Documentation

Index

Constants

View Source
const (
	AWSAccessKeySecretKey            = "AWS_ACCESS_KEY_ID"
	AWSSecretAccessKeySecretKey      = "AWS_SECRET_ACCESS_KEY"
	AzureStorageAccountNameSecretKey = "AZURE_STORAGE_ACCOUNT_NAME"
	AzureStorageAccountKeySecretKey  = "AZURE_STORAGE_ACCOUNT_KEY"
)

Variables

This section is empty.

Functions

func AgentContainer

func AgentContainer(cr *api.PerconaServerMongoDB, replsetName string) corev1.Container

AgentContainer creates the container object for a backup agent

func BackupFromTask added in v1.13.0

func GetPBMConfig added in v1.14.0

func GetPBMConfig(ctx context.Context, k8sclient client.Client, cluster *api.PerconaServerMongoDB, stg api.BackupStorageSpec) (pbm.Config, error)

func GetPriorities added in v1.14.0

func GetPriorities(ctx context.Context, k8sclient client.Client, cluster *api.PerconaServerMongoDB) (map[string]float64, error)

GetPriorities returns priorities to be used in PBM config.

func HasActiveJobs added in v1.4.0

func HasActiveJobs(ctx context.Context, newPBMFunc NewPBMFunc, cl client.Client, cluster *api.PerconaServerMongoDB, current Job, allowLock ...LockHeaderPredicate) (bool, error)

HasActiveJobs returns true if there are running backups or restores in given cluster and namespace

func IsPITRLock added in v1.8.0

func IsPITRLock(l pbm.LockHeader) bool

func NewBackupCronJobLabels added in v1.2.0

func NewBackupCronJobLabels(crName string, labels map[string]string) map[string]string

func NotPITRLock added in v1.8.0

func NotPITRLock(l pbm.LockHeader) bool

Types

type Job added in v1.4.0

type Job struct {
	Name string
	Type JobType
}

func NewBackupJob added in v1.8.0

func NewBackupJob(name string) Job

func NewRestoreJob added in v1.8.0

func NewRestoreJob(cr *api.PerconaServerMongoDBRestore) Job

type JobType added in v1.4.0

type JobType int
const (
	TypeBackup JobType = iota
	TypeRestore
	TypePITRestore
)

type LockHeaderPredicate added in v1.8.0

type LockHeaderPredicate func(pbm.LockHeader) bool

func NotJobLock added in v1.8.0

func NotJobLock(j Job) LockHeaderPredicate

type NewPBMFunc added in v1.15.0

type NewPBMFunc func(ctx context.Context, c client.Client, cluster *api.PerconaServerMongoDB) (PBM, error)

type PBM added in v1.4.0

type PBM interface {
	Conn() *mongo.Client

	GetPITRChunkContains(ctx context.Context, unixTS int64) (*pbm.OplogChunk, error)
	GetLatestTimelinePITR() (pbm.Timeline, error)
	PITRGetChunksSlice(rs string, from, to primitive.Timestamp) ([]pbm.OplogChunk, error)

	Logger() *pbmLog.Logger
	GetStorage(l *pbmLog.Event) (storage.Storage, error)
	ResyncStorage(l *pbmLog.Event) error
	SendCmd(cmd pbm.Cmd) error
	Close(ctx context.Context) error
	HasLocks(predicates ...LockHeaderPredicate) (bool, error)

	GetRestoreMeta(name string) (*pbm.RestoreMeta, error)
	GetBackupMeta(name string) (*pbm.BackupMeta, error)
	DeleteBackup(name string, l *pbmLog.Event) error

	SetConfig(ctx context.Context, k8sclient client.Client, cluster *api.PerconaServerMongoDB, stg api.BackupStorageSpec) error
	SetConfigVar(key, val string) error
	GetConfigVar(key string) (any, error)
	DeleteConfigVar(key string) error

	Node() (string, error)
}

func NewPBM added in v1.4.0

func NewPBM(ctx context.Context, c client.Client, cluster *api.PerconaServerMongoDB) (PBM, error)

NewPBM creates a new connection to PBM. It should be closed after the last use with.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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