executor

package
v1.99.99 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2021 License: BSD-3-Clause Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildTagArgs

func BuildTagArgs(tagList []string) []string

BuildTagArgs will prepend "--tag " to every element in the given []string

func NewExecutor

func NewExecutor(config job.Config) queue.Executor

NewExecutor will return the right Executor for the given job object.

Types

type ArchiveExecutor

type ArchiveExecutor struct {
	// contains filtered or unexported fields
}

ArchiveExecutor will execute the batch.job for archive.

func NewArchiveExecutor

func NewArchiveExecutor(config job.Config) *ArchiveExecutor

NewArchiveExecutor will return a new executor for archive jobs.

func (*ArchiveExecutor) CreateObjectIfNotExisting

func (g *ArchiveExecutor) CreateObjectIfNotExisting(obj client.Object) error

CreateObjectIfNotExisting tries to create the given object, but ignores AlreadyExistsError. If it fails for any other reason, the Ready condition is set to False with the error message and reason.

func (*ArchiveExecutor) Exclusive

func (*ArchiveExecutor) Exclusive() bool

func (*ArchiveExecutor) Execute

func (a *ArchiveExecutor) Execute() error

Execute creates the actual batch.job on the k8s api.

func (*ArchiveExecutor) GetConcurrencyLimit

func (a *ArchiveExecutor) GetConcurrencyLimit() int

GetConcurrencyLimit returns the concurrent jobs limit

func (*ArchiveExecutor) GetJobNamespace

func (g *ArchiveExecutor) GetJobNamespace() string

func (*ArchiveExecutor) GetJobNamespacedName

func (g *ArchiveExecutor) GetJobNamespacedName() types.NamespacedName

func (*ArchiveExecutor) GetJobType

func (g *ArchiveExecutor) GetJobType() k8upv1alpha1.JobType

func (*ArchiveExecutor) GetRepository

func (g *ArchiveExecutor) GetRepository() string

func (*ArchiveExecutor) Logger

func (g *ArchiveExecutor) Logger() logr.Logger

func (*ArchiveExecutor) RegisterJobSucceededConditionCallback

func (g *ArchiveExecutor) RegisterJobSucceededConditionCallback()

RegisterJobSucceededConditionCallback registers an observer on the job which updates ConditionJobSucceeded when the job succeeds or fails, respectively.

type BackupExecutor

type BackupExecutor struct {
	// contains filtered or unexported fields
}

BackupExecutor creates a batch.job object on the cluster. It merges all the information provided by defaults and the CRDs to ensure the backup has all information to run.

func NewBackupExecutor

func NewBackupExecutor(config job.Config) *BackupExecutor

NewBackupExecutor returns a new BackupExecutor.

func (*BackupExecutor) CreateObjectIfNotExisting

func (g *BackupExecutor) CreateObjectIfNotExisting(obj client.Object) error

CreateObjectIfNotExisting tries to create the given object, but ignores AlreadyExistsError. If it fails for any other reason, the Ready condition is set to False with the error message and reason.

func (*BackupExecutor) Exclusive

func (*BackupExecutor) Exclusive() bool

func (*BackupExecutor) Execute

func (b *BackupExecutor) Execute() error

Execute triggers the actual batch.job creation on the cluster. It will also register a callback function on the observer so the PreBackupPods can be removed after the backup has finished.

func (*BackupExecutor) GetConcurrencyLimit

func (b *BackupExecutor) GetConcurrencyLimit() int

GetConcurrencyLimit returns the concurrent jobs limit

func (*BackupExecutor) GetJobNamespace

func (g *BackupExecutor) GetJobNamespace() string

func (*BackupExecutor) GetJobNamespacedName

func (g *BackupExecutor) GetJobNamespacedName() types.NamespacedName

func (*BackupExecutor) GetJobType

func (g *BackupExecutor) GetJobType() k8upv1alpha1.JobType

func (*BackupExecutor) GetRepository

func (g *BackupExecutor) GetRepository() string

func (*BackupExecutor) Logger

func (g *BackupExecutor) Logger() logr.Logger

func (*BackupExecutor) RegisterJobSucceededConditionCallback

