Help Center/ Cloud Container Engine/ API Reference/ APIs/ Add-on Management/ Creating Add-on Check Tasks in Batches
Updated on 2025-11-05 GMT+08:00

Creating Add-on Check Tasks in Batches

Function

This API is used to create add-on check tasks in batches in a specified cluster.

Calling Method

For details, see Calling APIs.

URI

POST /api/v3/projects/{project_id}/clusters/{cluster_id}/addons/precheck

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Details:

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

Constraints:

None

Options:

Project IDs of the account

Default value:

N/A

cluster_id

Yes

String

Details:

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

Constraints:

None

Options:

Cluster IDs

Default value:

N/A

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

Content-Type

Yes

String

Details:

The request body type or format

Constraints:

The GET method is not verified.

Options:

  • application/json

  • application/json;charset=utf-8

  • application/x-pem-file

  • multipart/form-data (used when the FormData parameter is present)

Default value:

N/A

X-Auth-Token

Yes

String

Details:

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, see Obtaining a User Token.

Constraints:

None

Options:

N/A

Default value:

N/A

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

kind

Yes

String

Definition

API type.

Constraints

The value cannot be changed.

Range

The value is fixed at AddonCheck.

Default Value

AddonCheck

apiVersion

Yes

String

Definition

API version.

Constraints

The value cannot be changed.

Range

The value is fixed at v3.

Default Value

v3

spec

Yes

AddonCheckSpec object

Definition

Details of an add-on check.

Constraints

N/A

Table 4 AddonCheckSpec

Parameter

Mandatory

Type

Description

clusterID

Yes

String

Definition

Cluster ID.

Constraints

N/A

Range

N/A

Default Value

N/A

addonList

Yes

Array of AddonInfo objects

Definition

Add-on check information list, including the name of the add-on template to be checked, add-on instance ID, and add-on upgrade configuration.

Constraints

N/A

Table 5 AddonInfo

Parameter

Mandatory

Type

Description

addonTemplateName

Yes

String

Definition

Add-on template name.

Constraints

N/A

Range

Add-on template supported by CCE.

Default Value

N/A

addonInstanceID

Yes

String

Definition

Add-on instance ID, which can be obtained from the items[].metadata.uid field in Listing Add-on Instances.

Constraints

This parameter is mandatory.

Range

N/A

Default Value

N/A

targetVersion

No

String

Definition

Target version of an add-on upgrade.

Constraints

This parameter is mandatory in the add-on upgrade scenario.

Range

Add-on version provided by CCE. You can obtain the value from the items[].spec.versions.version field in Listing Add-on Templates.

Default Value

N/A

type

Yes

String

Definition

Add-on check type.

Constraints

This parameter is mandatory.

Range

  • addonStatic: add-on check when the add-on is running

  • addonUpgrade: add-on check before an upgrade

Default Value

N/A

values

No

Map<String,Object>

Definition

Add-on template edit or upgrade parameters (which vary depending on add-ons). Set the parameters accordingly.

Constraints

N/A

Response Parameters

Status code: 201

Table 6 Response body parameters

Parameter

Type

Description

kind

String

Definition

API type.

Constraints

The value cannot be changed.

Range

The value is fixed at AddonCheck.

Default Value

AddonCheck

apiVersion

String

Definition

API version.

Constraints

The value cannot be changed.

Range

The value is fixed at v3.

Default Value

v3

spec

AddonCheckSpec object

Definition

Details of an add-on check.

Constraints

N/A

status

AddonCheckStatus object

Definition

Results of creating an add-on check task, including the task ID for querying the add-on check result.

Constraints

N/A

Table 7 AddonCheckSpec

Parameter

Type

Description

clusterID

String

Definition

Cluster ID.

Constraints

N/A

Range

N/A

Default Value

N/A

addonList

Array of AddonInfo objects

Definition

Add-on check information list, including the name of the add-on template to be checked, add-on instance ID, and add-on upgrade configuration.

Constraints

N/A

Table 8 AddonInfo

Parameter

Type

Description

addonTemplateName

String

Definition

Add-on template name.

Constraints

N/A

Range

