Updating a Specified Node

Function

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

URI

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

Table 1 describes the parameters of the 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.

node_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 API Usage Guidelines.

Table 3 Parameters in the request body

Parameter

Mandatory

Type

Description

metadata

No

metadata object

Node's metadata, which is a collection of attributes.

Table 4 Data structure of the metadata field

Parameter

Mandatory

Type

Description

name

Yes

String

Node name. After the node name is changed, the ECS name (VM name) is changed accordingly.

Example request:

{
    "metadata": {
        "name": "new-hostname"
    }
}

Response

Response parameters:

For the description of the response parameters, see Table 4.

Example response:

{
  "kind": "Node",
  "apiVersion": "v3",
  "metadata": {
    "name": "new-hostname",
    "uid": "4d1ecb2c-229a-11e8-9c75-0255ac100ceb",
    "creationTimestamp": " 2020-02-20T21:11:09Z",
    "updateTimestamp": "2020-02-20T21:11:09Z",
    "annotations": {
      "kubernetes.io/node-pool.id": "eu-de-01#s1.medium#EulerOS 2.5"
    }
  },
  "spec": {
    "flavor": "s1.medium",
    "az": "eu-de-01",
    "os": "EulerOS 2.5",
    "login": {
      "sshKey": "KeyPair-demo",
    },
    "rootVolume": {
      "volumeType": "SAS",
      "diskSize": 40
    },
    "dataVolumes": [
      {
        "volumeType": "SAS",
        "diskSize": 100
      }
    ],
    "storage": {
        "storageSelectors": [
            {
                "name": "cceUse",
                "storageType": "evs",
                "matchLabels": {
                    "size": "100",
                    "volumeType": "SAS",
                    "count": "1"
                }
            }
        ],
        "storageGroups": [
            {
                "name": "vgpaas",
                "selectorNames": [
                    "cceUse"
                ],
                "cceManaged": true,
                "virtualSpaces": [
                    {
                        "name": "runtime",
                        "size": "90%"
                    },
                    {
                        "name": "kubernetes",
                        "size": "10%"
                    }
                ]
            }
        ]
    },
     "publicIP": {
        "eip": {
            "bandwidth": {}
        }
     },
      "nodeNicSpec": {
          "primaryNic": {
          "subnetId": "c90b3ce5-e1f1-4c87-a006-644d78846438"
         }
     },
      "billingMode": 0
    "publicIP": {
      "eip": {
      }
    }
  },
  "status": {
    "phase": "Active",
    "serverId": "456789abc-9368-46f3-8f29-d1a95622a568",
    "publicIP": "10.34.56.78",
    "privateIP": "192.168.1.23"
  }
}

Status Code

Table 5 describes the status code of this API.

Table 5 Status code

Status Code

Description

200

Information about the specified node is successfully updated.

For details about error status codes, see Status Code.