v1alpha1

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package v1alpha1 contains API Schema definitions for the execution v1alpha1 API group +kubebuilder:object:generate=true +groupName=execution.furiko.io

Index

Constants

View Source
const (
	Version = "v1alpha1"

	KindJob       = "Job"
	KindJobConfig = "JobConfig"
)

Variables

View Source
var (
	// GroupVersion is group version used to register these objects
	GroupVersion = schema.GroupVersion{Group: execution.GroupName, Version: Version}

	// SchemeBuilder is used to add go types to the GroupVersionKind scheme
	SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion}

	// AddToScheme adds the types in this group-version to the given scheme.
	AddToScheme = SchemeBuilder.AddToScheme
)
View Source
var (
	GVKJob       = SchemeGroupVersion.WithKind(KindJob)
	GVKJobConfig = SchemeGroupVersion.WithKind(KindJobConfig)
)

Declare schema.GroupVersionKind for each Kind in this Group.

View Source
var SchemeGroupVersion = schema.GroupVersion{
	Group:   execution.GroupName,
	Version: Version,
}

SchemeGroupVersion is group version used to register these objects.

Functions

func Resource

func Resource(resource string) schema.GroupResource

Types

type BoolOptionConfig

type BoolOptionConfig struct {
	// Default value, will be used to populate the option if not specified.
	Default bool `json:"default"`

	// Determines how to format the value as string.
	// Can be one of: TrueFalse, OneZero, YesNo, Custom
	//
	// Default: TrueFalse
	// +optional
	Format BoolOptionFormat `json:"format,omitempty"`

	// If Format is custom, will be substituted if value is true.
	// Can also be an empty string.
	//
	// +optional
	TrueVal string `json:"trueVal,omitempty"`

	// If Format is custom, will be substituted if value is false.
	// Can also be an empty string.
	//
	// +optional
	FalseVal string `json:"falseVal,omitempty"`
}

BoolOptionConfig defines the options for OptionTypeBool.

func (*BoolOptionConfig) DeepCopy

func (in *BoolOptionConfig) DeepCopy() *BoolOptionConfig

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BoolOptionConfig.

func (*BoolOptionConfig) DeepCopyInto

func (in *BoolOptionConfig) DeepCopyInto(out *BoolOptionConfig)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*BoolOptionConfig) FormatValue

func (c *BoolOptionConfig) FormatValue(value bool) (string, error)

type BoolOptionFormat

type BoolOptionFormat string

BoolOptionFormat describes how a bool option should be formatted.

const (
	// BoolOptionFormatTrueFalse formats bool values as "true" and "false"
	// respectively.
	BoolOptionFormatTrueFalse BoolOptionFormat = "TrueFalse"

	// BoolOptionFormatOneZero formats bool values as "1" and "0" respectively.
	BoolOptionFormatOneZero BoolOptionFormat = "OneZero"

	// BoolOptionFormatYesNo formats bool values as "yes" and "no" respectively.
	BoolOptionFormatYesNo BoolOptionFormat = "YesNo"

	// BoolOptionFormatCustom formats bool values according to a custom format.
	BoolOptionFormatCustom BoolOptionFormat = "Custom"
)

func (BoolOptionFormat) Format

func (b BoolOptionFormat) Format(val bool) (string, error)

func (BoolOptionFormat) IsValid

func (b BoolOptionFormat) IsValid() bool

type ConcurrencyPolicy

type ConcurrencyPolicy string
const (
	// ConcurrencyPolicyAllow allows multiple Job objects for a single JobConfig to
	// be created concurrently.
	ConcurrencyPolicyAllow ConcurrencyPolicy = "Allow"

	// ConcurrencyPolicyForbid forbids multiple Job objects for a single JobConfig
	// to be created concurrently. If a new Job is set to be automatically scheduled
	// with another concurrent Job, the new Job will be dropped from the queue.
	ConcurrencyPolicyForbid ConcurrencyPolicy = "Forbid"

	// ConcurrencyPolicyEnqueue enqueues the Job to be run after other Jobs for the
	// JobConfig have finished. If a new Job is set to be automatically scheduld
	// with another concurrent Job, the new Job will wait until the previous Job
	// finishes.
	ConcurrencyPolicyEnqueue ConcurrencyPolicy = "Enqueue"
)

type ConcurrencySpec

type ConcurrencySpec struct {
	// Policy describes how to treat concurrent executions of the same JobConfig.
	Policy ConcurrencyPolicy `json:"policy"`
}

ConcurrencySpec defines how to handle multiple concurrent Jobs for the JobConfig.

func (*ConcurrencySpec) DeepCopy

func (in *ConcurrencySpec) DeepCopy() *ConcurrencySpec

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ConcurrencySpec.

func (*ConcurrencySpec) DeepCopyInto

func (in *ConcurrencySpec) DeepCopyInto(out *ConcurrencySpec)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type CronSchedule

