Create a Plug-in

Updated on 2025-05-30 GMT+08:00

Function

This API is used to create plug-in instances.

URI

POST /v2/{project_id}/pools/{pool_name}/plugins

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID. For details, see Obtaining a Project ID and Name.

pool_name

Yes

String

Resource pool name.

Request Parameters

Table 2 Request body parameters

Parameter

Mandatory

Type

Description

apiVersion

Yes

String

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

kind

Yes

String

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

spec

Yes

PluginSpec object

Detailed description of plug-in installation or upgrade.

Table 3 PluginSpec

Parameter

Mandatory

Type

Description

template

Yes

Template object

Template information of the plug-in instances.

Table 4 Template

Parameter

Mandatory

Type

Description

name

Yes

String

Name of the plug-in template to be installed, for example, log-agent.

version

No

String

Version of the plug-in to be installed or upgraded.

inputs

No

Map<String,Object>

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

Response Parameters

Status code: 200

Table 5 Response body parameters

Parameter

Type

Description

apiVersion

String

API version. Options:

  • v2

kind

String

Type of the plug-in instance.

metadata

PluginMetadata object

Metadata of the plug-in instance.

spec

PluginSpec object

Plug-in instance details.

status

PluginStatus object

Plug-in instance status.

Table 6 PluginMetadata

Parameter

Type

Description

name

String

Name of the plug-in instance.

creationTimestamp

String

Creation time.

Table 7 PluginSpec

Parameter

Type

Description

template

Template object

Template information of the plug-in instances.

Table 8 Template

Parameter

Type

Description

name

String

Name of the plug-in template to be installed, for example, log-agent.

version

String

Version of the plug-in to be installed or upgraded.

inputs

Map<String,Object>

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

Table 9 PluginStatus

Parameter

Type

Description

phase

String

Plug-in instance status. Options:

  • Pending: The plug-in is being installed.

  • Running: All of the plug-in instances are running. This specifies that the plug-in runs properly.

  • Updating: The plug-in is being updated.

  • Abnormal: The plug-in instances are abnormal and the plug-in cannot be used. You can click the status to view the failure cause.

  • Deleting: The plug-in is being deleted.

version

String

Version of the plug-in instances.

reason

String

Details about the plug-in instance installation failure.

values

String

Installation parameters of the plug-in instances. The parameters vary depending on the plug-in.

resources

Array of PluginResources objects

Resources used by the plug-in instances.

Table 10 PluginResources

Parameter

Type

Description

involvedObject

ObjectReference object

Resource objects referenced by the plug-in.

replicas

Integer

Number of replicas of the resource object.

limits

Map<String,String>

Limit on requested resources.

requests

Map<String,String>

Requested resources.

Table 11 ObjectReference

Parameter

Type

Description

kind

String

API type of the resource object, for example, DaemonSet and Deployment.

apiVersion

String

API version of the resource object.

namespace

String

Namespace of the resource object.

name

String

Name of the resource object.

uid

String

Unique ID of the resource object.

resourceVersion

String

Current version of the resource object.

Status code: 400

Table 12 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error message.

Example Requests

This API is used to create plug-in instances.

POST https://{endpoint}/v2/{project_id}/pools/{pool_name}/plugins

{
  "apiVersion" : "v2",
  "kind" : "Plugin",
  "spec" : {
    "template" : {
      "version" : "1.6.36",
      "name" : "node-local-dns"
    }
  }
}

Example Responses

Status code: 200

Request succeeded.

{
  "apiVersion" : "v2",
  "kind" : "Plugin",
  "spec" : {
    "template" : {
      "name" : "node-local-dns",
      "version" : "1.6.36",
      "inputs" : {
        "flavor" : {
          "description" : "High avaiable",
          "name" : "HA",
          "resources" : [ {
            "name" : "node-local-dns-admission-controller",
            "limitsCpu" : "250m",
            "requestsCpu" : "250m",
            "replicas" : 2,
            "limitsMem" : "512Mi",
            "requestsMem" : "512Mi"
          }, {
            "name" : "node-local-dns-cache",
            "limitsCpu" : "500m",
            "requestsCpu" : "25m",
            "limitsMem" : "512Mi",
            "requestsMem" : "5Mi"
          } ],
          "size" : "large"
        },
        "custom" : {
          "enable_dnsconfig_admission" : true,
          "nameserver" : "135.0.0.1",
          "ndots" : "8",
          "search" : "1321"
        }
      }
    }
  }
}

Status code: 400

Bad request

{
  "error_code" : "ModelArts.50004000",
  "error_msg" : "Bad request."
}

Status Codes

Status Code

Description

200

Request succeeded.

400

Bad request

Error Codes

See Error Codes.

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback