Documentation ¶
Index ¶
- Variables
- func CalculateHashFor(spec v1beta1.JobTemplateSpec) (hash string)
- func GetJobCondition(job *kbatch.Job, conditionType kbatch.JobConditionType) *kbatch.JobCondition
- func GetJobRunId(job *kbatch.Job) (int, error)
- func GetScheduledTime(job *kbatch.Job) (time.Time, error)
- func IsJobBeingDeleted(job *kbatch.Job) bool
- func IsJobCompleted(job *kbatch.Job) bool
- func IsJobPotentiallyRunning(job *kbatch.Job) bool
- func IsJobRunning(job *kbatch.Job) bool
- func IsJobSuspended(job *kbatch.Job) bool
- func IsManuallyScheduledJob(job *kbatch.Job) bool
- func JobHasCondition(job *kbatch.Job, conditionType kbatch.JobConditionType) bool
- func JobHasReadyStatus(job *kbatch.Job) bool
- func JobName(controlledJobName string, scheduledTime time.Time, jobRunId int) string
- func ParseJobName(jobName string) (controlledJobName string, scheduledTime *time.Time, jobRunId *int, err error)
- func WasJobStoppedByTheUser(job *kbatch.Job) bool
- func WithControlledJobAnnotations(scheduledTime time.Time, jobIdx int, manuallyScheduled bool, ...) testhelpers.JobOption
- func WithControlledJobMetadata(name string, uid types.UID, scheduledTime time.Time, jobIdx int, ...) testhelpers.JobOption
- func WithJobRunIdx(idx int) testhelpers.JobOption
- func WithScheduledTimeAnnotation(scheduledTime time.Time) testhelpers.JobOption
Constants ¶
This section is empty.
Variables ¶
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 GetScheduledTime ¶
We add an annotation to jobs with their scheduled start time
func IsJobBeingDeleted ¶
func IsJobCompleted ¶
IsJobCompleted returns true if the job has a Complete or Failed condition with status True
func IsJobPotentiallyRunning ¶
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 ¶
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 IsManuallyScheduledJob ¶
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 ParseJobName ¶
func WasJobStoppedByTheUser ¶
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.