job

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 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 Object, config Config) (*batchv1.Job, error)

GenerateGenericJob returns a generic batchv1.job for further use.

Types

type Config

type Config struct {
	Client     client.Client
	Log        logr.Logger
	CTX        context.Context
	Obj        Object
	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 Object, 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 sets the `c.Obj.GetStatus().Finished` property to `true`. In the same call to the k8s API it also sets the Progressing condition to "False" with reason Finished.

func (*Config) SetStarted

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

SetStarted sets the `c.Obj.GetStatus().Started` property to `true`. In the same call to the k8s API it also sets the Ready and Progressing conditions to "True" The arguments `message` and `args` follow the fmt.Sprintf() syntax.

type Object

type Object interface {
	GetMetaObject() metav1.Object
	GetRuntimeObject() runtime.Object
	GetStatus() k8upv1alpha1.Status
	SetStatus(s k8upv1alpha1.Status)
	GetType() v1alpha1.JobType
	GetResources() corev1.ResourceRequirements
}

Object is an interface that must be implemented by all CRDs that implement a job.

Jump to

Keyboard shortcuts

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