type CronSchedule struct {
	// Cron expression to specify how the JobConfig will be periodically scheduled.
	// Example: "0 0/5 * * *".
	//
	// Supports cron schedules with optional "seconds" and "years" fields, i.e. can
	// parse between 5 to 7 tokens.
	//
	// More information: https://github.com/furiko-io/cronexpr
	Expression string `json:"expression"`

	// Timezone to interpret the cron schedule in. For example, a cron schedule of
	// "0 10 * * *" with a timezone of "Asia/Singapore" will be interpreted as
	// running at 02:00:00 UTC time every day.
	//
	// Timezone must be one of the following:
	//
	//  1. A valid tz string (e.g. "Asia/Singapore", "America/New_York").
	//  2. A UTC offset with minutes (e.g. UTC-10:00).
	//  3. A GMT offset with minutes (e.g. GMT+05:30). The meaning is the
	//     same as its UTC counterpart.
	//
	// This field merely is used for parsing the cron Expression, and has nothing to
	// do with /etc/timezone inside the container (i.e. it will not set $TZ
	// automatically).
	//
	// Defaults to the controller's default configured timezone.
	//
	// +optional
	Timezone string `json:"timezone,omitempty"`
}

CronSchedule defines a Schedule based on cron format.

func (*CronSchedule) DeepCopy

func (in *CronSchedule) DeepCopy() *CronSchedule

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CronSchedule.

func (*CronSchedule) DeepCopyInto

func (in *CronSchedule) DeepCopyInto(out *CronSchedule)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type DateOptionConfig

type DateOptionConfig struct {
	// Date format in moment.js format. If not specified, will use RFC3339 format by
	// default.
	//
	// Date format reference: https://momentjs.com/docs/#/displaying/format/
	//
	// Default:
	// +optional
	Format string `json:"format,omitempty"`
}

DateOptionConfig defines the options for OptionTypeDate.

func (*DateOptionConfig) DeepCopy

func (in *DateOptionConfig) DeepCopy() *DateOptionConfig

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DateOptionConfig.

func (*DateOptionConfig) DeepCopyInto

func (in *DateOptionConfig) DeepCopyInto(out *DateOptionConfig)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type Job

type Job struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`

	Spec   JobSpec   `json:"spec,omitempty"`
	Status JobStatus `json:"status,omitempty"`
}

Job is the schema for a single job execution, which may consist of multiple tasks.

func (*Job) DeepCopy

func (in *Job) DeepCopy() *Job

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Job.

func (*Job) DeepCopyInto

func (in *Job) DeepCopyInto(out *Job)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*Job) DeepCopyObject

func (in *Job) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

type JobCondition

type JobCondition struct {
	// Stores the status of the Job's queueing condition. If specified, it means
	// that the Job is currently not started and is queued.
	// +optional
	Queueing *JobConditionQueueing `json:"queueing,omitempty"`

	// Stores the status of the Job's waiting condition. If specified, it means that
	// the Job currently is waiting for a task.
	// +optional
	Waiting *JobConditionWaiting `json:"waiting,omitempty"`

	// Stores the status of the Job's running state. If specified, it means that the
	// Job currently has a running task.
	// +optional
	Running *JobConditionRunning `json:"running,omitempty"`

	// Stores the status of the Job's finished state. If specified, it also means
	// that the Job is terminal.
	// +optional
	Finished *JobConditionFinished `json:"finished,omitempty"`
}

JobCondition holds a possible condition of a Job. Only one of its members may be specified. If none of them is specified, the default one is JobConditionQueueing.

func (*JobCondition) DeepCopy

func (in *JobCondition) DeepCopy() *JobCondition

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new JobCondition.

func (*JobCondition) DeepCopyInto

func (in *JobCondition) DeepCopyInto(out *JobCondition)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type JobConditionFinished

type JobConditionFinished struct {
	// The time at which the latest task was created by the controller. May be nil
	// if no tasks were ever created.
	// +optional
	CreatedAt *metav1.Time `json:"createTime,omitempty"`

	// The time at which the latest task had started running. May be nil if the task
	// never started running.
	// +optional
	StartedAt *metav1.Time `json:"startTime,omitempty"`

	// The time at which the Job was first marked as finished by the controller.
	FinishedAt metav1.Time `json:"finishTime"`

	// The result of it being finished.
	Result JobResult `json:"result"`

	// Unique, one-word, CamelCase reason for the condition's last transition.
	// +optional
	Reason string `json:"reason,omitempty"`

	// Optional descriptive message explaining the condition's last transition.
	// +optional
	Message string `json:"message,omitempty"`
}

JobConditionFinished stores the status of the final finished result of a Job.

func (*JobConditionFinished) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new JobConditionFinished.

func (*JobConditionFinished) DeepCopyInto

func (in *JobConditionFinished) DeepCopyInto(out *JobConditionFinished)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type JobConditionQueueing

type JobConditionQueueing struct {
	// Unique, one-word, CamelCase reason for the condition's last transition.
	// +optional
	Reason string `json:"reason,omitempty"`

	// Optional descriptive message explaining the condition's last transition.
	// +optional
	Message string `json:"message,omitempty"`
}

JobConditionQueueing stores the status of a currently Job in the queue.

func (*JobConditionQueueing) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new JobConditionQueueing.

func (*JobConditionQueueing) DeepCopyInto

func (in *JobConditionQueueing) DeepCopyInto(out *JobConditionQueueing)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type JobConditionRunning

type JobConditionRunning struct {
	// The time at which the running task was created by the controller.
	CreatedAt metav1.Time `json:"createTime"`

	// The time at which the running task had started running.
	StartedAt metav1.Time `json:"startTime"`
}

JobConditionRunning stores the status of a currently running Job.

func (*JobConditionRunning) DeepCopy

func (in *JobConditionRunning) DeepCopy() *JobConditionRunning

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new JobConditionRunning.

func (*JobConditionRunning) DeepCopyInto

func (in *JobConditionRunning) DeepCopyInto(out *JobConditionRunning)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type JobConditionWaiting

type JobConditionWaiting struct {
	// The time at which the latest task was created by the controller, if any.
	// +optional
	CreatedAt *metav1.Time `json:"createTime,omitempty"`

	// Unique, one-word, CamelCase reason for the condition's last transition.
	// +optional
	Reason string `json:"reason,omitempty"`

	// Optional descriptive message explaining the condition's last transition.
	// +optional
	Message string `json:"message,omitempty"`
}

JobConditionWaiting stores the status of a currently waiting Job.

func (*JobConditionWaiting) DeepCopy

func (in *JobConditionWaiting) DeepCopy() *JobConditionWaiting

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new JobConditionWaiting.

func (*JobConditionWaiting) DeepCopyInto

func (in *JobConditionWaiting) DeepCopyInto(out *JobConditionWaiting)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type JobConfig

type JobConfig struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`

	Spec   JobConfigSpec   `json:"spec,omitempty"`
	Status JobConfigStatus `json:"status,omitempty"`
}

