• Cloud Container Engine

cce
  1. Help Center
  2. Cloud Container Engine
  3. API Reference 2.0
  4. Kubernetes API
  5. Deployment
  6. Updating the Scale of a Specified Deployment

Updating the Scale of a Specified Deployment

Function

This API is used to partially update the scale of a specified Deployment object.

The following fields can be updated:

  • metadata.resourceVersion
  • metadata.creationTimestamp
  • spec.replicas

URI

PATCH /apis/apps/v1/namespaces/{namespace}/deployments/{name}/scale

PATCH /apis/extensions/v1beta1/namespaces/{namespace}/deployments/{name}/scale

Table 1 describes the parameters of this API.

Table 1 Parameter description

Parameters

Mandatory

Description

name

Yes

name of the Scale

namespace

Yes

object name and auth scope, such as for teams and projects

pretty

No

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

Request

Request parameters:

For the description about the Content-Type message header, see section Patch Request Method Operation Description.

Example request:

[
    {
        "op": "add",
        "path": "/spec/replicas",
        "value": 2
    }
]

Response

Response parameters:

For the description about response parameters, see Table 2.

Example response:

{
    "kind": "Scale",
    "apiVersion": "extensions/v1beta1",
    "metadata": {
        "name": "deploy-ex-12130306",
        "namespace": "ns-12130306-s",
        "selfLink": "/apis/extensions/v1beta1/namespaces/ns-12130306-s/deployments/deploy-ex-12130306/scale",
        "uid": "934db57d-dfb3-11e7-9c19-fa163e2d897b",
        "resourceVersion": "418857",
        "creationTimestamp": "2017-12-13T03:13:22Z"
    },
    "spec": {
        "replicas": 2
    },
    "status": {
        "replicas": 1,
        "selector": {
            "cce/appgroup": "deploy-ex-test"
        },
        "targetSelector": "cce/appgroup=deploy-ex-test"
    }
}

Status Code

Table 2 describes the status code of this API.

Table 2 Status code

Status Code

Description

200

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

For the description about status codes, see Status Codes.