func (g *BackupExecutor) RegisterJobSucceededConditionCallback()

RegisterJobSucceededConditionCallback registers an observer on the job which updates ConditionJobSucceeded when the job succeeds or fails, respectively.

func (*BackupExecutor) StartPreBackup

func (b *BackupExecutor) StartPreBackup() (bool, error)

StartPreBackup will start the defined pods as deployments. It returns true and no error if there are no PreBackups to run after setting the ConditionPreBackupPodsReady accordingly. Returns false and error if the retrieval of PreBackupPod templates failed (with status update).

func (*BackupExecutor) StopPreBackupDeployments

func (b *BackupExecutor) StopPreBackupDeployments()

StopPreBackupDeployments will remove the deployments.

type CheckExecutor

type CheckExecutor struct {
	// contains filtered or unexported fields
}

CheckExecutor will execute the batch.job for checks.

func NewCheckExecutor

func NewCheckExecutor(config job.Config) *CheckExecutor

NewCheckExecutor will return a new executor for check jobs.

func (*CheckExecutor) CreateObjectIfNotExisting

func (g *CheckExecutor) CreateObjectIfNotExisting(obj client.Object) error

CreateObjectIfNotExisting tries to create the given object, but ignores AlreadyExistsError. If it fails for any other reason, the Ready condition is set to False with the error message and reason.

func (*CheckExecutor) Exclusive

func (*CheckExecutor) Exclusive() bool

Exclusive should return true for jobs that can't run while other jobs run.

func (*CheckExecutor) Execute

func (c *CheckExecutor) Execute() error

Execute creates the actual batch.job on the k8s api.

func (*CheckExecutor) GetConcurrencyLimit

func (c *CheckExecutor) GetConcurrencyLimit() int

GetConcurrencyLimit returns the concurrent jobs limit

func (*CheckExecutor) GetJobNamespace

func (g *CheckExecutor) GetJobNamespace() string

func (*CheckExecutor) GetJobNamespacedName

func (g *CheckExecutor) GetJobNamespacedName() types.NamespacedName

func (*CheckExecutor) GetJobType

func (g *CheckExecutor) GetJobType() k8upv1alpha1.JobType

func (*CheckExecutor) GetRepository

func (g *CheckExecutor) GetRepository() string

func (*CheckExecutor) Logger

func (g *CheckExecutor) Logger() logr.Logger

func (*CheckExecutor) RegisterJobSucceededConditionCallback

func (g *CheckExecutor) RegisterJobSucceededConditionCallback()

RegisterJobSucceededConditionCallback registers an observer on the job which updates ConditionJobSucceeded when the job succeeds or fails, respectively.

type EnvVarConverter

type EnvVarConverter struct {
	Vars map[string]envVarEntry
}

EnvVarConverter can convert the given map to a []corev1.EnvVar. It also provides a function to merge another EnvVarConverter instance into itself. The merge will overwrite all zero-valued or nor declared entries.

func DefaultEnv

func DefaultEnv(namespace string) EnvVarConverter

DefaultEnv returns an environment that contains the default values for the fields.

func NewEnvVarConverter

func NewEnvVarConverter() EnvVarConverter

NewEnvVarConverter returns a new

func (*EnvVarConverter) Convert

func (e *EnvVarConverter) Convert() []corev1.EnvVar

Convert returns a ready-to-use []corev1.EnvVar where all the key value pairs have been added according to their type. If string and envVarSource are set the string will have precedence.

func (*EnvVarConverter) Merge

func (e *EnvVarConverter) Merge(source EnvVarConverter) error

Merge will merge the source into the instance. If there's no entry in the instance that exists in the source, the source entry will be added. If there's a zero-valued entry, it will also be overwritten.

func (*EnvVarConverter) SetEnvVarSource

func (e *EnvVarConverter) SetEnvVarSource(key string, value *corev1.EnvVarSource)

SetEnvVarSource add an EnvVarSource to the environment with the given key.

func (*EnvVarConverter) SetString

func (e *EnvVarConverter) SetString(key, value string)

SetString adds a string key and value pair to the environment.