JobConfig is the schema for a single job configuration. Multiple Job objects belong to a single JobConfig.

func (*JobConfig) DeepCopy

func (in *JobConfig) DeepCopy() *JobConfig

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new JobConfig.

func (*JobConfig) DeepCopyInto

func (in *JobConfig) DeepCopyInto(out *JobConfig)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*JobConfig) DeepCopyObject

func (in *JobConfig) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

type JobConfigList

type JobConfigList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata,omitempty"`
	Items           []JobConfig `json:"items"`
}

JobConfigList contains a list of JobConfig objects.

func (*JobConfigList) DeepCopy

func (in *JobConfigList) DeepCopy() *JobConfigList

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new JobConfigList.

func (*JobConfigList) DeepCopyInto

func (in *JobConfigList) DeepCopyInto(out *JobConfigList)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*JobConfigList) DeepCopyObject

func (in *JobConfigList) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

type JobConfigSpec

type JobConfigSpec struct {
	// Template for creating the Job.
	Template JobTemplate `json:"template"`

	// Concurrency defines the behaviour of multiple concurrent Jobs.
	Concurrency ConcurrencySpec `json:"concurrency"`

	// Schedule is an optional field that defines automatic scheduling of the
	// JobConfig.
	//
	// +optional
	Schedule *ScheduleSpec `json:"schedule,omitempty"`

	// Option is an optional field that defines how the JobConfig is parameterized.
	// Each option defined here can subsequently be used in the Template via context
	// variable substitution.
	//
	// +optional
	Option *OptionSpec `json:"option,omitempty"`
}

JobConfigSpec defines the desired state of the JobConfig.

func (*JobConfigSpec) DeepCopy

func (in *JobConfigSpec) DeepCopy() *JobConfigSpec

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new JobConfigSpec.

func (*JobConfigSpec) DeepCopyInto

func (in *JobConfigSpec) DeepCopyInto(out *JobConfigSpec)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type JobConfigState

type JobConfigState string
const (
	// JobConfigReady means that the JobConfig is ready to be executed. This state
	// is used if the JobConfig has no schedule set, otherwise a more specific state
	// like ReadyDisabled or ReadyEnabled is preferred.
	JobConfigReady JobConfigState = "Ready"

	// JobConfigReadyEnabled means that the JobConfig has a schedule specified
	// which is enabled, and is ready to be executed.
	JobConfigReadyEnabled JobConfigState = "ReadyEnabled"

	// JobConfigReadyDisabled means that the JobConfig has a schedule specified
	// which is disabled, and is ready to be executed.
	JobConfigReadyDisabled JobConfigState = "ReadyDisabled"

	// JobConfigJobQueued means that the JobConfig has some Job(s) that are Queued,
	// and none of them are started yet.
	JobConfigJobQueued JobConfigState = "JobQueued"

	// JobConfigExecuting means that the JobConfig has some Job already started and
	// may be running.
	JobConfigExecuting JobConfigState = "Executing"
)

type JobConfigStatus

type JobConfigStatus struct {
	// Human-readable and high-level representation of the status of the JobConfig.
	State JobConfigState `json:"state"`

	// Total number of Jobs queued for the JobConfig. A job that is queued is one
	// that is not yet started.
	//
	// +optional
	Queued int64 `json:"queued"`

	// A list of pointers to Job objects queued for the JobConfig.
	//
	// +optional
	QueuedJobs []JobReference `json:"queuedJobs,omitempty"`

	// Total number of active jobs created for the JobConfig. An active job is one
	// that is waiting to create a task, waiting for a task to be running, or has a
	// running task.
	//
	// +optional
	Active int64 `json:"active"`

	// A list of pointers to active Job objects for the JobConfig.
	//
	// +optional
	ActiveJobs []JobReference `json:"activeJobs,omitempty"`

	// The last known schedule time for this job config, used to persist state
	// during controller downtime. If the controller was down for a short period of
	// time, any schedules that were missed during the downtime will be
	// back-scheduled, subject to the number of schedules missed since
	// LastScheduleTime.
	//
	// To prevent thundering herd effects, there are two controller configuration
	// values that will restrict the number of back-scheduled jobs created after the
	// controller comes back up:
	//
	//  1. MaxMissedSchedules: Defines a maximum number of jobs that the controller
	//     should attempt after coming back up. Having a sane value here would prevent a
	//     thundering herd of jobs being scheduled that would exhaust resources in the
	//     cluster. Defaults to 5 if not defined.
	//  2. MaxDowntimeThresholdSeconds: Defines the maximum downtime threshold that
	//     the controller can tolerate. If the controller was intentionally shut down
	//     for an extended period of time, we should not attempt to back-schedule jobs
	//     once it was started. Defaults to 5 minutes if not defined.
	//
	// +optional
	LastScheduleTime *metav1.Time `json:"lastScheduleTime,omitempty"`
}

