Creating a Deployment
Function
This API is used to deploy one or more applications to a group of edge nodes.
URI
POST /v2/{project_id}/edgemgr/deployments
| Parameter | Mandatory | Description |
|---|---|---|
| project_id | Yes | Project ID. For details about how to obtain a project ID, see Obtaining a Project ID. |
Request
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| name | Yes | String | Deployment name. Enter 1 to 64 characters starting and ending with a letter or digit. Only lowercase letters, digits, and hyphens (-) are allowed. |
| description | No | String | Deployment description. The value contains a maximum of 255 characters. The following characters are not allowed: ^~#$%&*<>()[]{}'"\ |
| node_ids | Yes | Array of strings | List of edge node IDs. Currently, only one edge node is supported. |
| app | Yes | Table 3 object | Application configuration. |
| group_id | No | String | ID of an edge node group. |
| visibility | No | String | Reserved. |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| name | Yes | String | Application name (an embedded field). Enter 1 to 64 characters starting and ending with a letter or digit. Only lowercase letters, digits, and hyphens (-) are allowed. |
| version | No | String | Version description. The value contains a maximum of 64 characters starting with a letter or digit. Only lowercase letters, digits, hyphens (-), and periods (.) are allowed. |
| image_url | Yes | String | Container image URL. The value contains a maximum of 2,083 characters and cannot be an empty string. |
| envs | No | Array of Table 10 objects | Environment variables. |
| volumes | No | Array of Table 11 objects | Volume configuration. |
| resources | No | Table 12 object | Container resource configuration. |
| configs | No | Table 14 object | Advanced settings. |
| liveness_probe | No | Table 15 object | Workload liveness probe. This parameter does not need to be provided in the request body if it is not required. |
| readiness_probe | No | Table 15 object | Workload readiness probe. This parameter does not need to be provided in the request body if it is not required. |
| command | No | Array of strings | Container command. |
| 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. |
| 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. |
| args | No | Array of strings | Arguments. |
Example request
{
"deployment": {
"name": "deployment-test",
"description": "This is a test deployment",
"node_ids": [
"09dafd3e-63df-47a8-b7c6-119563fefa85"
],
"app": {
"name": "test-hw",
"version": "1.0.0",
"image_url": "100.95.181.176:5300/op_svc_ief_container1/sample:latest",
"envs": [],
"volumes": [],
"configs": {
"privileged": false,
"host_network": false,
"restart_policy": "Always",
"ports": [
{
"container_port": 8888,
"host_port": 88
}
]
},
"resources": {
"requests": {
"cpu": 0.25,
"memory": 512
},
"limits": {
"cpu": 1,
"memory": 512
}
},
"liveness_probe": {
"exec_command": "/bin/bash",
"initial_delay_seconds": 10,
"timeout_seconds": 10
}
}
}
} Response
| Parameter | Type | Description |
|---|---|---|
| deployment | Deployment details. |
Example response
{
"deployment": {
"description": "This is a test deployment",
"created_at": "2019-07-10T07:12:44.020393",
"updated_at": null,
"visibility": null,
"instances": [
{
"restarts": 0,
"name": "test-hw",
"envs": [],
"liveness_probe": {
"timeout_seconds": 10,
"exec_command": "/bin/bash",
"initial_delay_seconds": 10
},
"state": "PENDING_CREATE",
"group_name": null,
"configs": {
"host_network": false,
"restart_policy": "Always",
"privileged": false,
"ports": [
{
"host_port": 88,
"container_port": 8888
}
]
},
"reason": null,
"version": "1.0.0",
"image_url": "100.95.181.176:5300/op_svc_ief_container1/sample:latest",
"resources": {
"requests": {
"cpu": 0.25,
"memory": 512.0
},
"limits": {
"cpu": 1.0,
"memory": 512.0
}
},
"volumes": [],
"is_ready": null,
"readiness_probe": null,
"message": null,
"group_id": null,
"id": "f4f87339-fe33-483a-a838-6d5250a96fc5",
"node_id": "09dafd3e-63df-47a8-b7c6-119563fefa85"
}
],
"project_id": "9ff38382ccc546ac9635800c3315a5e2",
"id": "8170e363-0232-44eb-b89c-dab6b6e915ff",
"name": "deployment-test"
}
} Error Codes
For details, see Error Codes.
Last Article: Deployment Management v2
Next Article: Updating a Deployment
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.