Updated on 2023-06-27 GMT+08:00

Updating an Add-on Instance

Function

This API is used to update an add-on instance.

URI

PUT /api/v3/addons/{id}

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

id

Yes

String

Add-on instance ID.

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

Content-Type

Yes

String

Message body type (format).

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

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

kind

Yes

String

API type. The value is fixed at Addon and cannot be changed. Any user-defined value is invalid.

apiVersion

Yes

String

API version. The value is fixed at v3 and cannot be changed. Any user-defined value is invalid.

metadata

Yes

Metadata object

Basic information about the object. Metadata is a collection of attributes.

spec

Yes

InstanceRequestSpec object

Detailed description of add-on installation or upgrade.

Table 4 Metadata

Parameter

Mandatory

Type

Description

uid

No

String

Unique ID.

name

No

String

Add-on name.

labels

No

Map<String,String>

Add-on labels in key-value pairs. This is a reserved field and does not take effect.

annotations

No

Map<String,String>

Add-on annotations in the format of key-value pairs.

  • For add-on installation, the value is fixed at {"addon.install/type":"install"}.

  • For add-on upgrade, the value is fixed at {"addon.upgrade/type":"upgrade"}.

updateTimestamp

No

String

Update time.

creationTimestamp

No

String

Creation time.

Table 5 InstanceRequestSpec

Parameter

Mandatory

Type

Description

version

No

String

Version of the add-on to be installed or upgraded, for example, 1.0.0. If not specified, the stable version supported by the cluster is used.

clusterID

Yes

String

Cluster ID.

values

Yes

Map<String,Object>

Add-on template installation parameters (varying depending on the add-on). During the add-on upgrade, you need to specify all the installation parameters. If the parameters are not specified, the default values in the add-on template are used. The current add-on installation parameters can be obtained through the API for querying add-on instances.

addonTemplateName

Yes

String

Name of the add-on template to be installed, for example, coredns.

Response Parameters

Status code: 200

Table 6 Response body parameters

Parameter

Type

Description

kind

String

API type. The value is fixed at Addon and cannot be changed.

apiVersion

String

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

metadata

Metadata object

Basic information about the object. Metadata is a collection of attributes.

spec

InstanceSpec object

Detailed description of the add-on instance.

status

AddonInstanceStatus object

Add-on instance status.

Table 7 Metadata

Parameter

Type

Description

uid

String

Unique ID.

name

String

Add-on name.

labels

Map<String,String>

Add-on labels in key-value pairs. This is a reserved field and does not take effect.

annotations

Map<String,String>

Add-on annotations in the format of key-value pairs.

  • For add-on installation, the value is fixed at {"addon.install/type":"install"}.

  • For add-on upgrade, the value is fixed at {"addon.upgrade/type":"upgrade"}.

updateTimestamp

String

Update time.

creationTimestamp

String

Creation time.

Table 8 InstanceSpec

Parameter

Type

Description

clusterID

String

Cluster ID.

version

String

Add-on template version, for example, 1.0.0.

addonTemplateName

String

Add-on template name, for example, coredns.

addonTemplateType

String

Add-on template type.

addonTemplateLogo

String

URL for obtaining the add-on template logo.

addonTemplateLabels

Array of strings

Labels of the add-on template.

description

String

Add-on template description.

values

Map<String,Object>

Add-on template installation parameters (varying depending on the add-on). Set the parameters accordingly.

Table 9 AddonInstanceStatus

Parameter

Type

Description

status

String

Add-on instance status.

Reason

String

Cause of the add-on installation failure.

message

String

Installation error details.

targetVersions

Array of strings

Versions to which the current add-on version can be upgraded.

currentVersion

Versions object

Information about the current add-on version.

Table 10 Versions

Parameter

Type

Description

version

String

Add-on version.

input

Object

Add-on installation parameters.

stable

Boolean

Whether the add-on version is a stable release.

translate

Object

Translation information used by the GUI.

supportVersions

Array of SupportVersions objects

Cluster versions that support the add-on.

creationTimestamp

String

Creation time.

updateTimestamp

String

Update time.

Table 11 SupportVersions

Parameter

Type

Description

clusterType

String

Cluster type that supports the add-on.

clusterVersion

Array of strings

Cluster versions that support the add-on. The value is a regular expression.

Example Requests

{
  "kind" : "Addon",
  "apiVersion" : "v3",
  "metadata" : {
    "annotations" : {
      "addon.upgrade/type" : "upgrade"
    }
  },
  "spec" : {
    "clusterID" : "1b2ec02d-a3b2-11ec-b0d0-0255ac100099",
    "version" : "1.2.10",
    "addonTemplateName" : "gpu-beta",
    "values" : {
      "basic" : {
        "device_version" : "1.2.10",
        "driver_version" : "1.2.10",
        "obs_url" : "******",
        "region" : "******",
        "swr_addr" : "******",
        "swr_user" : "hwofficial",
        "rbac_enabled" : true
      },
      "custom" : {
        "is_driver_from_nvidia" : true,
        "nvidia_driver_download_url" : "https://us.download.nvidia.com/tesla/396.37/NVIDIA-Linux-x86_64-396.37.run"
      }
    }
  }
}