JobConfigStatus defines the observed state of the JobConfig.

func (*JobConfigStatus) DeepCopy

func (in *JobConfigStatus) DeepCopy() *JobConfigStatus

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new JobConfigStatus.

func (*JobConfigStatus) DeepCopyInto

func (in *JobConfigStatus) DeepCopyInto(out *JobConfigStatus)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type JobList

type JobList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata,omitempty"`
	Items           []Job `json:"items"`
}

JobList contains a list of Job

func (*JobList) DeepCopy

func (in *JobList) DeepCopy() *JobList

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new JobList.

func (*JobList) DeepCopyInto

func (in *JobList) DeepCopyInto(out *JobList)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*JobList) DeepCopyObject

func (in *JobList) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

type JobPhase

type JobPhase string
const (
	// JobQueued means that the job is not yet started.
	JobQueued JobPhase = "Queued"

	// JobStarting means that the job is starting up, and no tasks have been created
	// yet.
	JobStarting JobPhase = "Starting"

	// JobPending means that the job is started but not yet running. It could be in
	// the middle of scheduling, container creation, etc.
	JobPending JobPhase = "Pending"

	// JobRunning means that the job has a currently running task.
	JobRunning JobPhase = "Running"

	// JobAdmissionError means that the job could not start due to an admission
	// error that cannot be retried.
	JobAdmissionError JobPhase = "AdmissionError"

	// JobRetryBackoff means that the job is backing off the next retry due to a
	// failed task. The job is currently waiting for its retry delay before creating
	// the next task.
	JobRetryBackoff JobPhase = "RetryBackoff"

	// JobRetrying means that the job had previously failed, and a new task has been
	// created to retry, but it has not yet started running.
	JobRetrying JobPhase = "Retrying"

	// JobSucceeded means that the job was completed successfully.
	JobSucceeded JobPhase = "Succeeded"

	// JobRetryLimitExceeded means that the job's most recent task terminated with a
	// failed result. All retry attempts have been fully exhausted and the job will
	// stop trying to create new tasks.
	JobRetryLimitExceeded JobPhase = "RetryLimitExceeded"

	// JobPendingTimeout means that the job's most recent task did not start running
	// within the maxium pending timeout. All retry attempts have been fully
	// exhausted and the job will stop trying to create new tasks.
	JobPendingTimeout JobPhase = "PendingTimeout"

	// JobDeadlineExceeded means that the job's most recent task had started
	// running, but was running longer than its active deadline. All retry attempts
	// have been fully exhausted and the job will stop trying to create new tasks.
	//
	// Note that the difference between JobPendingTimeout and JobDeadlineExceeded is
	// that the active deadline includes both the pending duration and execution
	// duration (when the container is actually running). If the Job's active
	// deadline is exceeded, and if did not start running within the pending
	// timeout, JobPendingTimeout will be used; if it did start running then
	// JobDeadlineExceeded will be used.
	JobDeadlineExceeded JobPhase = "DeadlineExceeded"

	// JobKilling means that the job and its tasks are in the process of being
	// killed. No more retries will be created.
	JobKilling JobPhase = "Killing"

	// JobKilled means that the job and all its tasks are fully killed via external
	// interference, and tasks are guaranteed to have been stopped. No more tasks
	// will be created even if not all retry attempts are exhausted.
	//
	// It should be noted that if TaskForbidForceDeletion is not true, it may
	// actually be possible that the Node is unresponsive and we had forcefully
	// deleted the task without confirming that the task has been completely killed.
	JobKilled JobPhase = "Killed"

	// JobFinishedUnknown means that the job is finished but for some reason we do
	// not know its result.
	JobFinishedUnknown JobPhase = "FinishedUnknown"
)

func (JobPhase) IsTerminal

func (p JobPhase) IsTerminal() bool

IsTerminal returns true if the Job is considered terminal. A terminal phase means that the Job will no longer transition into a non-terminal phase after this.

type JobReference

type JobReference struct {
	// Namespace of the Job.
	Namespace string `json:"namespace"`

	// Name of the Job.
	Name string `json:"name"`
}

func (*JobReference) DeepCopy

func (in *JobReference) DeepCopy() *JobReference

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new JobReference.

func (*JobReference) DeepCopyInto

func (in *JobReference) DeepCopyInto(out *JobReference)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type JobResult

type JobResult string
const (
	// JobResultSuccess means that the Job finished successfully.
	JobResultSuccess JobResult = "Success"

	// JobResultTaskFailed means that the Job has failed, and its last task exited
	// with a non-zero code, or encountered some other application-level error.
	JobResultTaskFailed JobResult = "TaskFailed"

	// JobResultPendingTimeout means that the Job has failed to start its last task
	// within the specified pending timeout.
	JobResultPendingTimeout JobResult = "PendingTimeout"

	// JobResultDeadlineExceeded means that the Job has failed to finish its last
	// task within the specified task active deadline.
	JobResultDeadlineExceeded JobResult = "DeadlineExceeded"

	// JobResultAdmissionError means that the Job could not start due to an error
	// from trying to admit creation of tasks.
	JobResultAdmissionError JobResult = "AdmissionError"

	// JobResultKilled means that the Job and its tasks, if any, were successfully
	// killed via KillTimestamp.
	JobResultKilled JobResult = "Killed"

	// JobResultFinalStateUnknown means that the Job's tasks were deleted and its
	// final state is unknown.
	JobResultFinalStateUnknown JobResult = "FinalStateUnknown"
)

