Updated on 2024-04-23 GMT+08:00

Upgrading a Cluster

Function

Cluster upgrade

  • Cluster upgrade involves many operations on components. You are advised to upgrade your cluster on the CCE console, a more interactive and intuitive way to reduce operational risks.

  • Currently, cluster upgrade APIs are available only upon request.

URI

POST /api/v3/projects/{project_id}/clusters/{cluster_id}/operation/upgrade

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

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

cluster_id

Yes

String

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

Request Parameters

Table 2 Request body parameters

Parameter

Mandatory

Type

Description

metadata

Yes

UpgradeClusterRequestMetadata object

Upgrade metadata.

spec

Yes

UpgradeSpec object

Upgrade settings.

Table 3 UpgradeClusterRequestMetadata

Parameter

Mandatory

Type

Description

apiVersion

Yes

String

API version. Defaults to v3.

kind

Yes

String

Resource type. Defaults to UpgradeTask.

Table 4 UpgradeSpec

Parameter

Mandatory

Type

Description

clusterUpgradeAction

No

ClusterUpgradeAction object

Cluster upgrade settings.

Table 5 ClusterUpgradeAction

Parameter

Mandatory

Type

Description

addons

No

Array of UpgradeAddonConfig objects

Add-on configuration list.

nodeOrder

No

Map<String,Array<NodePriority>>

Upgrade sequence of nodes in the node pool.

NOTE:

key indicates the node pool ID. Defaults to DefaultPool.

nodePoolOrder

No

Map<String,Integer>

Upgrade sequence of a node pool, in key-value pairs.

NOTE:

key indicates the node pool ID. Defaults to DefaultPool. value means the priority of a node pool. Defaults to 0, indicating the lowest priority. A larger value indicates a higher priority.

strategy

Yes

UpgradeStrategy object

Upgrade policy.

targetVersion

Yes

String

Target cluster version, for example, v1.23.

Table 6 UpgradeAddonConfig

Parameter

Mandatory

Type

Description

addonTemplateName

Yes

String

Add-on name.

operation

Yes

String

Execution action. For current upgrades, the value can be patch.

version

Yes

String

Target add-on version.

values

No

Object

Add-on parameter list, in key-value pairs.

Table 7 NodePriority

Parameter

Mandatory

Type

Description

nodeSelector

Yes

NodeSelector object

Node label selector, which selects a batch of nodes.

priority

Yes

Integer

Priority of this batch of nodes. Defaults to 0, indicating the lowest priority. A larger value indicates a higher priority.

Table 8 NodeSelector

Parameter

Mandatory

Type

Description

key

Yes

String

Label key.

value

No

Array of strings

Label value list.

operator

Yes

String

Logical operators of labels.

Table 9 UpgradeStrategy

Parameter

Mandatory

Type

Description

type

Yes

String

Upgrade policy type. Supports only inPlaceRollingUpdate.

inPlaceRollingUpdate

No

InPlaceRollingUpdate object

In-place upgrade settings. Mandatory when the in-place upgrade policy type is specified.

Table 10 InPlaceRollingUpdate

Parameter

Mandatory

Type

Description

userDefinedStep

No

Integer

Node upgrade step, from 1 to 40. Recommended: 20.

Response Parameters

Status code: 200

Table 11 Response body parameters

Parameter

Type

Description

metadata

UpgradeCluserResponseMetadata object

Upgrade task metadata

spec

UpgradeResponseSpec object

Upgrade settings

Table 12 UpgradeCluserResponseMetadata

Parameter

Type

Description

uid

String

Upgrade task ID. You can obtain the progress by calling the API for obtaining cluster upgrade task details.

Table 13 UpgradeResponseSpec

Parameter

Type

Description

clusterUpgradeAction

ClusterUpgradeResponseAction object

Cluster upgrade settings

Table 14 ClusterUpgradeResponseAction

Parameter

Type

Description

version

String

Current cluster version

targetVersion

String

Target cluster version, for example, v1.23.

targetPlatformVersion

String

Platform version of the target cluster, which is an internal version of the cluster version and cannot be specified.

strategy

UpgradeStrategy object

Upgrade policies

config

Object

Cluster configuration specified during an upgrade

Table 15 UpgradeStrategy

Parameter

Type

Description

type

String

Upgrade policy type. Supports only inPlaceRollingUpdate.

inPlaceRollingUpdate

InPlaceRollingUpdate object

In-place upgrade settings. Mandatory when the in-place upgrade policy type is specified.

Table 16 InPlaceRollingUpdate

Parameter

Type

Description

userDefinedStep

Integer

Node upgrade step, from 1 to 40. Recommended: 20.

Example Requests

Upgrade the cluster to v1.23 and set the node upgrade step to 20.

POST /api/v3/projects/{project_id}/clusters/{cluster_id}/operation/upgrade

{
  "metadata" : {
    "apiVersion" : "v3",
    "kind" : "UpgradeTask"
  },
  "spec" : {
    "clusterUpgradeAction" : {
      "strategy" : {
        "type" : "inPlaceRollingUpdate",
        "inPlaceRollingUpdate" : {
          "userDefinedStep" : 20
        }
      },
      "targetVersion" : "v1.23"
    }
  }
}

Example Responses

Status code: 200

Cluster upgrade requested.

{
  "metadata" : {
    "uid" : "976a33e2-f545-11ed-87af-0255ac1002c2"
  },
  "spec" : {
    "clusterUpgradeAction" : {
      "version" : "v1.19.16-r20",
      "targetVersion" : "v1.23.8-r0",
      "targetPlatformVersion" : "cce.10",
      "strategy" : {
        "type" : "inPlaceRollingUpdate",
        "inPlaceRollingUpdate" : {
          "userDefinedStep" : 20
        }
      },
      "config" : { }
    }
  }
}

Status Codes

Status Code

Description

200

Cluster upgrade requested.

Error Codes

See Error Codes.