job

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: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// K8uplabel is a label that is required for the operator to differentiate
	// batchv1.job objects managed by k8up from others.
	K8uplabel = "k8upjob"
	// K8upExclusive is needed to determine if a given job is considered exclusive or not.
	K8upExclusive = "k8upjob/exclusive"
)

Variables

This section is empty.

Functions

func GenerateGenericJob

func GenerateGenericJob(obj k8upv1alpha1.JobObject, config Config) (*batchv1.Job, error)

GenerateGenericJob returns a generic batchv1.job for further use.

func GroupByStatus

func GroupByStatus(jobs []k8upv1alpha1.JobObject) (running []k8upv1alpha1.JobObject, failed []k8upv1alpha1.JobObject, successful []k8upv1alpha1.JobObject)

GroupByStatus groups jobs by the running state

Types

type Config

type Config struct {
	Client     client.Client
	Log        logr.Logger
	CTX        context.Context
	Obj        k8upv1alpha1.JobObject
	Scheme     *runtime.Scheme
	Repository string
}

Config represents the whole context for a given job. It contains everything that is necessary to handle the job.

func NewConfig

func NewConfig(ctx context.Context, client client.Client, log logr.Logger, obj k8upv1alpha1.JobObject, scheme *runtime.Scheme, repository string) Config

NewConfig returns a new configuration.

func (*Config) SetConditionFalseWithMessage

func (c *Config) SetConditionFalseWithMessage(condition k8upv1alpha1.ConditionType, reason k8upv1alpha1.ConditionReason, message string, args ...interface{})

SetConditionFalseWithMessage tells the K8s controller at once that the status of the given Condition is now "False" and provides the given message. The arguments `message` and `args` follow the fmt.Sprintf() syntax.

func (*Config) SetConditionTrue

func (c *Config) SetConditionTrue(condition k8upv1alpha1.ConditionType, reason k8upv1alpha1.ConditionReason)

SetConditionTrue tells the K8s controller at once that the status of the given Conditions is now "True"

func (*Config) SetConditionTrueWithMessage

func (c *Config) SetConditionTrueWithMessage(condition k8upv1alpha1.ConditionType, reason k8upv1alpha1.ConditionReason, message string, args ...interface{})

SetConditionTrueWithMessage tells the K8s controller at once that the status of the given Condition is now "True" and provides the given message. The arguments `message` and `args` follow the fmt.Sprintf() syntax.

func (*Config) SetConditionUnknownWithMessage

func (c *Config) SetConditionUnknownWithMessage(condition k8upv1alpha1.ConditionType, reason k8upv1alpha1.ConditionReason, message string, args ...interface{})

SetConditionUnknownWithMessage tells the K8s controller at once that the status of the given Conditions is "Unknown"

func (*Config) SetFinished

func (c *Config) SetFinished(namespace, name string)

SetFinished marks the job as finished and updates the status.

func (*Config) SetStarted

func (c *Config) SetStarted(message string, args ...interface{})

SetStarted marks the job as started and updates the status. The arguments `message` and `args` follow the fmt.Sprintf() syntax.

Jump to

Keyboard shortcuts

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