task

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2026 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	TaskVersion = "0.x.x"
	BuildDate   = ""
	GoVersion   = runtime.Version()
)

version/build information (populated at build time by make file)

Functions

This section is empty.

Types

type RestoreTask

type RestoreTask struct {
	// Config provided by advanced task.
	Args TaskArgs

	// Config needed for operation.
	Ctx            context.Context
	K8sConfig      rest.Config
	Client         client.Client
	WatchingClient client.WithWatch
	Clientset      kubernetes.Clientset
	TaskId         string
	TaskKey        string
	TokenHost      string
	TokenPort      string
	APIHost        string
}

func NewRestoreTask

func NewRestoreTask(
	backupId string,
	restoreFilter string,
	k8sConfig *rest.Config,
	namespace string,
	taskId string,
	tokenHost string,
	tokenPort string,
	apiHost string,
) (*RestoreTask, error)

func (*RestoreTask) ArchiveRestore

func (t *RestoreTask) ArchiveRestore(restoreTarget string, archiveTarget string) (*os.File, error)

ArchiveRestore archives and compresses the restored files.

func (*RestoreTask) Cleanup

func (t *RestoreTask) Cleanup(
	pvc *corev1.PersistentVolumeClaim,
	restore *k8upv1.Restore,
	uploadPod *corev1.Pod,
)

Cleanup cleans up task resources.

func (*RestoreTask) CreateRestorePVC

func (t *RestoreTask) CreateRestorePVC(name string, size string) (corev1.PersistentVolumeClaim, error)

CreateRestorePVC creates a PVC to attach to a k8up Restore.

func (*RestoreTask) GetTaskImageFromSelf

func (t *RestoreTask) GetTaskImageFromSelf() string

GetTaskImageFromSelf attempts to get the pod image name if running in a task pod.

func (*RestoreTask) PrintRestoreLogs

func (t *RestoreTask) PrintRestoreLogs(restore k8upv1.Restore) error

PrintRestoreLogs prints logs of pods that ran the restore to stdout. WARNING: Restore logs expose the backup webhook URL.

func (*RestoreTask) PrintUploadLogs

func (t *RestoreTask) PrintUploadLogs(uploadPod corev1.Pod) error

func (*RestoreTask) StartRestore

func (t *RestoreTask) StartRestore(pvc corev1.PersistentVolumeClaim) (k8upv1.Restore, error)

StartRestore creates a k8up Restore resource to start restoring files from a backup.

func (*RestoreTask) UploadArchiveToLagoon

func (t *RestoreTask) UploadArchiveToLagoon(archive *os.File) error

UploadArchiveToLagoon uploads a given file to the Lagoon API.

func (*RestoreTask) WaitForRestore

func (t *RestoreTask) WaitForRestore(restore k8upv1.Restore) error

WaitForRestore waits for the Restore to complete or timeout.

func (*RestoreTask) WaitForUpload

func (t *RestoreTask) WaitForUpload(pod corev1.Pod) error

WaitForUpload waits for the upload to complete or timeout.

type TaskArgs

type TaskArgs struct {
	BackupId      string `json:"backup_id"`
	RestoreFilter string `json:"restore_path"`
}

Jump to

Keyboard shortcuts

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