:original_name: cce_02_0323.html .. _cce_02_0323: Updating an Add-on Instance =========================== Function -------- This API is used to update an add-on instance. .. note:: The URL for add-on management is in the format of **https://{clusterid}.Endpoint/uri.** In the URL, *{clusterid}* indicates the cluster ID, and *uri* indicates the resource path, that is, the path for API access. URI --- PUT /api/v3/addons/{id} :ref:`Table 1 ` describes the parameters of this API. .. _cce_02_0323__table422018491378: .. table:: **Table 1** Parameter description +-----------+-----------+--------+------------------------------------------------------------------------------------------------------------------+ | Parameter | Mandatory | Type | Description | +===========+===========+========+==================================================================================================================+ | id | Yes | String | Add-on instance ID. For details about how to obtain the ID, see :ref:`Table 7 `. | +-----------+-----------+--------+------------------------------------------------------------------------------------------------------------------+ Request ------- **Request parameters:** :ref:`Table 2 ` and :ref:`Table 3 ` list the request parameters. .. _cce_02_0323__table1999124252111: .. table:: **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 :ref:`API Usage Guidelines `. | +-----------------------+-----------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ .. _cce_02_0323__requestparameter: .. table:: **Table 3** Parameters in the request body +-----------+-----------+-----------------------------------------------------------+-----------------------------------------------------------------------------+ | Parameter | Mandatory | Type | Description | +===========+===========+===========================================================+=============================================================================+ | kind | Yes | String | API type. The value is fixed at **Addon** and cannot be changed. | +-----------+-----------+-----------------------------------------------------------+-----------------------------------------------------------------------------+ | apVersion | Yes | String | API version. The value is fixed at **v3** and cannot be changed. | +-----------+-----------+-----------------------------------------------------------+-----------------------------------------------------------------------------+ | metadata | Yes | :ref:`metadata ` object | Basic information about the add-on. Metadata is a collection of attributes. | +-----------+-----------+-----------------------------------------------------------+-----------------------------------------------------------------------------+ | spec | Yes | :ref:`spec ` object | Detailed description of add-on installation or upgrade. | +-----------+-----------+-----------------------------------------------------------+-----------------------------------------------------------------------------+ .. _cce_02_0323__table12181142512286: .. table:: **Table 4** Data structure of the metadata field +-----------------+-----------------+-----------------+---------------------------------------------------------------------------------+ | Parameter | Mandatory | Type | Description | +=================+=================+=================+=================================================================================+ | labels | No | Object | Add-on labels in the format of key-value pairs. | +-----------------+-----------------+-----------------+---------------------------------------------------------------------------------+ | annotations | Yes | Object | Add-on annotations in the format of key-value pairs. | | | | | | | | | | For add-on upgrade, the value is fixed at **{"addon.upgrade/type":"upgrade"}**. | +-----------------+-----------------+-----------------+---------------------------------------------------------------------------------+ .. _cce_02_0323__instancerequestspec: .. table:: **Table 5** Data structure of the spec field +-------------------+-----------+--------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Parameter | Mandatory | Type | Description | +===================+===========+========+===============================================================================================================================================================================================================================================================================================================================================================+ | clusterID | Yes | String | Cluster ID. | +-------------------+-----------+--------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | version | Yes | String | Version number of the add-on to be installed or upgraded, for example, v1.0.0. | +-------------------+-----------+--------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | addonTemplateName | Yes | String | Name of the add-on template to be installed, for example, storage-driver. | +-------------------+-----------+--------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | values | Yes | 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. | +-------------------+-----------+--------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ **Example request:** .. code-block:: { "kind": "Addon", "apiVersion": "v3", "metadata": { "annotations": { "addon.upgrade/type": "upgrade" } }, "spec": { "clusterID": "0ffc68e4-5538-11ea-9b4d-0255ac10167e", "version": "1.0.19", "addonTemplateName": "storage-driver", "values": { "flavor": { "description": "Has only one instance", "name": "Single", "replicas": 1, "resources": [ { "limitsCpu": "100m", "limitsMem": "300Mi", "name": "metrics-server", "requestsCpu": "100m", "requestsMem": "300Mi" } ] } } } } Response -------- **Response parameters:** For details about the response parameters, see :ref:`Table 6 `. .. _cce_02_0323__responseparameter: .. table:: **Table 6** Parameters in the response body +------------+---------------------------------------------------------+-----------------------------------------------------------------------------+ | 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 | :ref:`metadata ` object | Basic information about the add-on. Metadata is a collection of attributes. | +------------+---------------------------------------------------------+-----------------------------------------------------------------------------+ | spec | :ref:`spec ` object | Detailed description of the add-on instance. | +------------+---------------------------------------------------------+-----------------------------------------------------------------------------+ | status | :ref:`status ` object | Add-on instance status. | +------------+---------------------------------------------------------+-----------------------------------------------------------------------------+ .. _cce_02_0323__response_metadata: .. table:: **Table 7** Data structure of the metadata field +-------------------+--------+------------------------------------------------------+ | Parameter | Type | Description | +===================+========+======================================================+ | uid | String | Unique ID of the add-on instance. | +-------------------+--------+------------------------------------------------------+ | name | String | Add-on name. | +-------------------+--------+------------------------------------------------------+ | labels | Object | Add-on labels in the format of key-value pairs. | +-------------------+--------+------------------------------------------------------+ | annotations | Object | Add-on annotations in the format of key-value pairs. | +-------------------+--------+------------------------------------------------------+ | updateTimestamp | String | Time when the add-on instance was updated. | +-------------------+--------+------------------------------------------------------+ | creationTimestamp | String | Time when the add-on instance was created. | +-------------------+--------+------------------------------------------------------+ .. _cce_02_0323__response_instancespec: .. table:: **Table 8** Data structure of the spce field +---------------------+------------------+-----------------------------------------------------------------------------+ | Parameter | Type | Description | +=====================+==================+=============================================================================+ | clusterID | String | Cluster ID. | +---------------------+------------------+-----------------------------------------------------------------------------+ | version | String | Add-on template version, for example, v1.0.0. | +---------------------+------------------+-----------------------------------------------------------------------------+ | addonTemplateName | String | Add-on template name, for example, coredns. | +---------------------+------------------+-----------------------------------------------------------------------------+ | addonTemplateType | String | Add-on template type. | +---------------------+------------------+-----------------------------------------------------------------------------+ | addonTemplateLabels | Array of strings | Group to which the add-on template belongs. | +---------------------+------------------+-----------------------------------------------------------------------------+ | description | String | Add-on template description. | +---------------------+------------------+-----------------------------------------------------------------------------+ | values | Object | Add-on template installation parameters. These parameters vary with add-on. | +---------------------+------------------+-----------------------------------------------------------------------------+ .. _cce_02_0323__response_status: .. table:: **Table 9** Data structure of the status field +----------------+---------------------------------------------------------+--------------------------------------------------------------------------+ | Parameter | Type | Description | +================+=========================================================+==========================================================================+ | status | String | Add-on instance status. | +----------------+---------------------------------------------------------+--------------------------------------------------------------------------+ | Reason | String | Cause of unsuccessful add-on updating. | +----------------+---------------------------------------------------------+--------------------------------------------------------------------------+ | message | String | Details about the error that occurred when updating the add-on instance. | +----------------+---------------------------------------------------------+--------------------------------------------------------------------------+ | targetVersions | Array of strings | Versions to which the current add-on version can be upgraded. | +----------------+---------------------------------------------------------+--------------------------------------------------------------------------+ | currentVersion | :ref:`versions ` object | Current add-on version. | +----------------+---------------------------------------------------------+--------------------------------------------------------------------------+ .. _cce_02_0323__response_versions: .. table:: **Table 10** Data structure of the versions field +-------------------+---------------------------------------------------------------------------------+-----------------------------------------------------------+ | Parameter | Type | Description | +===================+=================================================================================+===========================================================+ | version | String | Add-on version. | +-------------------+---------------------------------------------------------------------------------+-----------------------------------------------------------+ | input | Object | Add-on installation parameters. | +-------------------+---------------------------------------------------------------------------------+-----------------------------------------------------------+ | stable | Boolean | Indicates whether the add-on version is a stable release. | +-------------------+---------------------------------------------------------------------------------+-----------------------------------------------------------+ | translate | Object | Translation information used by the GUI. | +-------------------+---------------------------------------------------------------------------------+-----------------------------------------------------------+ | supportVersions | Array of :ref:`supportVersions ` objects | Cluster versions that support the add-on. | +-------------------+---------------------------------------------------------------------------------+-----------------------------------------------------------+ | creationTimestamp | String | Time when the add-on instance was created. | +-------------------+---------------------------------------------------------------------------------+-----------------------------------------------------------+ | updateTimestamp | String | Time when the add-on instance was updated. | +-------------------+---------------------------------------------------------------------------------+-----------------------------------------------------------+ .. _cce_02_0323__response_supportversions: .. table:: **Table 11** Data structure of the supportVersions field +----------------+------------------+----------------------------------------------------------------------------------------+ | Parameter | Type | Description | +================+==================+========================================================================================+ | clusterType | String | Cluster type that supports the add-on. | +----------------+------------------+----------------------------------------------------------------------------------------+ | clusterVersion | Array of strings | Cluster versions that support the add-on. The parameter value is a regular expression. | +----------------+------------------+----------------------------------------------------------------------------------------+ **Example response:** .. code-block:: { "kind": "Addon", "apiVersion": "v3", "metadata": { "uid": "24b23108-55c0-11e9-926f-0255ac101a31", "name": "gpu-beta", "creationTimestamp": "2019-04-03T03:25:34Z", "updateTimestamp": "2019-04-03T03:25:34Z" }, "apiVersion": "v3", "kind": "Addon", "spec": { "addonTemplateName": "gpu-beta", "addonTemplateLogo": "", "addonTemplateType": "helm", "values": { "basic": { "rbac_enabled": true, "swr_user": "swr_test", "swr_addr": "10.125.6.246:20202" } }, "description": "A device plugin for nvidia.com/gpu resource on nvidia driver", "addonTemplateLabels": [ "Accelerator" ], "clusterID": "0c0e4a63-5539-11e9-95f7-0255ac10177e", "version": "1.0.0" }, "status": { "message": "", "Reason": "", "currentVersion": { "input": { "basic": { "swr_user": "swr_test", "swr_addr": "10.125.6.246:20202" }, "parameters": {} }, "stable": true, "creationTimestamp": "2018-10-23T13:14:55Z", "version": "1.0.0", "translate": { "en_US": { "addon": { "changeLog": "A device plugin for nvidia.com/gpu resource on nvidia driver", "description": "A device plugin for nvidia.com/gpu resource on nvidia driver" } }, "zh_CN": { "addon": { "changeLog": "", "description": "" } } }, "updateTimestamp": "2018-12-07T09:40:24Z" }, "status": "installing" } } Status Codes ------------ .. table:: **Table 12** Status codes =========== =========== Status Code Description =========== =========== 200 OK =========== =========== For the description about error status codes, see :ref:`Status Code `.