jobconfig

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2022 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// AnnotationKeyScheduleTime stores the time that the Job was automatically scheduled
	// by the JobConfig's schedule spec.
	AnnotationKeyScheduleTime = executiongroup.AddGroupToLabel("schedule-time")

	// LabelKeyJobConfigUID stores the UID of the JobConfig that created the Job.
	// All Jobs are expected to have this label, which is used when using label
	// selectors.
	LabelKeyJobConfigUID = executiongroup.AddGroupToLabel("job-config-uid")

	// AnnotationKeyOptionSpecHash stores the hash of the OptionSpec at the point in
	// time when a Job's optionValues are evaluated based on the JobConfig's Option.
	AnnotationKeyOptionSpecHash = executiongroup.AddGroupToLabel("option-spec-hash")
)

Functions

func GenerateName

func GenerateName(jobConfigName string, startTime time.Time) string

GenerateName generates a unique name for a Job. Optionally pass a start time to make execution ID generation deterministic.

func GetLabelScheduleTime

func GetLabelScheduleTime(rj *execution.Job) *metav1.Time

GetLabelScheduleTime returns the cron schedule time for a Job from its annotation. If no annotation exists or is not a valid Unix timestamp, nil will be returned.

func GetLastScheduleTime

func GetLastScheduleTime(jobs []*execution.Job) *metav1.Time

GetLastScheduleTime returns the latest schedule time in a list of all Jobs. If the list is empty, or none of the jobs were scheduled jobs, will return nil.

func GetState

GetState returns the high-level state of a JobConfig.

func LabelJobsForJobConfig

func LabelJobsForJobConfig(rjc *execution.JobConfig) labels.Set

LabelJobsForJobConfig returns a labels.Set that labels all Jobs for a JobConfig.

func LookupJobOwner

func LookupJobOwner(rj *execution.Job, lister lister.JobConfigNamespaceLister) (*execution.JobConfig, error)

LookupJobOwner looks up the JobConfig for a Job using the ownerReferences field if it exists. Otherwise, both a nil JobConfig and a nil error is returned if there are no owner references.

All Jobs with a JobConfig parent (specified via ownerReferences) are expected to have a special label (see LabelKeyJobConfigUID), which is used for internal selectors and cannot be updated.

func NewJobFromJobConfig

func NewJobFromJobConfig(
	jobConfig *execution.JobConfig,
	jobType execution.JobType,
	createTime time.Time,
) (*execution.Job, error)

NewJobFromJobConfig returns a Job from a JobConfig.

func ValidateLookupJobOwner

func ValidateLookupJobOwner(
	rj *execution.Job,
	lister lister.JobConfigNamespaceLister,
) (*execution.JobConfig, field.ErrorList)

ValidateLookupJobOwner looks up the owner JobConfig for a Job and returns validation errors if any.

All Jobs with a JobConfig parent (specified via ownerReferences) are expected to have a special label (see LabelKeyJobConfigUID), which is used for internal selectors and cannot be updated. This method also performs sanity checks to ensure that the returned JobConfig matches the UID fields in the Job.

May return a nil JobConfig if there is no owner reference defined.

Types

This section is empty.

Jump to

Keyboard shortcuts

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