Add-on template supported by CCE.

Default Value

N/A

addonInstanceID

String

Definition

Add-on instance ID, which can be obtained from the items[].metadata.uid field in Listing Add-on Instances.

Constraints

This parameter is mandatory.

Range

N/A

Default Value

N/A

targetVersion

String

Definition

Target version of an add-on upgrade.

Constraints

This parameter is mandatory in the add-on upgrade scenario.

Range

Add-on version provided by CCE. You can obtain the value from the items[].spec.versions.version field in Listing Add-on Templates.

Default Value

N/A

type

String

Definition

Add-on check type.

Constraints

This parameter is mandatory.

Range

  • addonStatic: add-on check when the add-on is running

  • addonUpgrade: add-on check before an upgrade

Default Value

N/A

values

Map<String,Object>

Definition

Add-on template edit or upgrade parameters (which vary depending on add-ons). Set the parameters accordingly.

Constraints

N/A

Table 9 AddonCheckStatus

Parameter

Type

Description

items

Array of AddonCheckTask objects

Definition

Add-on check task list, including the add-on check task ID, add-on template name, and add-on instance ID.

Constraints

N/A

Table 10 AddonCheckTask

Parameter

Type

Description

metadata

CheckTaskMetadata object

Definition

Basic information. Metadata is a collection of attributes.

Constraints

N/A

spec

CheckTaskSpec object

Definition

Target information of an add-on check, including the target version of an add-on upgrade.

Constraints

N/A

status

CheckTaskStatus object

Definition

Add-on check task status.

Constraints

N/A

Table 11 CheckTaskMetadata

Parameter

Type

Description

type

String

Definition

Add-on check type.

Range

  • addonStatic: add-on check when the add-on is running

  • addonUpgrade: add-on check before an upgrade

taskID

String

Definition

Add-on check task ID, which is used to query the task check result.

Range

N/A

addonTemplateName

String

Definition

Add-on template name.

Range

Add-on template provided by CCE. You can obtain the value from the items[].metadata.name field in Listing Add-on Templates.

addonInstanceName

String

Definition

Add-on instance name.

Range

N/A

addonInstanceID

String

Definition

Add-on instance ID.

Range

N/A

createTimeStamp

String

Definition

Creation time of an add-on check task.

Range

N/A

expireTimeStamp

String

Definition

Timeout duration of an add-on check task. This field is available only for tasks in the Failed or Success state.

Range

N/A

Table 12 CheckTaskSpec

Parameter

Type

Description

addonTargetVersion

String

Definition

Target version of an add-on upgrade.

Range

N/A

Table 13 CheckTaskStatus

Parameter

Type

Description

status

String

Definition

Status of an add-on check.

Range

  • Init: The add-on check is initialized.

  • Running: The add-on check is in progress.

  • Failed: The add-on check is complete, and risks are found.

  • Success: The add-on check is complete, and no risks are found.

message

String

Definition

Add-on check results.

Range

N/A

riskList

Array of CheckTaskRisk objects

Definition

List of risk items during an add-on check. The risk items vary according to add-ons.

Constraints

N/A

Table 14 CheckTaskRisk

Parameter

Type

Description

riskName

String

Definition

Risk item name.

Range

N/A

level

String

Definition

Risk level.

Range

  • Warning: medium risk, which can be skipped

  • Fatal: high risk, which cannot be skipped

status

String

Definition

Risk item check status.

Range

  • Init: The risk item check is initialized.

  • Running: The risk item check is in progress.

  • Failed: The risk item check is complete, and risks are found.

  • Success: The risk item check is complete, and no risks are found.

message

String

Definition

Risk check result description.

Range

N/A

