controller

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2024 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// Sometimes, leap seconds or time differences between systems may cause a
	// backup to exist *just* before its schedule. For example, a situation has
	// been observed where a backup was scheduled at 12:00:00 UTC, but its
	// eventual creationDate was 11:59:59 UTC. This then causes another backup
	// to be executed at 12:00:00, i.e. two backups within a very small time
	// interval. To prevent this, we have a certain tolerance that allows a
	// backup to be created just before its scheduled time, to act as a backup
	// considered at that scheduled time. This is expressed as a percentage of
	// the normal interval.
	// For example, if the schedule is @hourly, the normal interval is 3600
	// seconds. A tolerance factor of 1% (0.01) means a tolerance of 36 seconds,
	// i.e. a backup created after 11:59:24 or later will be considered scheduled
	// at 12:00:00, so the next backup will be created at 13:00:00 in this case.
	ScheduleIntervalTolerance = 0.01

	// Default time-to-live for newly created backups: 3 days.
	DefaultTTL = 3 * 24 * time.Hour
)
View Source
var (
	BackupScheduleAnnotation     = "backsnap.skyb.it/schedule"
	CurrentlyRestoringAnnotation = "backsnap.skyb.it/restoring"
)

Functions

This section is empty.

Types

type AutomaticPVCBackupCreator

type AutomaticPVCBackupCreator struct {
	client.Client
	Scheme *runtime.Scheme
	Clock
	DefaultSchedule   string
	Namespaces        []string
	ExcludeNamespaces []string
}

func (*AutomaticPVCBackupCreator) Reconcile

func (*AutomaticPVCBackupCreator) SetupWithManager

func (r *AutomaticPVCBackupCreator) SetupWithManager(mgr ctrl.Manager) error

type BackupSettings

type BackupSettings struct {
	SnapshotClass   string
	StorageClass    string
	ImagePullSecret string
	Image           string
	// S3 hostname (can be host, host:port or http://host:port/)
	S3Host            string
	S3Bucket          string
	S3AccessKeyId     string
	S3SecretAccessKey string
	ResticPassword    string
}

type Clock

type Clock interface {
	Now() time.Time
}

type PVCBackupReconciler

type PVCBackupReconciler struct {
	client.Client
	Scheme *runtime.Scheme
	Clock
	MaxRunningBackups   int
	SleepBetweenBackups int
	Namespaces          []string
	ExcludeNamespaces   []string
	BackupSettings      BackupSettings

	CurrentRunningBackups map[string]struct{}
}

PVCBackupReconciler reconciles a PVCBackup object

func (*PVCBackupReconciler) FindCurrentRunningBackups added in v0.3.0

func (r *PVCBackupReconciler) FindCurrentRunningBackups(ctx context.Context) error

func (*PVCBackupReconciler) Reconcile

func (r *PVCBackupReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)

nolint: gocyclo

func (*PVCBackupReconciler) SetupWithManager

func (r *PVCBackupReconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manager) error

SetupWithManager sets up the controller with the Manager.

type PVCRestoreReconciler

type PVCRestoreReconciler struct {
	client.Client
	Scheme *runtime.Scheme

	Namespaces        []string
	ExcludeNamespaces []string
	BackupSettings    BackupSettings
}

PVCRestoreReconciler reconciles a PVCRestore object

func (*PVCRestoreReconciler) Reconcile

func (r *PVCRestoreReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)

nolint: gocyclo

func (*PVCRestoreReconciler) SetupWithManager

func (r *PVCRestoreReconciler) SetupWithManager(mgr ctrl.Manager) error

SetupWithManager sets up the controller with the Manager.

Jump to

Keyboard shortcuts

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