func (JobResult) IsFailed

func (r JobResult) IsFailed() bool

type JobSpec

type JobSpec struct {
	// ConfigName allows specifying the name of the JobConfig to create the Job
	// from. The JobConfig must be in the same namespace as the Job.
	//
	// It is provided as a write-only input field for convenience, and will override
	// the template, labels and annotations from the JobConfig's template.
	//
	// This field will never be returned from the API. To look up the parent
	// JobConfig, use ownerReferences.
	//
	// +optional
	ConfigName string `json:"configName,omitempty"`

	// Specifies the type of Job.
	// Can be one of: Adhoc, Scheduled
	//
	// Default: Adhoc
	// +optional
	Type JobType `json:"type"`

	// Specifies optional start policy for a Job, which specifies certain conditions
	// which have to be met before a Job is started.
	//
	// +optional
	StartPolicy *StartPolicySpec `json:"startPolicy,omitempty"`

	// Template specifies how to create the Job.
	// +optional
	Template *JobTemplateSpec `json:"template,omitempty"`

	// Specifies key-values pairs of values for Options, in JSON or YAML format.
	//
	// Example specification:
	//
	//   spec:
	//     optionValues: |-
	//       myStringOption: "value"
	//       myBoolOption: true
	//       mySelectOption:
	//       - option1
	//       - option3
	//
	// Each entry in the optionValues struct should consist of the option's name,
	// and the value could be an arbitrary type that corresponds to the option's
	// type itself. Each option value specified will be evaluated to a string based
	// on the JobConfig's OptionsSpec and added to Substitutions. If the key also
	// exists in Substitutions, that one takes priority.
	//
	// Cannot be updated after creation.
	//
	// +optional
	OptionValues string `json:"optionValues,omitempty"`

	// Defines key-value pairs of context variables to be substituted into the
	// TaskTemplate. Each entry should consist of the full context variable name
	// (i.e. `ctx.name`), and the values must be a string. Substitutions defined
	// here take highest precedence over both predefined context variables and
	// evaluated OptionValues.
	//
	// Most users should be using OptionValues to specify custom Job Option values
	// for running the Job instead of using Subsitutions directly.
	//
	// Cannot be updated after creation.
	//
	// +optional
	Substitutions map[string]string `json:"substitutions,omitempty"`

	// Specifies the time to start killing the job. When the time passes this
	// timestamp, the controller will start attempting to kill all tasks.
	//
	// +optional
	KillTimestamp *metav1.Time `json:"killTimestamp,omitempty"`

	// Specifies the maximum lifetime of a Job that is finished. If not set, it will
	// be set to the DefaultTTLSecondsAfterFinished configuration value in the
	// controller.
	//
	// +optional
	TTLSecondsAfterFinished *int32 `json:"ttlSecondsAfterFinished,omitempty"`
}

JobSpec defines the desired state of a Job.

func (*JobSpec) DeepCopy

func (in *JobSpec) DeepCopy() *JobSpec

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new JobSpec.

func (*JobSpec) DeepCopyInto

func (in *JobSpec) DeepCopyInto(out *JobSpec)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type JobStatus

type JobStatus struct {
	// Phase stores the high-level description of a Job's state.
	Phase JobPhase `json:"phase"`

	// Condition stores details about the Job's current condition.
	Condition JobCondition `json:"condition"`

	// StartTime specifies the time that the Job was started by the controller. If
	// nil, it means that the Job is Queued. Cannot be changed once set.
	//
	// +optional
	StartTime *metav1.Time `json:"startTime,omitempty"`

	// CreatedTasks describes how many tasks were created in total for this Job.
	// +optional
	CreatedTasks int64 `json:"createdTasks"`

	// Tasks contains a list of tasks created by the controller. The controller
	// updates this field when it creates a task, which helps to guard against
	// recreating tasks after they were deleted, and also stores necessary task data
	// for reconciliation in case tasks are deleted.
	//
	// +optional
	// +patchMergeKey=type
	// +patchStrategy=merge
	// +listType=atomic
	Tasks []TaskRef `json:"tasks,omitempty"`
}

JobStatus defines the observed state of a Job.

func (*JobStatus) DeepCopy

func (in *JobStatus) DeepCopy() *JobStatus

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new JobStatus.

func (*JobStatus) DeepCopyInto

func (in *JobStatus) DeepCopyInto(out *JobStatus)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type JobTaskSpec

