Creating a Deployment
Function
This API is used to create a Deployment.
URI
POST /v3/{project_id}/edgemgr/deployments
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
project_id |
Yes |
String |
Project ID. For details about how to obtain a project ID, see Obtaining a Project ID. |
Request
Request parameters
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
Content-Type |
Yes |
String |
Message body type (format). The default value application/json is recommended. |
X-Auth-Token |
Yes |
String |
User token. The token can be obtained by calling the IAM API used to obtain a user token. The value of X-Subject-Token in the response header is the user token. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
name |
Yes |
String |
Deployment name. The name contains a maximum of 32 characters starting and ending with a letter or digit. Only lowercase letters, digits, and hyphens (-) are allowed. |
description |
No |
String |
Deployment description. The description contains a maximum of 255 characters. The following characters are not allowed: ^~#$%&*<>()[]{}'"\ |
source |
No |
String |
Deployment source. The value can be userdefined (custom). |
group_id |
No |
String |
ID of the node group to which the Deployment is deployed. Specify either group_id or node_ids. |
node_ids |
Yes |
Array of strings |
ID of the edge node to which the Deployment is deployed. Currently, only one edge node is supported. |
tags |
No |
Array of Table 17 objects |
Deployment tag. |
deployment |
Yes |
Table 4 object |
Deployment parameters. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
replicas |
Yes |
Integer |
Number of Deployment instances. The value can only be 1 for the professional edition and less than 100 for the platinum edition. |
template |
Yes |
Table 5 object |
Deployment chart. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
configs |
Yes |
Table 16 object |
Application instance configuration. |
affinity |
No |
Table 41 object |
Affinity rules for the Deployment. This parameter is available only for platinum service instances. |
init_containers |
No |
Array of Table 6 objects |
init container configuration of the Deployment. |
containers |
Yes |
Array of Table 6 objects |
Container configuration of the Deployment. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
name |
Yes |
String |
Container name. The name contains a maximum of 32 characters starting and ending with a letter or digit. Only lowercase letters, digits, and hyphens (-) are allowed. |
image_url |
Yes |
String |
Container image URL. |
args |
No |
Array of strings |
Container startup arguments. The value contains a maximum of 65,536 characters. |
command |
No |
Array of strings |
Container startup commands. The value contains a maximum of 65,536 characters. The command field allows you to define multiple commands using an array. However, only the first command is displayed on the IEF console. |
resources |
No |
Table 14 object |
Container resource amount. |
envs |
No |
Array of Table 13 objects |
Key-value pair of the container environment variable. |
ports |
No |
Array of Table 11 objects |
Container port mapping. |
privileged |
No |
Boolean |
Whether the privileged container is enabled. The default value is false. |
readiness_probe |
No |
Table 8 object |
Workload readiness probe configuration. |
liveness_probe |
No |
Table 8 object |
Workload liveness probe configuration. |
version |
No |
String |
Container version. The value contains a maximum of 128 characters. |
volumes |
No |
Array of Table 7 objects |
Volumes attached to containers. |
npu_type |
No |
String |
NPU type. NUP type supports D310.
|
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
name |
Yes |
String |
Volume name. The name contains a maximum of 63 characters. Only lowercase letters and digits are allowed. |
type |
Yes |
String |
Volume type. The value can be configMap, secret, emptyDir, or hostPath. |
read_only |
Yes |
Boolean |
Read and write permissions. Volumes of the configMap or secret type support only the read permission. |
source |
Yes |
String |
Volume source. When type is set to hostPath, enter a path. The path must start with a slash (/) and can contain hyphens (-), slashes (/), underscores (_), periods (.), letters, and digits. When type is set to secret, enter a secret name. When type is set to configMap, enter a ConfigMap name. When type is set to emptyDir, enter a disk or memory. |
destination |
Yes |
String |
Volume mount path. It must be a valid path. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
http_get |
No |
Table 10 object |
HTTP health check. Specify either this parameter or exec. |
exec |
No |
Table 9 object |
CLI-based check. Specify either this parameter or http_get. |
initial_delay_seconds |
No |
Long |
Period between the workload start time and the probe start time. The value is an integer greater than 0 and less than or equal to 3600. The default value is 10. |
timeout_seconds |
No |
Long |
Probing timeout time. The value is an integer greater than 0 and less than or equal to 3600. The default value is 1. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
command |
Yes |
String |
Commands to be executed by the probe. The value contains a maximum of 10,240 characters. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
path |
Yes |
String |
The value must start with a slash (/). The structure is as follows: Protocol type://Host address:Port path |
port |
Yes |
Integer |
HTTP port number for detection. The value is an integer ranging from 1 to 65535. |
host |
No |
String |
Requested host address. The default value is the IP address of the container. |
scheme |
No |
String |
Protocol type. The value can be HTTP or HTTPS. The default value is HTTP. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
container_port |
Yes |
Long |
Container port number, which is an integer ranging from 1 to 65535. |
host_port |
No |
Long |
Host port, which is an integer ranging from 1 to 65535. Specify either host_port or host_port_range. |
host_ip |
No |
String |
NIC address of the host. |
host_port_range |
No |
Table 12 object |
Host port range. Host ports in the specified range are automatically allocated to application instances. Specify either host_port_range or host_port. This parameter is available only in the platinum edition. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
min_port |
Yes |
Long |
Lower limit of the host port, which is an integer ranging from 1 to 65535. |
max_port |
Yes |
Long |
Upper limit of the host port, which is an integer ranging from 1 to 65535. The value of max_port must be greater than that of min_port. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
name |
Yes |
String |
Key of an environment variable. The key must be unique and can contain a maximum of 2,048 characters starting with a letter or underscore. Only digits, letters, and underscores (_) are allowed. |
value |
No |
String |
Value of an environment variable. The value contains a maximum of 20,480 characters. Specify only one of the value, value_from, and field_path parameters. |
value_from |
No |
Table 18 object |
Environment variables can be imported from ConfigMaps or secrets. |
field_path |
No |
String |
Currently, this parameter can be set only to status.hostIP, that is, the IP address of an edge node is used as the environment variable. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
limits |
No |
Table 15 object |
Resource amount limit. |
requests |
No |
Table 15 object |
Requested resource amount, which cannot be greater than the resource limit. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
cpu |
No |
String |
Number of CPU cores. The value range is 0.01–1000. The value of this parameter does not need to contain a unit in the request. |
memory |
No |
String |
Memory size, in MBs. The value range is 0.01–1,024,000. Note: The minimum value of limits for the memory is 4. The value of this parameter does not need to contain a unit in the request. |
gpu |
No |
String |
GPU memory size, in MBs. The value range is 0.01–1,024,000. The value of this parameter does not need to contain a unit in the request. |
npu |
No |
String |
Number of NPUs. The value range is 1–1000. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
host_network |
Yes |
Boolean |
Whether the host network is enabled for an application instance. If the host network is not enabled, port mapping is used. The default value is false. |
host_pid |
No |
Boolean |
Whether an application instance shares the PID namespace with the host. The default value is false. |
migration |
No |
Boolean |
Whether an application instance is migrated when a fault occurs. This parameter is mandatory when the application is deployed to a specified node group. The default value is false. |
restart_policy |
Yes |
String |
Restart policy of an application instance. The value can be Always, OnFailure, or Never. |
toleration_seconds |
No |
Integer |
Time that a fault can be tolerated before an application instance is migrated. This parameter takes effect only when the application is deployed to a specified node group. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
key |
No |
String |
A maximum of 10 keys are allowed. These keys must be unique and cannot be empty. A key can contain a maximum of 36 characters. Only letters, digits, underscores (_), and hyphens (-) are allowed. |
value |
No |
String |
The value contains a maximum of 43 characters. Only letters, digits, underscores (_), hyphens (-), and periods (.) are allowed. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
secret |
No |
Table 19 object |
Secret to be referenced by an environment variable. If value_from is specified, either secret or configmap must be specified. |
configmap |
No |
Table 20 object |
ConfigMap to be referenced by an environment variable. |
Response
When the status code is 200, the response parameters are as follows:
Parameter |
Type |
Description |
---|---|---|
id |
String |
Deployment ID. |
name |
String |
Deployment name. The name contains a maximum of 32 characters starting and ending with a letter or digit. Only lowercase letters, digits, and hyphens (-) are allowed. |
replicas |
Integer |
Total number of Deployment instances. |
ready_replicas |
Integer |
Number of normal instances. |
description |
String |
Deployment description. The description contains a maximum of 255 characters. The following characters are not allowed: ^~#$%&*<>()[]{}'"\ |
group_id |
String |
ID of the node group to which the Deployment is deployed. Specify either group_id or node_ids. |
node_ids |
Array of strings |
ID of the edge node to which the Deployment is deployed. Currently, only one edge node is supported. |
tags |
Array of Table 36 objects |
Deployment tag. |
api_version |
String |
Deployment version. |
source |
String |
Deployment source. |
project_id |
String |
Project ID. |
created_at |
String |
Time when the Deployment was created. |
updated_at |
String |
Time when the Deployment was updated. |
template |
Table 22 object |
Application template. |
state |
String |
Application status, which can be FREEZE, PENDING_DELETE, or DELETE_FAILED. This field is reserved. |
source_id |
String |
Reserved. |
Parameter |
Type |
Description |
---|---|---|
configs |
Table 35 object |
Application instance configuration. |
affinity |
Table 41 object |
Affinity rules for the Deployment. This parameter is available only for platinum service instances. |
init_containers |
Array of Table 23 objects |
init container configuration of the Deployment. |
containers |
Array of Table 23 objects |
Container configuration of the Deployment. |
Parameter |
Type |
Description |
---|---|---|
name |
String |
Container name. The name contains a maximum of 32 characters starting and ending with a letter or digit. Only lowercase letters, digits, and hyphens (-) are allowed. |
image_url |
String |
Container image URL. |
args |
Array of strings |
Container startup arguments. |
command |
Array of strings |
Container startup commands. |
resources |
Table 31 object |
Container resource amount. |
envs |
Array of Table 30 objects |
Key-value pair of the container environment variable. |
ports |
Array of Table 28 objects |
Container port mapping. |
privileged |
Boolean |
Whether the privileged container is enabled. The default value is false. |
readiness_probe |
Table 25 object |
Workload readiness probe configuration. |
liveness_probe |
Table 25 object |
Workload liveness probe configuration. |
version |
String |
Container version. |
volumes |
Array of Table 24 objects |
Volumes attached to containers. |
npu_type |
String |
NPU type. NUP type supports D310.
|
Parameter |
Type |
Description |
---|---|---|
name |
String |
Volume name. The name contains a maximum of 63 characters. Only lowercase letters and digits are allowed. |
type |
String |
Volume type. The value can be configMap, secret, emptyDir, or hostPath. |
read_only |
Boolean |
Read/Write permission. The default value is read. |
source |
String |
Volume source. When type is set to hostPath, enter a path. The path must start with a slash (/) and can contain hyphens (-), slashes (/), underscores (_), periods (.), letters, and digits. When type is set to secret, enter a secret name. When type is set to configMap, enter a ConfigMap name. When type is set to emptyDir, enter a disk or memory. |
destination |
String |
Volume mount path. It must be a valid path. |
Parameter |
Type |
Description |
---|---|---|
http_get |
Table 26 object |
HTTP health check. |
exec |
Table 27 object |
CLI-based check. |
initial_delay_seconds |
Long |
Period between the workload start time and the probe start time. The value is an integer greater than 0 and less than or equal to 3600. The default value is 10. |
timeout_seconds |
Long |
Probing timeout time. The value is an integer greater than 0 and less than or equal to 3600. The default value is 1. |
Parameter |
Type |
Description |
---|---|---|
path |
String |
The value must start with a slash (/). The structure is as follows: Protocol type://Host address:Port path |
port |
Integer |
HTTP port number for detection. The value is an integer ranging from 1 to 65535. |
host |
String |
Host address. The default value is the container IP address. |
scheme |
String |
Protocol type. The value can be HTTP or HTTPS. The default value is HTTP. |
Parameter |
Type |
Description |
---|---|---|
command |
String |
Commands to be executed by the probe. The value contains a maximum of 10,240 characters. |
Parameter |
Type |
Description |
---|---|---|
container_port |
Long |
Container port number, which is an integer ranging from 1 to 65535. |
host_port |
Long |
Host port number, which is an integer ranging from 1 to 65535. |
host_ip |
String |
NIC address of the host. |
host_port_range |
Table 29 object |
Host port range. Host ports in the specified range are automatically allocated to application instances. Specify either host_port_range or host_port. |
Parameter |
Type |
Description |
---|---|---|
min_port |
Long |
Lower limit of the host port, which is an integer ranging from 1 to 65535. |
max_port |
Long |
Upper limit of the host port, which is an integer ranging from 1 to 65535. The value of max_port must be greater than that of min_port. |
Parameter |
Type |
Description |
---|---|---|
name |
String |
Key of an environment variable. The key must be unique and can contain a maximum of 2,048 characters starting with a letter or underscore. Only digits, letters, and underscores (_) are allowed. |
value |
String |
Value of an environment variable. The value contains a maximum of 2,048 characters. Specify only one of the value, value_from, and field_path parameters. |
value_from |
Table 37 object |
Environment variables can be imported from ConfigMaps or secrets. |
field_path |
String |
Currently, this parameter can be set only to status.hostIP, that is, the IP address of an edge node is used as the environment variable. |
Parameter |
Type |
Description |
---|---|---|
limits |
Table 32 object |
Resource amount limit. |
requests |
Table 32 object |
Requested resource amount. |
Parameter |
Type |
Description |
---|---|---|
cpu |
String |
Number of CPU cores. The value range is 0.01–1000. |
memory |
String |
Memory size, in MBs. The value range is 0.01–1,024,000. Note that the minimum value of limits for the memory is 4. |
gpu |
String |
GPU size, in MBs. The value range is 0.01–1,024,000. |
npu |
String |
Number of NPUs. The value range is 1–1000. |
Parameter |
Type |
Description |
---|---|---|
node_affinity |
Array of Table 34 objects |
Node affinity. |
pod_affinity |
Array of Table 34 objects |
Application affinity. |
Parameter |
Type |
Description |
---|---|---|
key |
String |
Key in the affinity rule for the Deployment. |
operator |
String |
Affinity rule. In and Exists indicate affinity, and NotIn and DoesNotExist indicate anti-affinity. |
values |
Array of strings |
- |
Parameter |
Type |
Description |
---|---|---|
host_network |
Boolean |
Whether the host network is enabled for an application instance. If the host network is not enabled, port mapping is used. The default value is false. |
host_pid |
Boolean |
Whether an application instance shares the PID namespace with the host. The default value is false. |
migration |
Boolean |
Whether an application instance is migrated when a fault occurs. This parameter is mandatory when the application is deployed to a specified node group. The default value is false. |
restart_policy |
String |
Restart policy of an application instance. The value can be Always, OnFailure, or Never. |
toleration_seconds |
Integer |
Time that a fault can be tolerated before an application instance is migrated. This parameter takes effect only when the application is deployed to a specified node group. |
Parameter |
Type |
Description |
---|---|---|
key |
String |
A maximum of 10 keys are allowed. These keys must be unique and cannot be empty. A key can contain a maximum of 36 characters. Only letters, digits, underscores (_), and hyphens (-) are allowed. |
value |
String |
The value contains a maximum of 43 characters. Only letters, digits, underscores (_), hyphens (-), and periods (.) are allowed. |
Parameter |
Type |
Description |
---|---|---|
secret |
Table 38 object |
Secret to be referenced by an environment variable. If value_from is specified, either secret or configmap must be specified. |
configmap |
Table 39 object |
ConfigMap to be referenced by an environment variable. |
When the status code is 400, the response parameters are as follows:
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Error code. |
error_msg |
String |
Error description. |
When the status code is 500, the response parameters are as follows:
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Error code. |
error_msg |
String |
Error description. |
Example Request
{ "name": "app", "description": "this is a test app", "node_ids": [ "9ebd8efb-9fdd-44a1-abda-9cdbc287a867" ], "tags": [ { "key": "app", "value": "test" } ], "deployment": { "replicas": 1, "template": { "configs": { "host_network": true, "host_pid": true, "restart_policy": "Always", "toleration_seconds": 300 }, "containers": [ { "name": "container-0", "image_url": "nginx:alpine", "resources": { "limits": { "cpu": "0.25", "memory": "500" }, "requests": { "cpu": "0.25", "memory": "500" } } } ] } } }
Example Response
Example response with status code 200:
{ "created_at": "2020-09-23 02:38:17.894471458 +0000 UTC", "replicas": 1, "ready_replicas": 0, "description": "this is a test app", "group_id": "", "node_ids": [ "9ebd8efb-9fdd-44a1-abda-9cdbc287a867" ], "id": "66a7fe7e-699a-41b2-9119-f9468a5ed78e", "name": "app", "source": "", "template": { "configs": { "host_network": true, "host_pid": true, "restart_policy": "Always", "migration": false, "toleration_seconds": 300 }, "init_containers": [] "containers": [ { "name": "container-0", "image_url": "nginx:alpine", "npu_type": "", "resources": { "limits": { "cpu": "0.25", "memory": "500" }, "requests": { "cpu": "0.25", "memory": "500" } }, "privileged": false, "version": "" } ] }, "state": "", "project_id": "05e1aef9040010e22fccc009adecb056", "updated_at": "2020-09-23 02:38:17.894471458 +0000 UTC", "api_version": "v3", "source_id": "" }
Example response with status code 400:
{ "error_code" : "IEF.100001", "error_msg" : "PROJECT_ID not found" }
Example response with status code 500:
{ "error_code" : "IEF.100158", "error_msg" : "Fail to extract gpu information" }
Error Codes
For details, 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