Listing All Deployments of a User

Function

This API is used to list all Deployments of a user.

URI

GET /apis/apps/v1/deployments

Table 1 describes the parameters of this API.

Table 1 Parameter description

Parameter

Mandatory

Description

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.

labelSelector

No

A selector to restrict the list of returned objects by their labels. Defaults to everything.

pretty

No

If 'true', then the output is pretty printed.

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. When specified for list: - if unset, then the result is returned from remote storage based on quorum-read flag; - if it's 0, then we simply return what we currently have in cache, no guarantee; - if set to non zero, then the result is at least as fresh as given rv.

timeoutSeconds

No

Timeout for the list/watch call.

watch

No

Watch for changes to the described resources and return them as a stream of add, update, and remove notifications. Specify resourceVersion.

Request

N/A

Response

Response parameters

For the description about response parameters, see Table 79.

Example response

{
    "kind": "DeploymentList",
    "apiVersion": "extensions/v1beta1",
    "metadata": {
        "selfLink": "/apis/extensions/v1beta1/deployments",
        "resourceVersion": "418820"
    },
    "items": [
        {
            "metadata": {
                "name": "nginx",
                "namespace": "default",
                "selfLink": "/apis/extensions/v1beta1/namespaces/default/deployments/nginx",
                "uid": "3f7846b5-dc93-11e7-9c19-fa163e2d897b",
                "resourceVersion": "28579",
                "generation": 2,
                "creationTimestamp": "2017-12-09T03:44:24Z",
                "labels": {
                    "app": "nginx"
                },
                "annotations": {
                    "deployment.kubernetes.io/revision": "1",
                    "service.protal.kubernetes.io/access-ip": "10.247.51.55:123",
                    "service.protal.kubernetes.io/type": "ClusterIP"
                },
                "enable": true
            },
            "spec": {
                "replicas": 1,
                "selector": {
                    "matchLabels": {
                        "app": "nginx"
                    }
                },
                "template": {
                    "metadata": {
                        "creationTimestamp": null,
                        "labels": {
                            "app": "nginx"
                        },
                        "enable": true
                    },
                    "spec": {
                        "containers": [
                            {
                                "name": "nginx",
                                "image": "172.16.5.235:20202/test-01/mysql:v1",
                                "resources": {},
                                "terminationMessagePath": "/dev/termination-log",
                                "terminationMessagePolicy": "File",
                                "imagePullPolicy": "Always"
                            }
                        ],
                        "restartPolicy": "Always",
                        "terminationGracePeriodSeconds": 30,
                        "dnsPolicy": "ClusterFirst",
                        "securityContext": {},
                        "schedulerName": "default-scheduler"
                    }
                },
                "strategy": {
                    "type": "RollingUpdate",
                    "rollingUpdate": {
                        "maxUnavailable": 1,
                        "maxSurge": 1
                    }
                }
            },
            "status": {
                "observedGeneration": 2,
                "replicas": 1,
                "updatedReplicas": 1,
                "readyReplicas": 1,
                "availableReplicas": 1,
                "conditions": [
                    {
                        "type": "Available",
                        "status": "True",
                        "lastUpdateTime": "2017-12-09T03:44:24Z",
                        "lastTransitionTime": "2017-12-09T03:44:24Z",
                        "reason": "MinimumReplicasAvailable",
                        "message": "Deployment has minimum availability."
                    }
                ]
            }
        },
        {
            "metadata": {
                "name": "deploy-ex-12130306",
                "namespace": "ns-12130306-s",
                "selfLink": "/apis/extensions/v1beta1/namespaces/ns-12130306-s/deployments/deploy-ex-12130306",
                "uid": "934db57d-dfb3-11e7-9c19-fa163e2d897b",
                "resourceVersion": "418771",
                "generation": 2,
                "creationTimestamp": "2017-12-13T03:13:22Z",
                "labels": {
                    "cce/appgroup": "deploy-ex-test"
                },
                "annotations": {
                    "deployment.kubernetes.io/revision": "1"
                },
                "enable": true
            },
            "spec": {
                "replicas": 1,
                "selector": {
                    "matchLabels": {
                        "cce/appgroup": "deploy-ex-test"
                    }
                },
                "template": {
                    "metadata": {
                        "creationTimestamp": null,
                        "labels": {
                            "cce/appgroup": "deploy-ex-test"
                        },
                        "enable": true
                    },
                    "spec": {
                        "containers": [
                            {
                                "name": "deploycon-12130306",
                                "image": "172.16.5.235:20202/test/redis:latest",
                                "resources": {},
                                "terminationMessagePath": "/dev/termination-log",
                                "terminationMessagePolicy": "File",
                                "imagePullPolicy": "IfNotPresent"
                            }
                        ],
                        "restartPolicy": "Always",
                        "terminationGracePeriodSeconds": 30,
                        "dnsPolicy": "ClusterFirst",
                        "securityContext": {},
                        "schedulerName": "default-scheduler"
                    }
                },
                "strategy": {
                    "type": "RollingUpdate",
                    "rollingUpdate": {
                        "maxUnavailable": 1,
                        "maxSurge": 1
                    }
                }
            },
            "status": {
                "observedGeneration": 2,
                "replicas": 1,
                "updatedReplicas": 1,
                "readyReplicas": 1,
                "availableReplicas": 1,
                "conditions": [
                    {
                        "type": "Available",
                        "status": "True",
                        "lastUpdateTime": "2017-12-13T03:13:22Z",
                        "lastTransitionTime": "2017-12-13T03:13:22Z",
                        "reason": "MinimumReplicasAvailable",
                        "message": "Deployment has minimum availability."
                    }
                ]
            }
        }
    ]
}

Status Code

Table 2 Status code

Status Code

Description

200

This operation succeeds, and a Deployment resource object is returned.

For more status codes, see Status Codes.