pkg

package
v0.0.0-...-81c3346 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2026 License: BSD-2-Clause Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BackupAlreadyRunningError = stderrors.New("backup already running")
View Source
var CleanupAlreadyRunningError = stderrors.New("cleanup already running")
View Source
var (
	TargetNotFoundError = stderrors.New("target not found")
)

Functions

func NewBackupAction

func NewBackupAction(
	sentryClient libsentry.Client,
	k8sConnector K8sConnector,
	backupExectuor BackupExectuor,
) run.Runnable

func NewCleanAction

func NewCleanAction(
	sentryClient libsentry.Client,
	k8sConnector K8sConnector,
	cleanExectuor BackupCleaner,
) run.Runnable

Types

type Backup

type Backup struct {
	Date libtime.Date  `json:"date"`
	Path Path          `json:"path"`
	Host v1.BackupHost `json:"host"`
}

type BackupCleaner

type BackupCleaner interface {
	Clean(ctx context.Context, backupSpec v1.BackupHost) error
}

func NewBackupCleaner

func NewBackupCleaner(
	currentTimeGetter libtime.CurrentTimeGetter,
	backupFinder BackupFinder,
	backupRootDir Path,
	backupKeepAmount int,
	backupCleanEnabled bool,
) BackupCleaner

func NewBackupCleanerOnlyOnce

func NewBackupCleanerOnlyOnce(
	backupCleaner BackupCleaner,
) BackupCleaner

type BackupClientset

type BackupClientset clientset.Interface

func CreateBackupClientset

func CreateBackupClientset(ctx context.Context, kubeconfig string) (BackupClientset, error)

type BackupExectuor

type BackupExectuor interface {
	Backup(ctx context.Context, target v1.BackupSpec) error
}

func NewBackupExectuor

func NewBackupExectuor(
	currentTimeGetter libtime.CurrentTimeGetter,
	rsyncExectuor RsyncExectuor,
	backupRootDirectory Path,
	sshPrivateKey SSHPrivateKey,
) BackupExectuor

func NewBackupExectuorOnlyOnce

func NewBackupExectuorOnlyOnce(
	backupExectuor BackupExectuor,
) BackupExectuor

type BackupFinder

type BackupFinder interface {
	List(ctx context.Context, host v1.BackupHost) ([]libtime.Date, error)
}

func NewBackupFinder

func NewBackupFinder(backupRootDir Path) BackupFinder

type BackupV1Interface

type BackupV1Interface backupv1.BackupV1Interface

type Backups

type Backups []Backup

type K8sConnector

type K8sConnector interface {
	SetupCustomResourceDefinition(ctx context.Context) error
	Listen(ctx context.Context, resourceEventHandler cache.ResourceEventHandler) error
	Targets(ctx context.Context) (backupv1.Targets, error)
	Target(ctx context.Context, name string) (*backupv1.Target, error)
}

func NewK8sConnector

func NewK8sConnector(
	backupClientset BackupClientset,
	apiextensionsInterface libk8s.ApiextensionsInterface,
	namespace k8s.Namespace,
) K8sConnector

type Path

type Path string

func (Path) Exists

func (f Path) Exists(ctx context.Context) (bool, error)

func (Path) Join

func (f Path) Join(elem ...string) Path

func (Path) List

func (f Path) List(ctx context.Context) (Paths, error)

func (Path) Remove

func (f Path) Remove(ctx context.Context) error

func (Path) Rename

func (f Path) Rename(ctx context.Context, path Path) error

func (Path) String

func (f Path) String() string

type Paths

type Paths []Path

type RsyncExectuor

type RsyncExectuor interface {
	Rsync(ctx context.Context, args ...string) error
}

func NewRsyncExectuor

func NewRsyncExectuor() RsyncExectuor

type SSHPrivateKey

type SSHPrivateKey string

func (SSHPrivateKey) String

func (f SSHPrivateKey) String() string

type TargetFinder

type TargetFinder interface {
	Target(ctx context.Context, name string) (*backupv1.Target, error)
}

func NewCombinedTargetFinder

func NewCombinedTargetFinder(k8sConnector K8sConnector) TargetFinder

func NewTargetFinder

func NewTargetFinder(k8sConnector K8sConnector) TargetFinder

func NewTargetFinderByHostname

func NewTargetFinderByHostname(k8sConnector K8sConnector) TargetFinder

type TargetFinderList

type TargetFinderList []TargetFinder

func (TargetFinderList) Target

func (t TargetFinderList) Target(ctx context.Context, name string) (*backupv1.Target, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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