Job
apiVersion: batch/v1
import "k8s.io/api/batch/v1"
Job
Job represents the configuration of a single job.
-
apiVersion: batch/v1
-
kind: Job
-
metadata (ObjectMeta)
Standard object’s metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata -
spec (JobSpec)
Specification of the desired behavior of a job. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status -
status (JobStatus)
Current status of a job. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
JobSpec
JobSpec describes how the job execution will look like.
Replicas
- template (PodTemplateSpec), required
Describes the pod that will be created when executing a job. More info: https://kubernetes.io/docs/concepts/workloads/controllers/jobs-run-to-completion/ - parallelism (int32)
Specifies the maximum desired number of pods the job should run at any given time. The actual number of pods running in steady state will be less than this number when ((.spec.completions - .status.successful) < .spec.parallelism), i.e. when the work left to do is less than max parallelism. More info: https://kubernetes.io/docs/concepts/workloads/controllers/jobs-run-to-completion/
Lifecycle
- completions (int32)
Specifies the desired number of successfully finished pods the job should be run with. Setting to nil means that the success of any pod signals the success of all pods, and allows parallelism to have any positive value. Setting to 1 means that parallelism is limited to 1 and the success of that pod signals the success of the job. More info: https://kubernetes.io/docs/concepts/workloads/controllers/jobs-run-to-completion/ - backoffLimit (int32)
Specifies the number of retries before marking this job failed. Defaults to 6 - activeDeadlineSeconds (int64)
Specifies the duration in seconds relative to the startTime that the job may be active before the system tries to terminate it; value must be positive integer - ttlSecondsAfterFinished (int32)
ttlSecondsAfterFinished limits the lifetime of a Job that has finished execution (either Complete or Failed). If this field is set, ttlSecondsAfterFinished after the Job finishes, it is eligible to be automatically deleted. When the Job is being deleted, its lifecycle guarantees (e.g. finalizers) will be honored. If this field is unset, the Job won’t be automatically deleted. If this field is set to zero, the Job becomes eligible to be deleted immediately after it finishes. This field is alpha-level and is only honored by servers that enable the TTLAfterFinished feature.
Selector
- selector (LabelSelector)
A label query over pods that should match the pod count. Normally, the system sets this field for you. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors - manualSelector (boolean)
manualSelector controls generation of pod labels and pod selectors. LeavemanualSelector
unset unless you are certain what you are doing. When false or unset, the system pick labels unique to this job and appends those labels to the pod template. When true, the user is responsible for picking unique labels and specifying the selector. Failure to pick a unique label may cause this and other jobs to not function correctly. However, You may seemanualSelector=true
in jobs that were created with the oldextensions/v1beta1
API. More info: https://kubernetes.io/docs/concepts/workloads/controllers/jobs-run-to-completion/#specifying-your-own-pod-selector
JobStatus
JobStatus represents the current state of a Job.
- startTime (Time)
Represents time when the job was acknowledged by the job controller. It is not guaranteed to be set in happens-before order across separate operations. It is represented in RFC3339 form and is in UTC.
Time is a wrapper around time.Time which supports correct marshaling to YAML and JSON. Wrappers are provided for many of the factory methods that the time package offers. - completionTime (Time)
Represents time when the job was completed. It is not guaranteed to be set in happens-before order across separate operations. It is represented in RFC3339 form and is in UTC.
Time is a wrapper around time.Time which supports correct marshaling to YAML and JSON. Wrappers are provided for many of the factory methods that the time package offers. - active (int32)
The number of actively running pods. - failed (int32)
The number of pods which reached phase Failed. - succeeded (int32)
The number of pods which reached phase Succeeded. - conditions ([]JobCondition)
Patch strategy: merge on keytype
The latest available observations of an object’s current state. More info: https://kubernetes.io/docs/concepts/workloads/controllers/jobs-run-to-completion/
JobCondition describes current state of a job.- conditions.status (string), required
Status of the condition, one of True, False, Unknown. - conditions.type (string), required
Type of job condition, Complete or Failed. - conditions.lastProbeTime (Time)
Last time the condition was checked.
Time is a wrapper around time.Time which supports correct marshaling to YAML and JSON. Wrappers are provided for many of the factory methods that the time package offers. - conditions.lastTransitionTime (Time)
Last time the condition transit from one status to another.
Time is a wrapper around time.Time which supports correct marshaling to YAML and JSON. Wrappers are provided for many of the factory methods that the time package offers. - conditions.message (string)
Human readable message indicating details about last transition. - conditions.reason (string)
(brief) reason for the condition’s last transition.
- conditions.status (string), required
JobList
JobList is a collection of jobs.
-
apiVersion: batch/v1
-
kind: JobList
-
metadata (ListMeta)
Standard list metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata -
items ([]Job), required
items is the list of Jobs.
Operations
get
read the specified Job
HTTP Request
GET /apis/batch/v1/namespaces/{namespace}/jobs/{name}
Parameters
- {name} (string), required
name of the Job - {namespace} (string), required
namespace - ?pretty (string)
pretty
Response
200 (Job): OK
401: Unauthorized
get
read status of the specified Job
HTTP Request
GET /apis/batch/v1/namespaces/{namespace}/jobs/{name}/status
Parameters
- {name} (string), required
name of the Job - {namespace} (string), required
namespace - ?pretty (string)
pretty
Response
200 (Job): OK
401: Unauthorized
list
list or watch objects of kind Job
HTTP Request
GET /apis/batch/v1/namespaces/{namespace}/jobs
Parameters
- {namespace} (string), required
namespace - ?allowWatchBookmarks (boolean)
allowWatchBookmarks - ?continue (string)
continue - ?fieldSelector (string)
fieldSelector - ?labelSelector (string)
labelSelector - ?limit (integer)
limit - ?pretty (string)
pretty - ?resourceVersion (string)
resourceVersion - ?resourceVersionMatch (string)
resourceVersionMatch - ?timeoutSeconds (integer)
timeoutSeconds - ?watch (boolean)
watch
Response
200 (JobList): OK
401: Unauthorized
list
list or watch objects of kind Job
HTTP Request
GET /apis/batch/v1/jobs
Parameters
- ?allowWatchBookmarks (boolean)
allowWatchBookmarks - ?continue (string)
continue - ?fieldSelector (string)
fieldSelector - ?labelSelector (string)
labelSelector - ?limit (integer)
limit - ?pretty (string)
pretty - ?resourceVersion (string)
resourceVersion - ?resourceVersionMatch (string)
resourceVersionMatch - ?timeoutSeconds (integer)
timeoutSeconds - ?watch (boolean)
watch
Response
200 (JobList): OK
401: Unauthorized
create
create a Job
HTTP Request
POST /apis/batch/v1/namespaces/{namespace}/jobs
Parameters
-
{namespace} (string), required
namespace -
body (Job), required
-
?dryRun (string)
dryRun -
?fieldManager (string)
fieldManager -
?pretty (string)
pretty
Response
200 (Job): OK
201 (Job): Created
202 (Job): Accepted
401: Unauthorized
update
replace the specified Job
HTTP Request
PUT /apis/batch/v1/namespaces/{namespace}/jobs/{name}
Parameters
-
{name} (string), required
name of the Job -
{namespace} (string), required
namespace -
body (Job), required
-
?dryRun (string)
dryRun -
?fieldManager (string)
fieldManager -
?pretty (string)
pretty
Response
200 (Job): OK
201 (Job): Created
401: Unauthorized
update
replace status of the specified Job
HTTP Request
PUT /apis/batch/v1/namespaces/{namespace}/jobs/{name}/status
Parameters
-
{name} (string), required
name of the Job -
{namespace} (string), required
namespace -
body (Job), required
-
?dryRun (string)
dryRun -
?fieldManager (string)
fieldManager -
?pretty (string)
pretty
Response
200 (Job): OK
201 (Job): Created
401: Unauthorized
patch
partially update the specified Job
HTTP Request
PATCH /apis/batch/v1/namespaces/{namespace}/jobs/{name}
Parameters
-
{name} (string), required
name of the Job -
{namespace} (string), required
namespace -
body (Patch), required
-
?dryRun (string)
dryRun -
?fieldManager (string)
fieldManager -
?force (boolean)
force -
?pretty (string)
pretty
Response
200 (Job): OK
401: Unauthorized
patch
partially update status of the specified Job
HTTP Request
PATCH /apis/batch/v1/namespaces/{namespace}/jobs/{name}/status
Parameters
-
{name} (string), required
name of the Job -
{namespace} (string), required
namespace -
body (Patch), required
-
?dryRun (string)
dryRun -
?fieldManager (string)
fieldManager -
?force (boolean)
force -
?pretty (string)
pretty
Response
200 (Job): OK
401: Unauthorized
delete
delete a Job
HTTP Request
DELETE /apis/batch/v1/namespaces/{namespace}/jobs/{name}
Parameters
-
{name} (string), required
name of the Job -
{namespace} (string), required
namespace -
body (DeleteOptions)
-
?dryRun (string)
dryRun -
?gracePeriodSeconds (integer)
gracePeriodSeconds -
?pretty (string)
pretty -
?propagationPolicy (string)
propagationPolicy
Response
200 (Status): OK
202 (Status): Accepted
401: Unauthorized
deletecollection
delete collection of Job
HTTP Request
DELETE /apis/batch/v1/namespaces/{namespace}/jobs
Parameters
-
{namespace} (string), required
namespace -
body (DeleteOptions)
-
?continue (string)
continue -
?dryRun (string)
dryRun -
?fieldSelector (string)
fieldSelector -
?gracePeriodSeconds (integer)
gracePeriodSeconds -
?labelSelector (string)
labelSelector -
?limit (integer)
limit -
?pretty (string)
pretty -
?propagationPolicy (string)
propagationPolicy -
?resourceVersion (string)
resourceVersion -
?resourceVersionMatch (string)
resourceVersionMatch -
?timeoutSeconds (integer)
timeoutSeconds
Response
200 (Status): OK
401: Unauthorized