type JobTaskSpec struct {
	// Describes how to create tasks as Pods.
	//
	// The following fields support context variable substitution:
	//
	//  - .spec.containers.*.image
	//  - .spec.containers.*.command.*
	//  - .spec.containers.*.args.*
	//  - .spec.containers.*.env.*.value
	Template corev1.PodTemplateSpec `json:"template"`

	// Optional duration in seconds to wait before terminating the task if it is
	// still pending. This field is useful to prevent jobs from being stuck forever
	// if the Job has a deadline to start running by. If not set, it will be set to
	// the DefaultTaskPendingTimeoutSeconds configuration value in the controller.
	//
	// Value must be a positive integer.
	// +optional
	PendingTimeoutSeconds *int64 `json:"pendingTimeoutSeconds,omitempty"`

	// ForbidForceDeletion, if true, means that tasks are not allowed to be
	// force deleted. If the node is unresponsive, it may be possible that the task
	// cannot be killed by normal graceful deletion. The controller may choose to
	// force delete the task, which would ignore the final state of the task since
	// the node is unable to return whether the task is actually still alive.
	//
	// As such, if not set to true, the Forbid ConcurrencyPolicy may in some cases
	// be violated. Setting this to true would prevent this from happening, but the
	// Job may remain in Killing indefinitely until the node recovers.
	//
	// +optional
	ForbidForceDeletion bool `json:"forbidForceDeletion,omitempty"`
}

JobTaskSpec describes a single task in the Job.

func (*JobTaskSpec) DeepCopy

func (in *JobTaskSpec) DeepCopy() *JobTaskSpec

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new JobTaskSpec.

func (*JobTaskSpec) DeepCopyInto

func (in *JobTaskSpec) DeepCopyInto(out *JobTaskSpec)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type JobTemplate

type JobTemplate struct {
	metav1.ObjectMeta `json:"metadata,omitempty"`

	// Specification of the desired behavior of the job.
	Spec JobTemplateSpec `json:"spec"`
}

func (*JobTemplate) DeepCopy

func (in *JobTemplate) DeepCopy() *JobTemplate

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new JobTemplate.

func (*JobTemplate) DeepCopyInto

func (in *JobTemplate) DeepCopyInto(out *JobTemplate)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type JobTemplateSpec

type JobTemplateSpec struct {
	// Describes the tasks to be created for the Job.
	Task JobTaskSpec `json:"task"`

	// Specifies maximum number of retry attempts for the Job if the job exceeds its
	// pending timeout or active deadline. Each retry attempt will create a single
	// task at a time. The controller will create up to MaxRetryAttempts+1 tasks for
	// the job, before terminating in RetryLimitExceeded or PendingTimeout. Defaults
	// to 0, which means no retry. Value must be a non-negative integer.
	//
	// +kubebuilder:validation:Minimum=0
	// +optional
	MaxRetryAttempts *int32 `json:"maxRetryAttempts,omitempty"`

	// Optional duration in seconds to wait between retries. If left empty or zero,
	// it means no delay (i.e. retry immediately). Value must be a non-negative
	// integer.
	//
	// +kubebuilder:validation:Minimum=0
	// +optional
	RetryDelaySeconds *int64 `json:"retryDelaySeconds,omitempty"`
}

func (*JobTemplateSpec) DeepCopy

func (in *JobTemplateSpec) DeepCopy() *JobTemplateSpec

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new JobTemplateSpec.

func (*JobTemplateSpec) DeepCopyInto

func (in *JobTemplateSpec) DeepCopyInto(out *JobTemplateSpec)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type JobType

type JobType string
const (
	// JobTypeAdhoc means that the Job was created on an ad-hoc basis externally.
	JobTypeAdhoc JobType = "Adhoc"

	// JobTypeScheduled means that the Job was created on an automatic schedule.
	JobTypeScheduled JobType = "Scheduled"
)

type MultiOptionConfig

type MultiOptionConfig struct {
	// Default values, will be used to populate the option if not specified.
	// +optional
	Default []string `json:"default,omitempty"`

	// Delimiter to join values by.
	Delimiter string `json:"delimiter"`

	// List of values to be chosen from.
	Values []string `json:"values"`

	// Whether to allow custom values instead of just the list of allowed values.
	//
	// Default: false
	// +optional
	AllowCustom bool `json:"allowCustom,omitempty"`
}

MultiOptionConfig defines the options for OptionTypeMulti.

func (*MultiOptionConfig) DeepCopy

func (in *MultiOptionConfig) DeepCopy() *MultiOptionConfig

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MultiOptionConfig.

func (*MultiOptionConfig) DeepCopyInto

func (in *MultiOptionConfig) DeepCopyInto(out *MultiOptionConfig)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type Option

type Option struct {
	// The type of the job option.
	// Can be one of: bool, string, select, multi, date
	Type OptionType `json:"type"`

	// The name of the job option. Will be substituted as `${option.NAME}`.
	// Must match the following regex: ^[a-zA-Z_0-9.-]+$
	Name string `json:"name"`

	// Label is an optional human-readable label for this option, which is purely
	// used for display purposes.
	//
	// +optional
	Label string `json:"label,omitempty"`

	// Required defines whether this field is required.
	//
	// Default: false
	// +optional
	Required bool `json:"required,omitempty"`

	// Bool adds additional configuration for OptionTypeBool.
	// +optional
	Bool *BoolOptionConfig `json:"bool,omitempty"`

	// String adds additional configuration for OptionTypeString.
	// +optional
	String *StringOptionConfig `json:"string,omitempty"`

	// Select adds additional configuration for OptionTypeSelect.
	// +optional
	Select *SelectOptionConfig `json:"select,omitempty"`

	// Multi adds additional configuration for OptionTypeMulti.
	// +optional
	Multi *MultiOptionConfig `json:"multi,omitempty"`

	// Date adds additional configuration for OptionTypeDate.
	// +optional
	Date *DateOptionConfig `json:"date,omitempty"`
}

