Querying Details About a Deployment

Function

This API is used to query details about a specified Deployment.

URI

GET /v3/{project_id}/edgemgr/deployments/{deployment_id}

Table 1 URI parameter

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID. For details about how to obtain a project ID, see Obtaining a Project ID.

deployment_id

Yes

String

Deployment ID.

Request

None

Response

When the status code is 200, the response parameters are as follows.

Table 2 Parameters in the response body

Parameter

Type

Description

id

String

Deployment ID.

name

String

Deployment name. The value 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 instances.

ready_replicas

Integer

Number of normal instances.

description

String

Deployment description. The value contains a maximum of 255 characters. The following characters are not allowed: ^~#$%&*<>()[]{}'"\

group_id

String

ID of the node group to which the application is deployed. Specify either group_id or node_ids.

node_ids

Array of strings

ID of the edge node to which the application is deployed. Currently, only one edge node is supported.

tags

Array of Attribute objects

-

api_version

String

Deployment version.

source

String

Deployment source. The value can be iem (edge marketplace) or userdefined (custom).

project_id

String

Project ID.

created_at

String

Time when the Deployment is created.

updated_at

String

Time when the Deployment is updated.

template

PodRequest object

Application template.

state

String

Application status, which can be Frozen, Deleting, or Deletion failed. This field is reserved.

source_id

String

Reserved.

Table 3 PodRequest

Parameter

Type

Description

configs

PodConfigs object

Application instance configuration.

init_containers

Array of ContainerDef objects

init container configuration of the Deployment.

containers

Array of ContainerDef objects

Container configuration of the Deployment.

Table 4 ContainerDef

Parameter

Type

Description

name

String

Container name. The value 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

ResQuest object

Container resource amount.

envs

Array of Env objects

Key-value pair of the container environment variable.

ports

Array of HostContainerPortMapping objects

Container port mapping.

privileged

Boolean

Whether the privileged container is enabled. The default value is false.

readiness_probe

Probe object

Workload readiness probe configuration.

liveness_probe

Probe object

Workload liveness probe configuration.

version

String

Container version.

volumes

Array of Volume objects

Volume onto which the container is mounted.

Table 5 Volume

Parameter

Type

Description

name

String

Volume name. The value 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 the type is set to hostPath, enter a path beginning with a slash (/). Only hyphens (-), backslashes (/), underscores (_), periods (.), letters, and digits are allowed in the path. Enter a secret name when the type is set to secret. Enter a ConfigMap name when the type is set to configMap. Enter a disk or memory when the type is set to emptyDir.

destination

String

Volume mount path. It must be a valid path.

Table 6 Probe

Parameter

Type

Description

http_get

HttpGet object

HTTP health check.

exec

Table 8 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.

Table 7 HttpGet

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.

Table 8 Exec

Parameter

Type

Description

command

String

Commands to be executed by the probe. The value contains a maximum of 10,240 characters.

Table 9 HostContainerPortMapping

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

HostPortRange object

Host port range. Host ports in the specified range are automatically allocated to application instances. Either host_port_range or host_port must be specified.

Table 10 HostPortRange

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.

Table 11 Env

Parameter

Mandatory

Type

Description

name

Yes

String

Key of an environment variable. The key must be unique and can contain a maximum of 20,480 characters starting with a letter or underscore. Only digits, uppercase letters, lowercase letters, and underscores (_) are allowed.

value

No

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

No

Table 16 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.

Table 12 ResQuest

Parameter

Type

Description

limits

Res object

Resource amount limit.

requests

Res object

Requested resource amount.

Table 13 Res

Parameter

Type

Description

cpu

String

Number of CPU cores. The value range is 0.01–1000.

memory

String

Memory size, in unit of MB. 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 unit of MB. The value range is 0.01–1,024,000.

npu

String

Number of NPUs. The value range is 1–1000.

Table 14 PodConfigs

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

int

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.

Table 15 Attribute

Parameter

Type

Description

key

String

-

value

String

-

Table 16 value_from

Parameter

Mandatory

Type

Description

secret

No

Table 17 object

This parameter specifies the secret to be referenced by an environment variable. If value_from is specified, either secret or configmap must be specified.

configmap

No

Table 18 object

This parameter specifies the ConfigMap to be referenced by an environment variable.

Table 17 secret

Parameter

Mandatory

Type

Description

name

Yes

String

Secret name.

key

Yes

String

Secret key.

Table 18 configmap

Parameter

Mandatory

Type

Description

name

Yes

String

ConfigMap name.

key

Yes

String

ConfigMap key.

When the status code is 400, the response parameters are as follows.

Table 19 Parameters in the response body

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.

Table 20 Parameters in the response body

Parameter

Type

Description

error_code

String

Error Code

error_msg

String

Error description.

Example Request

None

Example Response

Example response with status code 200:

{
    "id": "3e64d98a-37c5-43a6-9bfe-052b9083e362",
    "name": "app-test",
    "replicas": 1,
    "ready_replicas": 1,
    "description": "this is a test app",
    "group_id": "",
    "node_ids": [
        "29d20c18-c20c-4a45-a087-42c766fc5d97"
    ],
    "tags": [
        {
            "key": "app",
            "value": "test"
        }
    ],
    "api_version": "v3",
    "source": "userdefine",
    "project_id": "bcd83056c918480f8f190844bd425b23",
    "created_at": "2019-10-10T02:23:12.272Z",
    "updated_at": "2019-10-10T02:23:12.272Z",
    "template": {
        "configs": {
            "host_network": true,
            "host_pid": true,
            "migration": true,
            "restart_policy": "Always",
            "toleration_seconds": 300
        },
        "init_containers": []
        "containers": [
            {
                "name": "container-0",
                "image_url": "swr.cn-north-1.myhuaweicloud.com/ief-test/nginx:0705",
 
                "args": [
                    "-c",
                    "sleep 1000"
                ],
                "command": [
                    "/bin/bash"
                ],
                "resources": {
                    "limits": {
                        "cpu": "0.25",
                        "memory": "500",
                        "gpu": "500"
                    },
                    "requests": {
                        "cpu": "0.25",
                        "memory": "500",
                        "gpu": "500"
                    }
                },
                "envs": [
                    {
                        "name": "CERT_PATH",
                        "value": "/opt/cert"
                    }
                ],
                "ports": [
                    {
                        "container_port": 80,
                        "host_port": 80
                    }
                ],
                "privileged": true,
                "readiness_probe": {
                    "http_get": {
                        "path": "/",
                        "port": 80,
                        "scheme": "http"
                    },
                    "initial_delay_seconds": 10,
                    "timeout_seconds": 10
                },
                "liveness_probe": {
                    "http_get": {
                        "path": "/",
                        "port": 80,
                        "scheme": "http"
                    },
                    "initial_delay_seconds": 10,
                    "timeout_seconds": 10
                },
                "version": "1.0",
                "volumes": [
                    {
                        "name": "log-volume",
                        "type": "hostPath",
                        "read_only": false,
                        "source": "/var/IEF",
                        "destination": "/var/IEF"
                    }
                ]
            }
        ]
    }
}

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 infomation"
}

Error Codes

For details, see Error Codes.