Example Requests

  • Create a CoreDNS add-on check task and set the check type to add-on upgrade.

    POST /api/v3/projects/{project_id}/clusters/{cluster_id}/addons/precheck
    
    {
      "kind" : "AddonCheck",
      "apiVersion" : "v3",
      "spec" : {
        "clusterID" : "6b400e1c-4368-11f0-ba56-0255ac100037",
        "addonList" : [ {
          "addonTemplateName" : "coredns",
          "addonInstanceID" : "8fcaa506-809d-4f33-91b3-b27efcbeb540",
          "type" : "addonUpgrade",
          "values" : {
            "basic" : {
              "cluster_ip" : "10.247.3.10",
              "image_version" : "1.17.15",
              "platform" : "linux-amd64",
              "rbac_enabled" : true,
              "swr_addr" : "",
              "swr_user" : "hwofficial"
            },
            "custom" : {
              "cluster_id" : "8fcaa506-809d-4f33-91b3-b27efcbeb540",
              "stub_domains" : { },
              "tenant_id" : "0504201b6c80256b2f08c0099f0c8fe4",
              "upstream_nameservers" : [ ]
            },
            "flavor" : {
              "name" : 2500,
              "replicas" : 2,
              "resources" : [ {
                "limitsCpu" : "500m",
                "limitsMem" : "512Mi",
                "name" : "coredns",
                "requestsCpu" : "500m",
                "requestsMem" : "512Mi"
              } ]
            }
          }
        } ]
      }
    }
  • Create a CoreDNS add-on check task and set the check type to add-on inspection.

    POST /api/v3/projects/{project_id}/clusters/{cluster_id}/addons/precheck
    
    {
      "kind" : "AddonCheck",
      "apiVersion" : "v3",
      "spec" : {
        "clusterID" : "6b400e1c-4368-11f0-ba56-0255ac100037",
        "addonList" : [ {
          "addonTemplateName" : "coredns",
          "addonInstanceID" : "8fcaa506-809d-4f33-91b3-b27efcbeb540",
          "type" : "addonStatic"
        } ]
      }
    }

Example Responses

Status code: 201

The add-on check tasks have been created in batches in the cluster.

{
  "kind" : "AddonCheck",
  "apiVersion" : "v3",
  "spec" : {
    "clusterID" : "6b400e1c-4368-11f0-ba56-0255ac100037",
    "addonList" : [ {
      "addonTemplateName" : "coredns",
      "addonInstanceID" : "8fcaa506-809d-4f33-91b3-b27efcbeb540",
      "type" : "addonUpgrade",
      "values" : {
        "basic" : {
          "cluster_ip" : "10.247.3.10",
          "image_version" : "1.17.15",
          "platform" : "linux-amd64",
          "rbac_enabled" : true,
          "swr_addr" : "",
          "swr_user" : "hwofficial"
        },
        "custom" : {
          "cluster_id" : "8fcaa506-809d-4f33-91b3-b27efcbeb540",
          "stub_domains" : { },
          "tenant_id" : "0504201b6c80256b2f08c0099f0c8fe4",
          "upstream_nameservers" : [ ]
        },
        "flavor" : {
          "name" : 2500,
          "replicas" : 2,
          "resources" : [ {
            "limitsCpu" : "500m",
            "limitsMem" : "512Mi",
            "name" : "coredns",
            "requestsCpu" : "500m",
            "requestsMem" : "512Mi"
          } ]
        }
      }
    } ]
  },
  "status" : {
    "items" : [ {
      "metadata" : {
        "type" : "addonUpgrade",
        "taskID" : "22386048-d955-4409-bc71-20cc2b774245",
        "addonTemplateName" : "coredns",
        "addonInstanceName" : "cceaddon-coredns",
        "addonInstanceID" : "8fcaa506-809d-4f33-91b3-b27efcbeb540",
        "createTimeStamp" : "2025-08-13T11:24:37.312017086+08:00"
      },
      "spec" : {
        "addonTargetVersion" : "1.27.1"
      },
      "status" : {
        "status" : "Init",
        "riskList" : [ {
          "riskName" : "K8sResourceModified",
          "status" : "Init",
          "level" : "Warning"
        }, {
          "riskName" : "AddonValidate",
          "status" : "Init",
          "level" : "Warning"
        }, {
          "riskName" : "AddonStatus",
          "status" : "Init",
          "level" : "Warning"
        } ]
      }
    } ]
  }
}

Status Codes

Status Code

Description

201

The add-on check tasks have been created in batches in the cluster.

Error Codes

See Error Codes.