type PruneExecutor

type PruneExecutor struct {
	// contains filtered or unexported fields
}

PruneExecutor will execute the batch.job for Prunes.

func NewPruneExecutor

func NewPruneExecutor(config job.Config) *PruneExecutor

NewPruneExecutor will return a new executor for Prune jobs.

func (*PruneExecutor) CreateObjectIfNotExisting

func (g *PruneExecutor) CreateObjectIfNotExisting(obj client.Object) error

CreateObjectIfNotExisting tries to create the given object, but ignores AlreadyExistsError. If it fails for any other reason, the Ready condition is set to False with the error message and reason.

func (*PruneExecutor) Exclusive

func (p *PruneExecutor) Exclusive() bool

Exclusive should return true for jobs that can't run while other jobs run.

func (*PruneExecutor) Execute

func (p *PruneExecutor) Execute() error

Execute creates the actual batch.job on the k8s api.

func (*PruneExecutor) GetConcurrencyLimit

func (p *PruneExecutor) GetConcurrencyLimit() int

GetConcurrencyLimit returns the concurrent jobs limit

func (*PruneExecutor) GetJobNamespace

func (g *PruneExecutor) GetJobNamespace() string

func (*PruneExecutor) GetJobNamespacedName

func (g *PruneExecutor) GetJobNamespacedName() types.NamespacedName

func (*PruneExecutor) GetJobType

func (g *PruneExecutor) GetJobType() k8upv1alpha1.JobType

func (*PruneExecutor) GetRepository

func (g *PruneExecutor) GetRepository() string

func (*PruneExecutor) Logger

func (g *PruneExecutor) Logger() logr.Logger

func (*PruneExecutor) RegisterJobSucceededConditionCallback

func (g *PruneExecutor) RegisterJobSucceededConditionCallback()

RegisterJobSucceededConditionCallback registers an observer on the job which updates ConditionJobSucceeded when the job succeeds or fails, respectively.

type QueueWorker

type QueueWorker struct {
	// contains filtered or unexported fields
}

QueueWorker is the object responsible for iterating the job queue and triggering the execution of the jobs.

func GetExecutor

func GetExecutor() *QueueWorker

GetExecutor will return the singleton instance for the executor.

type RestoreExecutor

type RestoreExecutor struct {
	// contains filtered or unexported fields
}

func NewRestoreExecutor

func NewRestoreExecutor(config job.Config) *RestoreExecutor

NewRestoreExecutor will return a new executor for Restore jobs.

func (*RestoreExecutor) CreateObjectIfNotExisting

func (g *RestoreExecutor) CreateObjectIfNotExisting(obj client.Object) error

CreateObjectIfNotExisting tries to create the given object, but ignores AlreadyExistsError. If it fails for any other reason, the Ready condition is set to False with the error message and reason.

func (*RestoreExecutor) Exclusive

func (*RestoreExecutor) Exclusive() bool

func (*RestoreExecutor) Execute

func (r *RestoreExecutor) Execute() error

Execute creates the actual batch.job on the k8s api.

func (*RestoreExecutor) GetConcurrencyLimit

func (r *RestoreExecutor) GetConcurrencyLimit() int

GetConcurrencyLimit returns the concurrent jobs limit

func (*RestoreExecutor) GetJobNamespace

func (g *RestoreExecutor) GetJobNamespace() string

func (*RestoreExecutor) GetJobNamespacedName

func (g *RestoreExecutor) GetJobNamespacedName() types.NamespacedName

func (*RestoreExecutor) GetJobType

func (g *RestoreExecutor) GetJobType() k8upv1alpha1.JobType

func (*RestoreExecutor) GetRepository

func (g *RestoreExecutor) GetRepository() string

func (*RestoreExecutor) Logger

func (g *RestoreExecutor) Logger() logr.Logger

func (*RestoreExecutor) RegisterJobSucceededConditionCallback

func (g *RestoreExecutor) RegisterJobSucceededConditionCallback()

RegisterJobSucceededConditionCallback registers an observer on the job which updates ConditionJobSucceeded when the job succeeds or fails, respectively.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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