Option defines a single job option.

func (*Option) DeepCopy

func (in *Option) DeepCopy() *Option

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Option.

func (*Option) DeepCopyInto

func (in *Option) DeepCopyInto(out *Option)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type OptionSpec

type OptionSpec struct {
	// Options is a list of job options.
	// +optional
	Options []Option `json:"options,omitempty"`
}

OptionSpec defines how a JobConfig is parameterized using Job Options.

func (*OptionSpec) DeepCopy

func (in *OptionSpec) DeepCopy() *OptionSpec

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OptionSpec.

func (*OptionSpec) DeepCopyInto

func (in *OptionSpec) DeepCopyInto(out *OptionSpec)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type OptionType

type OptionType string
const (
	// OptionTypeBool defines an Option whose type is a boolean value.
	OptionTypeBool OptionType = "Bool"

	// OptionTypeString defines an Option whose type is an arbitrary string.
	OptionTypeString OptionType = "String"

	// OptionTypeSelect defines an Option whose value comes from a list of strings.
	OptionTypeSelect OptionType = "Select"

	// OptionTypeMulti defines an Option that contains zero or more values from a
	// list of strings, delimited with some delimiter.
	OptionTypeMulti OptionType = "Multi"

	// OptionTypeDate defines an Option whose value is a formatted date string.
	OptionTypeDate OptionType = "Date"
)

func (OptionType) IsValid

func (t OptionType) IsValid() bool

type ScheduleContraints

type ScheduleContraints struct {
	// If set, the scheduler should not perform any scheduling for timestamps before
	// this.
	//
	// For example, if a JobConfig that was previously disabled from automatic
	// scheduling is now enabled, then NotBefore will be automatically updated to
	// the current time. This prevents accidental back-scheduling so that we may not
	// use LastScheduleTime to compute back-schedules that are before it was
	// re-enabled.
	//
	// +optional
	NotBefore *metav1.Time `json:"notBefore,omitempty"`
}

ScheduleContraints defines constraints for automatic scheduling.

func (*ScheduleContraints) DeepCopy

func (in *ScheduleContraints) DeepCopy() *ScheduleContraints

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ScheduleContraints.

func (*ScheduleContraints) DeepCopyInto

func (in *ScheduleContraints) DeepCopyInto(out *ScheduleContraints)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type ScheduleSpec

type ScheduleSpec struct {
	// Specify a schedule using cron expressions.
	//
	// +optional
	Cron *CronSchedule `json:"cron,omitempty"`

	// If true, then automatic scheduling will be disabled for the JobConfig.
	// +optional
	Disabled bool `json:"disabled"`

	// Specifies any constraints that should apply to this Schedule.
	//
	// +optional
	Constraints *ScheduleContraints `json:"constraints,omitempty"`
}

ScheduleSpec defines how a JobConfig should be automatically scheduled.

func (*ScheduleSpec) DeepCopy

func (in *ScheduleSpec) DeepCopy() *ScheduleSpec

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ScheduleSpec.

func (*ScheduleSpec) DeepCopyInto

func (in *ScheduleSpec) DeepCopyInto(out *ScheduleSpec)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type SelectOptionConfig

type SelectOptionConfig struct {
	// Default value, will be used to populate the option if not specified.
	// +optional
	Default string `json:"default,omitempty"`

	// List of values to be chosen from.
	// +optional
	Values []string `json:"values"`

	// Whether to allow custom values instead of just the list of allowed values.
	//
	// Default: false
	// +optional
	AllowCustom bool `json:"allowCustom,omitempty"`
}

SelectOptionConfig defines the options for OptionTypeSelect.

func (*SelectOptionConfig) DeepCopy

func (in *SelectOptionConfig) DeepCopy() *SelectOptionConfig

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SelectOptionConfig.

func (*SelectOptionConfig) DeepCopyInto

func (in *SelectOptionConfig) DeepCopyInto(out *SelectOptionConfig)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type StartPolicySpec

type StartPolicySpec struct {
	// Specifies the behaviour when there are other concurrent jobs for the
	// JobConfig.
	ConcurrencyPolicy ConcurrencyPolicy `json:"concurrencyPolicy"`

	// Specifies the earliest time that the Job can be started after. Can be
	// specified together with other fields.
	//
	// +optional
	StartAfter *metav1.Time `json:"startAfter,omitempty"`
}

StartPolicySpec specifies certain conditions that have to be met before a Job can be started.

func (*StartPolicySpec) DeepCopy

func (in *StartPolicySpec) DeepCopy() *StartPolicySpec

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new StartPolicySpec.

func (*StartPolicySpec) DeepCopyInto

func (in *StartPolicySpec) DeepCopyInto(out *StartPolicySpec)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type StringOptionConfig

type StringOptionConfig struct {
	// Optional default value, will be used to populate the option if not specified.
	// +optional
	Default string `json:"default,omitempty"`

	// Whether to trim spaces before substitution.
	//
	// Default: false
	// +optional
	TrimSpaces bool `json:"trimSpaces,omitempty"`
}

StringOptionConfig defines the options for OptionTypeString.

func (*StringOptionConfig) DeepCopy

func (in *StringOptionConfig) DeepCopy() *StringOptionConfig

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new StringOptionConfig.

func (*StringOptionConfig) DeepCopyInto

func (in *StringOptionConfig) DeepCopyInto(out *StringOptionConfig)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type TaskContainerState

