Updating a Specified Job
Function
This API is used to update the specified Job.
The following fields can be updated:
- metadata.selfLink
- metadata.resourceVersion
- metadata.creationTimestamp
- metadata.name
- metadata.namespace
- metadata.labels
- spec.parallelism
- spec.completions
- spec.selector
URI
PATCH /apis/batch/v1/namespaces/{namespace}/jobs/{name}
Table 1 describes the parameters of this API.
Request
Request parameters:
For the description about the Content-Type field, see Patch Request Method Operation Description.
Example request:
Content-Type: application/merge-patch+json
{
"op": "replace",
"path": "/status",
"value": "Available"
}
Response
Response parameters:
For the description about response parameters, see Table 2.
Example response:
{
"kind": "Job",
"apiVersion": "batch/v1",
"metadata": {
"name": "jobs-12130306",
"namespace": "ns-12130306-s",
"selfLink": "/apis/batch/v1/namespaces/ns-12130306-s/jobs/jobs-12130306",
"uid": "eed6b02b-dfb3-11e7-9c19-fa163e2d897b",
"resourceVersion": "419066",
"creationTimestamp": "2017-12-13T03:15:55Z",
"labels": {
"app": "new-jobs",
"name": "job-test"
},
"enable": true
},
"spec": {
"parallelism": 1,
"completions": 1,
"selector": {
"matchLabels": {
"controller-uid": "eed6b02b-dfb3-11e7-9c19-fa163e2d897b"
}
},
"template": {
"metadata": {
"name": "jobs-12130306",
"creationTimestamp": null,
"labels": {
"controller-uid": "eed6b02b-dfb3-11e7-9c19-fa163e2d897b",
"job-name": "jobs-12130306",
"name": "job-test"
},
"enable": true
},
"spec": {
"containers": [
{
"name": "jobs-12130306",
"image": "10.125.5.235:20202/test/redis:latest",
"resources": {},
"terminationMessagePath": "/dev/termination-log",
"terminationMessagePolicy": "File",
"imagePullPolicy": "Always"
}
],
"restartPolicy": "Never",
"terminationGracePeriodSeconds": 30,
"dnsPolicy": "ClusterFirst",
"securityContext": {},
"schedulerName": "default-scheduler"
}
}
},
"status": {
"startTime": "2017-12-13T03:15:55Z",
"active": 1
}
}
Status Code
Table 2 describes the status code of this API.
|
Status Code |
Description |
|---|---|
|
200 |
This operation succeeds, and a Job resource object is returned. |
For the description about error status codes, see Status Code.
Last Article: Updating the Status of a Specified Job
Next Article: CronJob
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.