Creating a Plugin
Function
This API is used to create plugin instances.
Debugging
You can debug this API through automatic authentication in API Explorer or use the SDK sample code generated by API Explorer.
URI
POST /v2/{project_id}/pools/{pool_name}/plugins
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
project_id |
Yes |
String |
Definition: User project ID. For details, see Obtaining a Project ID and Name. Constraints: N/A Range: N/A Default Value: N/A |
|
pool_name |
Yes |
String |
Resource pool name. |
Request Parameters
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
apiVersion |
Yes |
String |
Definition: API resource type. The value is fixed at Plugin and cannot be changed. Constraints: N/A Range: N/A Default Value: N/A |
|
kind |
Yes |
String |
API version. The value is fixed at v2 and cannot be changed. |
|
spec |
Yes |
PluginSpec object |
Detailed description of plugin installation or upgrade. |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
template |
Yes |
Template object |
Definition: Template information. Constraints: N/A |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
name |
Yes |
String |
Name of the plugin template to be installed, for example, log-agent. |
|
version |
No |
String |
Version of the plugin to be installed or upgraded. |
|
inputs |
No |
Map<String,Object> |
Plugin template installation parameters (varying depending on the plugin). During the plugin upgrade, you need to specify all the installation parameters. If the parameters are not specified, the default values in the plugin template are used. The current plugin installation parameters can be obtained through the API for querying plugin instances. |
Response Parameters
Status code: 200
|
Parameter |
Type |
Description |
|---|---|---|
|
apiVersion |
String |
Definition: API version. Range:
|
|
kind |
String |
Type of the plugin instance. Options:
|
|
metadata |
PluginMetadata object |
Metadata of the plugin instance. |
|
spec |
PluginSpec object |
Plugin instance details. |
|
status |
PluginStatus object |
Plugin instance status. |
|
Parameter |
Type |
Description |
|---|---|---|
|
name |
String |
Name of the plugin instance. |
|
creationtimestamp |
String |
Creation time. |
|
Parameter |
Type |
Description |
|---|---|---|
|
template |
Template object |
Definition: Template information. Constraints: N/A |
|
Parameter |
Type |
Description |
|---|---|---|
|
name |
String |
Name of the plugin template to be installed, for example, log-agent. |
|
version |
String |
Version of the plugin to be installed or upgraded. |
|
inputs |
Map<String,Object> |
Plugin template installation parameters (varying depending on the plugin). During the plugin upgrade, you need to specify all the installation parameters. If the parameters are not specified, the default values in the plugin template are used. The current plugin installation parameters can be obtained through the API for querying plugin instances. |
|
Parameter |
Type |
Description |
|---|---|---|
|
phase |
String |
Plugin instance status. Options:
|
|
version |
String |
Version of the plugin instances. |
|
reason |
String |
Details about the plugin instance installation failure. |
|
values |
String |
Installation parameters of the plugin instances. The parameters vary depending on the plugin. |
|
resources |
Array of PluginResources objects |
Resources used by the plugin instances. |
|
Parameter |
Type |
Description |
|---|---|---|
|
involvedobject |
ObjectReference object |
Resource objects referenced by the plugin. |
|
replicas |
Integer |
Number of replicas of the resource object. |
|
limits |
Map<String,String> |
Limit on requested resources. |
|
requests |
Map<String,String> |
Requested resources. |
|
Parameter |
Type |
Description |
|---|---|---|
|
kind |
String |
API type of the resource object, for example, DaemonSet and Deployment. |
|
apiVersion |
String |
Definition: API version of the resource object. Range: N/A |
|
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
|
Parameter |
Type |
Description |
|---|---|---|
|
error_code |
String |
Range: N/A |
|
error_msg |
String |
Definition: Error message. Range: N/A |
Example Requests
Create plugin 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 available",
"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
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot