Updating a Specified Node Pool¶
Function¶
This API is used to update a specified node pool.
Note
The URL for cluster management is in the format of https://Endpoint/uri. In the URL, uri indicates the resource path, that is, the path for API access.
Currently, only the node pool name and scaling parameters in spec can be updated, such as initialNodeCount, autoscaling, name, k8sTags, taints, login, and userTags.
URI¶
PUT /api/v3/projects/{project_id}/clusters/{cluster_id}/nodepools/{nodepool_id}
Table 1 describes the parameters of this API.
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. |
nodepool_id | Yes | Node pool ID. For details about how to obtain the node pool ID, see Listing All Node Pools in a Specified Cluster. |
Request¶
Request parameters:
Table 2 and Table 3 lists the request parameters.
Parameter | Mandatory | String | Description |
---|---|---|---|
Content-Type | Yes | String | Message body type (format). Default: application/json |
X-Auth-Token | Yes | String | 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. |
Parameter | Mandatory | Type | Description |
---|---|---|---|
metadata | Yes | metadata object | Metadata of the node pool. |
spec | Yes | spec object | Parameters of the node pool. |
Parameter | Mandatory | Type | Description |
---|---|---|---|
name | Yes | String | Node pool name. Naming rule: Enter 1 to 50 characters that starts with a lowercase letter and cannot end with a hyphen (-). Lowercase letters, digits, and hyphens (-) are allowed. The value cannot be DefaultPool. |
Parameter | Mandatory | Type | Description |
---|---|---|---|
initialNodeCount | Yes | Integer | Expected number of nodes in this node pool. The value cannot be greater than the maximum number of nodes allowed for the cluster. |
autoscaling | No | autoscaling object | Auto scaling parameters. |
nodeTemplate | Yes | nodeTemplate object | Parameters of the node pool template. If az is set to random, when you create a node pool or update the number of nodes in a node pool, a scaling task is triggered. The system selects an AZ from all AZs where scaling is allowed to add nodes based on priorities. AZs with a smaller number of existing nodes have a higher priority. If AZs have the same number of nodes, the system selects the AZ based on the AZ sequence. Example:
|
Parameter | Mandatory | Type | Description |
---|---|---|---|
enable | No | Boolean | Whether to enable auto scaling. |
minNodeCount | No | Integer | Minimum number of nodes after a scale-down if auto scaling is enabled. |
maxNodeCount | No | Integer | Maximum number of nodes after a scale-up if auto scaling is enabled. The value of this parameter must be greater than or equal to that of minNodeCount and does not exceed the maximum number of nodes for the cluster. |
scaleDownCooldownTime | No | Integer | Interval during which nodes added after a scale-up will not be deleted, in minutes. |
priority | No | Integer | Node pool weight. A higher weight indicates a higher priority in scale-up. |
Parameter | Mandatory | Type | Description |
---|---|---|---|
k8sTags | No | Object | Kubernetes label, in the format of key-value pair. A maximum of 20 key-value pairs are allowed.
Example: "k8sTags": {
"key": "value"
}
|
taints | No | Object | Taints added to the created node to set anti-affinity. The following three parameters are contained in every taint:
Example: "taints": [
{
"key": "status",
"value": "unavailable",
"effect": "NoSchedule"
},
{
"key": "looks",
"value": "bad",
"effect": "NoSchedule"
}]
|
Example request:
{
"metadata" : {
"name" : "nodepool-name-change"
},
"spec" : {
"nodeTemplate" : {
"k8sTags" : {
"cce.cloud.com/cce-nodepool": "nodepool-name-change",
"change-tag": "value2"
},
"taints" : [ {
"key" : "status",
"value" : "unavailable",
"effect" : "NoSchedule"
} ],
},
"autoscaling" : {
"enable" : true,
"minNodeCount" : 2,
"maxNodeCount" : 4,
"scaleDownCooldownTime" : 10,
"priority" : 2
},
"initialNodeCount" : 1
}
}
Response¶
Response parameters:
Table 26 describes the response parameters.
Response example:
{
"kind": "NodePool",
"apiVersion": "v3",
"metadata": {
"name": "nodepool-name-change",
"uid": "feec6013-cd7e-11ea-8c7a-0255ac100be7"
},
"spec": {
"initialNodeCount": 0,
"type": "vm",
"nodeTemplate": {
"flavor": "s6.large.2",
"az": "eu-de-01",
"os": "EulerOS 2.5",
"login": {
"sshKey": "KeyPair-nodepool",
"userPassword": {}
},
"rootVolume": {
"volumetype": "SATA",
"size": 40
},
"dataVolumes": [
{
"volumetype": "SATA",
"size": 100,
"extendParam": {
"useType": "docker"
}
}
],
"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%"
}
]
}
]
},
"runtime": {
"name":"docker"
},
"publicIP": {
"eip": {
"bandwidth": {}
}
},
"nodeNicSpec": {
"primaryNic": {
"subnetId": "31be174a-0c7f-4b71-bb0d-d325fecb90ef"
}
},
"billingMode": 0,
"taints": [
{
"key": "change-taints",
"value": "value1",
"effect": "NoExecute"
}
],
"k8sTags": {
"cce.cloud.com/cce-nodepool": "nodepool-name-change",
"change-tag": "value2"
},
"userTags": [
{
"key": "change-resource-tag",
"value": "value3"
}
],
"extendParam": {
"DockerLVMConfigOverride": "dockerThinpool=vgpaas/90%VG;kubernetesLV=vgpaas/10%VG;diskType=evs;lvType=linear",
"alpha.cce/postInstall": "bHMgLWwK",
"alpha.cce/preInstall": "bHMgLWw=",
"maxPods": 110
}
},
"autoscaling": {
"enable": true,
"minNodeCount": 2,
"maxNodeCount": 4,
"scaleDownCooldownTime": 10,
"priority": 2
},
"nodeManagement": {
"serverGroupReference": "2129f95a-f233-4cd8-a1b2-9c0acdf918d3"
}
},
"status": {
"currentNode": 0,
"phase": ""
}
}
Status Code¶
Table 8 describes the status code of this API.
Status Code | Description |
---|---|
200 | The specified node pool is updated successfully. |
For details about error status codes, see Status Code.