Reading All Jobs Under a Specified Namespace
Function
This API is used to read the details about all jobs under a specified namespace.
URI
GET /apis/batch/v1/namespaces/{namespace}/jobs
|
Parameter |
Description |
|---|---|
|
namespace |
Object name and auth scope, such as for teams and projects. |
|
Parameter |
Mandatory |
Description |
|---|---|---|
|
pretty |
No |
If 'true', then the output is pretty printed. |
|
labelSelector |
No |
A selector to restrict the list of returned objects by their labels. Defaults to everything. |
|
fieldSelector |
No |
A selector to restrict the list of returned objects by their fields. Defaults to everything. |
|
includeUninitialized |
No |
If true, partially initialized resources are included in the response. |
|
watch |
No |
Watch for changes to the described resources and return them as a stream of add, update, and remove notifications. Specify resourceVersion. |
|
resourceVersion |
No |
When specified with a watch call, shows changes that occur after that particular version of a resource. Defaults to changes from the beginning of history. |
|
timeoutSeconds |
No |
Timeout for the list/watch call. |
Request
N/A
Response
Response parameters
For the description about response parameters, see Table 67.
Example response
{
"kind": "JobList",
"apiVersion": "batch/v1",
"metadata": {
"selfLink": "/apis/batch/v1/namespaces/namespace-test/jobs",
"resourceVersion": "5391600"
},
"items": [
{
"metadata": {
"name": "pi",
"namespace": "namespace-test",
"selfLink": "/apis/batch/v1/namespaces/namespace-test/jobs/pi",
"uid": "8c923079-b0a8-11e8-8bcb-f898ef6c78b4",
"resourceVersion": "5391205",
"creationTimestamp": "2018-09-05T01:10:59Z",
"labels": {
"controller-uid": "8c923079-b0a8-11e8-8bcb-f898ef6c78b4",
"job-name": "pi"
},
"enable": true
},
"spec": {
"parallelism": 1,
"completions": 1,
"backoffLimit": 6,
"selector": {
"matchLabels": {
"controller-uid": "8c923079-b0a8-11e8-8bcb-f898ef6c78b4"
}
},
"template": {
"metadata": {
"name": "pi",
"creationTimestamp": null,
"labels": {
"controller-uid": "8c923079-b0a8-11e8-8bcb-f898ef6c78b4",
"job-name": "pi"
},
"annotations": {
"cri.cci.io/container-type": "secure-container"
},
"enable": true
},
"spec": {
"containers": [
{
"name": "pi",
"image": "perl",
"command": [
"perl",
"-Mbignum=bpi",
"-wle",
"print bpi(2000)"
],
"resources": {
"limits": {
"cpu": "500m",
"memory": "1Gi"
},
"requests": {
"cpu": "500m",
"memory": "1Gi"
}
},
"terminationMessagePath": "/dev/termination-log",
"terminationMessagePolicy": "File",
"imagePullPolicy": "Always"
}
],
"restartPolicy": "Never",
"terminationGracePeriodSeconds": 30,
"dnsPolicy": "ClusterFirst",
"securityContext": {},
"imagePullSecrets": [
{
"name": "imagepull-secret"
}
],
"schedulerName": "default-scheduler"
}
}
},
"status": {
"startTime": "2018-09-05T01:10:59Z",
"active": 1
}
}
]
}
Status Code
Table 3 describes the status code of this API.
|
Status Code |
Description |
|---|---|
|
200 |
This operation succeeds, and a group of Job resource objects is returned. |
For more status codes, see Status Codes.
Last Article: Reading a Job
Next Article: Reading the Status of a Job
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.