Updating a Specified Cron Job
Function
This API is used to update a specified cron 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/v1beta1/namespaces/{namespace}/cronjobs/{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
{
"spec": {
"concurrencyPolicy": "Forbid"
}
}
Response
Response parameters:
For the description about response parameters, see Table 2.
Example response:
{
"kind": "CronJob",
"apiVersion": "batch/v1beta1",
"metadata": {
"name": "cronjob-test",
"namespace": "default",
"selfLink": "/apis/batch/v1beta1/namespaces/default/cronjobs/cronjob-test",
"uid": "7cf2c54b-2201-11e8-96aa-fa163ecd089c",
"resourceVersion": "441884",
"creationTimestamp": "2018-03-07T12:17:22Z",
"enable": true
},
"spec": {
"schedule": "*/59 * * * *",
"concurrencyPolicy": "Forbid",
"suspend": false,
"jobTemplate": {
"metadata": {
"creationTimestamp": null,
"enable": true
},
"spec": {
"template": {
"metadata": {
"creationTimestamp": null,
"labels": {
"sjname": "cronjob-test"
},
"enable": true
},
"spec": {
"containers": [
{
"name": "container-0",
"image": "nginx:stable-perl",
"resources": {},
"lifecycle": {},
"terminationMessagePath": "/dev/termination-log",
"terminationMessagePolicy": "File",
"imagePullPolicy": "IfNotPresent"
}
],
"restartPolicy": "OnFailure",
"terminationGracePeriodSeconds": 30,
"dnsPolicy": "ClusterFirst",
"securityContext": {},
"imagePullSecrets": [
{
"name": "default-secret"
}
],
"schedulerName": "default-scheduler"
}
}
}
},
"successfulJobsHistoryLimit": 3,
"failedJobsHistoryLimit": 1
},
"status": {}
}
Status Code
Table 2 describes the status code of this API.
|
Status Code |
Description |
|---|---|
|
200 |
This operation succeeds, and a CronJob resource object is returned. |
For the description about error status codes, see Status Code.
Last Article: Updating the Status of a Specified Cron Job
Next Article: ReplicaSet
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.