nav-img
Advanced

Updating a Specified Cluster

Function

This API is used to update information about a specified cluster.

URI

PUT /api/v3/projects/{project_id}/clusters/{cluster_id}

Table 1 describes the parameters of this API.

Table 1 Parameter description

Parameter

Mandatory

Description

project_id

Yes

Project ID. For details about how to obtain the project ID, see How to Obtain Parameters in the API URI.

cluster_id

Yes

Cluster ID. For details about how to obtain the cluster ID, see How to Obtain Parameters in the API URI.

Request

Request parameters:

Table 2 and Table 3 describe the request parameters.

Table 2 Parameters in the request header

Parameter

Mandatory

Description

Content-Type

Yes

Message body type (format). Possible values:

  • application/json;charset=utf-8
  • application/json

X-Auth-Token

Yes

Requests for calling an API can be authenticated using either a token or AK/SK. If token-based authentication is used, this parameter is mandatory and must be set to a user token. For details on how to obtain a user token, see Obtaining a User Token.

Table 3 Parameters in the request body

Parameter

Mandatory

Type

Description

spec

Yes

spec object

Detailed description of the cluster targeted by this API. CCE creates or updates objects by defining or updating its spec.

Table 4 Data structure of the spec field

Parameter

Mandatory

Type

Description

description

No

String

Cluster description.

Example request:

  • Updating the description of a cluster
    {
    "spec" : {
    "description" : "new description"
    }
    }

Response

Response parameters:

For details about the response parameters, see Table 5.

Table 5 Parameters in the response body

Parameter

Type

Description

kind

String

API type. For a cluster management API, the parameter must be set to Cluster and cannot be changed.

apiVersion

String

API version. The value is fixed at v3 and cannot be changed.

metadata

metadata object

Basic information about a cluster. metadata is a collection of attributes.

spec

spec object

Detailed description of the cluster to be created. CCE creates or updates objects by defining or updating its spec.

status

status object

Cluster status and jobID of the job that reads a specified cluster.

Example response:

{
"kind": "Cluster",
"apiVersion": "v3",
"metadata": {
"name": "mycluster",
"uid": "4d1ecb2c-229a-11e8-9c75-0255ac100ceb",
"creationTimestamp": "2020-02-02 03:48:58.968214406 +0000 UTC",
"updateTimestamp": "2020-02-02 06:39:36.844676088 +0000 UTC"
},
"spec": {
"type": "VirtualMachine",
"flavor": "cce.s1.small",
"version": "v1.17.9-r0",
"description": "new description",
"az": "ru-moscow-1a",
"ipv6enable": false,
"supportIstio": true,
"hostNetwork": {
"vpc": "4d1ecb2c-229a-11e8-9c75-0255ac100ceb",
"subnet": "4d1ecb2c-229a-11e8-9c75-0255ac100ceb",
"SecurityGroup": "5da0b181-e0a2-4981-87ac-1681545cd666"
},
"containerNetwork": {
"mode": "overlay_l2",
"cidr": "172.17.0.0/16"
},
"eniNetwork": {},
"authentication": {
"mode": "rbac",
"authenticatingProxy": {}
},
"billingMode": 0,
"extendParam": {
"alpha.cce/fixPoolMask": "",
"kubernetes.io/cpuManagerPolicy": "",
"patchVersion": "",
"upgradefrom": ""
},
"kubernetesSvcIpRange": "10.247.0.0/16",
"kubeProxyMode": "iptables"
},
"status": {
"phase": "Available",
"endpoints": [
{
"Internal": "https://192.168.0.61:5443",
},
{
"External": "https://10.185.69.54:5443",
},
{
"external_sbc": "https://a140174a-2f3e-11e9-9f91-0255ac101405.cce.ru-moscow.hc.sbercloud.ru",
},
]
}
}

Status Code

Table 6 describes the status code of this API.

Table 6 Status code

Status Code

Description

200

Information about the specified cluster is successfully updated.

For details about error status codes, see Status Code.