metadata

package
v0.0.0-...-1670326 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	JobOwnerKey                     = ".metadata.controller"
	ApiGVStr                        = batch.GroupVersion.String()
	ScheduledTimeAnnotation         = fmt.Sprintf("%s/scheduled-at", batch.GroupVersion.Group)
	JobRunIdAnnotation              = fmt.Sprintf("%s/job-run-id", batch.GroupVersion.Group)
	ControlledJobLabel              = fmt.Sprintf("%s/controlled-job", batch.GroupVersion.Group)
	ManualJobAnnotation             = fmt.Sprintf("%s/is-manually-scheduled", batch.GroupVersion.Group)
	TemplateHashAnnotation          = fmt.Sprintf("%s/job-template-hash", batch.GroupVersion.Group)
	SuspendReason                   = fmt.Sprintf("%s/suspend-reason", batch.GroupVersion.Group)
	ApplyMutationsAnnotation        = fmt.Sprintf("%s/apply-mutations", batch.GroupVersion.Group)
	TimeZoneAnnotation              = fmt.Sprintf("%s/timezone", batch.GroupVersion.Group)
	TimeZoneOffsetSecondsAnnotation = fmt.Sprintf("%s/timezone-offset-seconds", batch.GroupVersion.Group)
)

Functions

func CalculateHashFor

func CalculateHashFor(spec v1beta1.JobTemplateSpec) (hash string)

CalculateHashFor calculates a SHA256 hash of a k8s job spec in order to facilitate diffing

func GetJobCondition

func GetJobCondition(job *kbatch.Job, conditionType kbatch.JobConditionType) *kbatch.JobCondition

func GetJobRunId

func GetJobRunId(job *kbatch.Job) (int, error)

func GetScheduledTime

func GetScheduledTime(job *kbatch.Job) (time.Time, error)

We add an annotation to jobs with their scheduled start time

func IsJobBeingDeleted

func IsJobBeingDeleted(job *kbatch.Job) bool

func IsJobCompleted

func IsJobCompleted(job *kbatch.Job) bool

IsJobCompleted returns true if the job has a Complete or Failed condition with status True

func IsJobPotentiallyRunning

func IsJobPotentiallyRunning(job *kbatch.Job) bool

IsJobPotentiallyRunning determines if it's possible that the given job is running. We need to be paranoid here in order to avoid the risk of multiple jobs running at the same time. In the future this could be improved by listing the pods associated with the Job. For now this returns true unless the Job has a Complete or Failed condition

func IsJobRunning

func IsJobRunning(job *kbatch.Job) bool

IsJobRunning is true if: - it's not completed - if it advertises a ready count (this is a beta feature), ready is > 1 - otherwise, if it has any active pods, we have to assume they are running (although this could be a lie)

func IsJobSuspended

func IsJobSuspended(job *kbatch.Job) bool

func IsManuallyScheduledJob

func IsManuallyScheduledJob(job *kbatch.Job) bool

IsManuallyScheduledJob returns boolean as to whether job was manually or automatically scheduled

func JobHasCondition

func JobHasCondition(job *kbatch.Job, conditionType kbatch.JobConditionType) bool

func JobHasReadyStatus

func JobHasReadyStatus(job *kbatch.Job) bool

func JobName

func JobName(controlledJobName string, scheduledTime time.Time, jobRunId int) string

func ParseJobName

func ParseJobName(jobName string) (controlledJobName string, scheduledTime *time.Time, jobRunId *int, err error)

func WasJobStoppedByTheUser

func WasJobStoppedByTheUser(job *kbatch.Job) bool

func WithControlledJobAnnotations

func WithControlledJobAnnotations(scheduledTime time.Time, jobIdx int, manuallyScheduled bool, jobTemplate batchv1beta1.JobTemplateSpec) testhelpers.JobOption

func WithControlledJobMetadata

func WithControlledJobMetadata(name string, uid types.UID, scheduledTime time.Time, jobIdx int, jobTemplate batchv1beta1.JobTemplateSpec) testhelpers.JobOption

func WithJobRunIdx

func WithJobRunIdx(idx int) testhelpers.JobOption

func WithScheduledTimeAnnotation

func WithScheduledTimeAnnotation(scheduledTime time.Time) testhelpers.JobOption

Types

This section is empty.

Jump to

Keyboard shortcuts

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