Example Responses

Status code: 200

OK

{
  "kind" : "Addon",
  "apiVersion" : "v3",
  "metadata" : {
    "uid" : "684fa9b2-a987-11ec-ba79-0255ac100096",
    "name" : "gpu-beta",
    "creationTimestamp" : "2022-03-22T02:25:57Z",
    "updateTimestamp" : "2022-03-22T02:25:57Z"
  },
  "spec" : {
    "clusterID" : "1b2ec02d-a3b2-11ec-b0d0-0255ac100099",
    "version" : "1.2.10",
    "addonTemplateName" : "gpu-beta",
    "addonTemplateType" : "helm",
    "addonTemplateLogo" : "******",
    "addonTemplateLabels" : [ "Accelerator" ],
    "description" : "A device plugin for nvidia.com/gpu resource on nvidia driver",
    "values" : {
      "basic" : {
        "device_version" : "1.2.10",
        "driver_version" : "1.2.10",
        "obs_url" : "******",
        "rbac_enabled" : true,
        "region" : "******",
        "swr_addr" : "******",
        "swr_user" : "hwofficial"
      },
      "custom" : {
        "is_driver_from_nvidia" : true,
        "nvidia_driver_download_url" : "https://us.download.nvidia.com/tesla/396.37/NVIDIA-Linux-x86_64-396.37.run"
      }
    }
  },
  "status" : {
    "status" : "upgrading",
    "Reason" : "addon upgrading",
    "message" : "",
    "targetVersions" : null,
    "currentVersion" : {
      "version" : "1.2.10",
      "input" : {
        "basic" : {
          "device_version" : "1.2.10",
          "driver_version" : "1.2.10",
          "obs_url" : "******",
          "region" : "******",
          "swr_addr" : "******",
          "swr_user" : "hwofficial"
        },
        "parameters" : {
          "custom" : {
            "is_driver_from_nvidia" : true,
            "nvidia_driver_download_url" : ""
          }
        }
      },
      "stable" : true,
      "translate" : {
        "en_US" : {
          "addon" : {
            "changeLog" : "Supported GPU driver of a new version for CentOS.",
            "description" : "A device plugin for nvidia.com/gpu resource on nvidia driver"
          },
          "description" : {
            "Parameters.custom.drivers_info.cuda" : "CUDA Toolkit",
            "Parameters.custom.drivers_info.product" : "Product",
            "Parameters.custom.drivers_info.product_series" : "Product Series",
            "Parameters.custom.drivers_info.product_type" : "Product Type",
            "Parameters.custom.nvidia_driver_download_url" : "Download the nvidia driver accroding to the input link"
          },
          "key" : {
            "Parameters.custom.nvidia_driver_download_url" : "Nvidia Driver"
          }
        },
        "fr_FR" : {
          "addon" : {
            "changeLog" : "Pilote GPU pris en charge d'une nouvelle version pour CentOS.",
            "description" : "Un plug-in de dispositif pour les ressources GPU sur un pilote NVIDIA."
          },
          "description" : {
            "Parameters.custom.drivers_info.cuda" : "Boîte à outils CUDA",
            "Parameters.custom.drivers_info.product" : "Produit",
            "Parameters.custom.drivers_info.product_series" : "Serie de produits",
            "Parameters.custom.drivers_info.product_type" : "type de produit",
            "Parameters.custom.nvidia_driver_download_url" : "Téléchargez le pilote nvidia accroding sur le lien d'entrée"
          },
          "key" : {
            "Parameters.custom.nvidia_driver_download_url" : "Nvidia Driver"
          }
        },
        "zh_CN" : {
          "addon" : {
            "changeLog" : "",
            "description" : ""
          },
          "description" : {
            "Parameters.custom.drivers_info.cuda" : "CUDA Toolkit",
            "Parameters.custom.drivers_info.product" : "",
            "Parameters.custom.drivers_info.product_series" : "",
            "Parameters.custom.drivers_info.product_type" : "",
            "Parameters.custom.nvidia_driver_download_url" : ""
          },
          "key" : {
            "Parameters.custom.nvidia_driver_download_url" : ""
          }
        }
      },
      "supportVersions" : null,
      "creationTimestamp" : "2022-01-11T14:57:44Z",
      "updateTimestamp" : "2022-01-11T15:04:37Z"
    }
  }
}

Status Codes

Status Code

Description

200

OK

Error Codes

See Error Codes.