type TaskContainerState struct {
	// Exit status from the last termination of the container
	ExitCode int32 `json:"exitCode"`

	// Signal from the last termination of the container
	// +optional
	Signal int32 `json:"signal,omitempty"`

	// Unique, one-word, CamelCase reason for the container's status.
	// +optional
	Reason string `json:"reason,omitempty"`

	// Message regarding the container's status.
	// +optional
	Message string `json:"message,omitempty"`

	// Container ID of the container. May be empty if the container is not yet
	// created.
	// +optional
	ContainerID string `json:"containerID,omitempty"`
}

func (*TaskContainerState) DeepCopy

func (in *TaskContainerState) DeepCopy() *TaskContainerState

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TaskContainerState.

func (*TaskContainerState) DeepCopyInto

func (in *TaskContainerState) DeepCopyInto(out *TaskContainerState)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type TaskRef

type TaskRef struct {
	// Name of the task. Assumes to share the same namespace as the Job.
	Name string `json:"name"`

	// Creation time of the task.
	CreationTimestamp metav1.Time `json:"creationTimestamp"`

	// Timestamp that the task transitioned to running. May be zero if the task was
	// never observed as started running.
	//
	// +optional
	RunningTimestamp *metav1.Time `json:"runningTimestamp,omitempty"`

	// Time that the task finished. Will always return a non-zero timestamp if task
	// is finished.
	//
	// +optional
	FinishTimestamp *metav1.Time `json:"finishTimestamp,omitempty"`

	// Status of the task. This field will be reconciled from the relevant task
	// object, may not be always up-to-date. This field will persist the state of
	// tasks beyond the lifetime of the task resources, even if they are deleted.
	Status TaskStatus `json:"status"`

	// DeletedStatus, if set, specifies a placeholder Status of the task after it is
	// reconciled as deleted. If the task is deleted, Status cannot be reconciled
	// from the task any more, and instead uses information stored in DeletedStatus.
	// In other words, this field acts as a tombstone marker, and is only used after
	// the task object is already deleted. complete.
	//
	// While the task is in the process of being deleted (i.e. deletionTimestamp is
	// set but object still exists), Status will still be reconciled from the actual
	// task's status.
	//
	// If the task is already deleted and DeletedStatus is also not set, then the
	// task's state will be marked as TaskDeletedFinalStateUnknown.
	//
	// +optional
	DeletedStatus *TaskStatus `json:"deletedStatus,omitempty"`

	// Node name that the task was bound to. May be empty if task was never
	// scheduled.
	//
	// +optional
	NodeName string `json:"nodeName,omitempty"`

	// States of each container for the task. This field will be reconciled from the
	// relevant task object, and is not guaranteed to be up-to-date. This field will
	// persist the state of tasks beyond the lifetime of the task resources, even if
	// they were deleted.
	ContainerStates []TaskContainerState `json:"containerStates"`
}

TaskRef stores information about a Job's owned task.

func (*TaskRef) DeepCopy

func (in *TaskRef) DeepCopy() *TaskRef

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TaskRef.

func (*TaskRef) DeepCopyInto

func (in *TaskRef) DeepCopyInto(out *TaskRef)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type TaskState

type TaskState string
const (
	// TaskStaging means that the task is created, but no containers are created
	// yet.
	TaskStaging TaskState = "Staging"

	// TaskStarting means that the task is created and container is created, but it
	// has not yet started running.
	TaskStarting TaskState = "Starting"

	// TaskRunning means that the task has started running successfully.
	TaskRunning TaskState = "Running"

	// TaskSuccess means that the task has finished successfully with no errors.
	TaskSuccess TaskState = "Success"

	// TaskFailed means that the task exited with a non-zero code or some other
	// application-level error.
	TaskFailed TaskState = "Failed"

	// TaskPendingTimeout means that the task had failed to start within the
	// specified pending timeout.
	TaskPendingTimeout TaskState = "PendingTimeout"

	// TaskDeadlineExceeded means that the task had failed to terminate within its
	// active deadline and has now been terminated.
	TaskDeadlineExceeded TaskState = "DeadlineExceeded"

	// TaskKilling means that the task is in the process of being killed by external
	// interference.
	TaskKilling TaskState = "Killing"

	// TaskKilled means that the task is successfully killed by external
	// interference.
	TaskKilled TaskState = "Killed"

	// TaskDeletedFinalStateUnknown means that task was deleted and its final status
	// was unknown to the controller. This could happen if the task was force
	// deleted, or the controller lost the status of the task and it was already
	// deleted.
	TaskDeletedFinalStateUnknown TaskState = "DeletedFinalStateUnknown"
)

type TaskStatus

type TaskStatus struct {
	// State of the task.
	State TaskState `json:"state"`

	// The execution result derived from this task if it was finished. For
	// simplicity, the values of this field also matches that of the Job's result
	// field.
	//
	// +optional
	Result *JobResult `json:"result,omitempty"`

	// Unique, one-word, CamelCase reason for the task's status.
	// +optional
	Reason string `json:"reason,omitempty"`

	// Descriptive message for the task's status.
	// +optional
	Message string `json:"message,omitempty"`
}

TaskStatus stores the last known status of a Job's task.

func (*TaskStatus) DeepCopy

func (in *TaskStatus) DeepCopy() *TaskStatus

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TaskStatus.

func (*TaskStatus) DeepCopyInto

func (in *TaskStatus) DeepCopyInto(out *TaskStatus)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

Jump to

Keyboard shortcuts

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