Updating a Containerized Application
Function
Updates containerized application information stored in MEF Center based on the specified containerized application ID. If a containerized application has been deployed, it will be updated after this API is called. Currently, only the container image name and version can be modified.
When MEF Center successfully updates a deployed containerized application, the daemonset resource of the application in Kubernetes is successfully updated. The actual update of an MEF Edge container needs to be confirmed by querying the application instance.
Syntax
Operation type: PATCH
URL: https://{ip}:{port}/edgemanager/v1/app
Request header:
Content-Type: application/json
{
"appID": AppId,
"appName": AppName,
"containers": [
{
"name": ContainerName,
"cpuRequest": CpuRequest,
"cpuLimit": CpuLimit,
"memRequest": MemoryRequest,
"memLimit": MemoryLimit,
"image": ImageName,
"imageVersion": ImageVersion,
"env": [
{
"name": EnvVarName,
"value": EnvVarValue
}
],
"userID": UserId,
"groupID": GroupId,
"command": [
Command
],
"args" : [
Argument
],
"containerPort" : [
{
"name" : PortName,
"proto" : PortProto,
"containerPort" : ContainerPort,
"hostIP" : HostIP,
"hostPort" : HostPort
}
]
}
],
"description": Description
}
Request Parameters
For details about containerized application fields, see Request Parameters.
Parameter |
Mandatory/Optional |
Description |
Value |
|---|---|---|---|
appID |
Mandatory |
Containerized application ID |
The value is an integer ranging from 1 to 2^32-1. The application ID must exist. |
appName |
Mandatory |
Name of a containerized application |
The value is a string of 1 to 32 characters, including lowercase letters, digits, and hyphens (-). It must start and end with letters and digits. |
description |
Optional |
Description of a containerized application |
The value is a string of 0 to 512 characters. Whitespace characters except a space are not supported. |
containers |
Mandatory |
Container configuration array |
Object array. The array length ranges from 1 to 10. |
Parameter |
Mandatory/Optional |
Description |
Value |
|---|---|---|---|
name |
Mandatory |
Containerized application name |
The value is a string of 1 to 32 characters, including lowercase letters, digits, and hyphens (-). The value must start and end with a letter or digit. The container name must be unique. |
cpuRequest |
Mandatory |
Number of CPU cores requested by a containerized application |
The value is a number ranging from 0.01 to 1000 and accurate to two decimal places. |
cpuLimit |
Optional |
Maximum number of CPU cores used by a containerized application |
The value is a number ranging from 0.01 to 1000, accurate to two decimal places, and greater than or equal to cpuRequest. |
memRequest |
Mandatory |
Size of the memory allocated by a containerized application |
The value is an integer ranging from 4 to 1024000, in MiB. |
memLimit |
Optional |
Maximum memory size used by a containerized application |
The value is an integer ranging from 4 to 1024000, in MiB. The value must be greater than or equal to memRequest. |
npu |
Optional |
Number of NPU cores allocated by a containerized application |
The value is an integer ranging from 0 to 32. |
image |
Mandatory |
Name of the image to be used. If a third-party image repository is used, the full name must contain the IP address or domain name of the image repository server, port number, project, and image name, for example, fd.fusiondirector.huawei.com:443/library/ubuntu. If you do not specify the host name and port number of the image, the containerized application uses the public Docker repository. |
The value is a string of 1 to 256 characters, including lowercase letters, uppercase letters, digits, and special characters (:-._/). |
imageVersion |
Mandatory |
Image version |
The value is a string of 1 to 32 characters, including lowercase letters, uppercase letters, digits, and special characters (-._). |
env |
Optional |
Environment variables configured in a containerized application |
EnvVar object array. A maximum of 256 key-value pairs are supported. |
userID |
Optional |
User ID specified for running a containerized application If this parameter is not set, the user who creates the image runs a containerized application. If the user is not a numeric ID or the numeric ID is 0, the containerized application fails to run after being deployed. To run an inference containerized application, the driver device is required. In this case, the user ID cannot be configured. |
The value is a number ranging from 1 to 65535 and cannot be set to 0. That is, a container cannot be run by the root user. When deploying an inference containerized application, set userID to the user ID (usually 1000) of HwHiAiUser. |
groupID |
Optional |
Group ID specified for running a containerized application If this parameter is not set, the user group who creates the image runs a containerized application. If the user is not a numeric group ID or the numeric group ID is 0, the containerized application fails to run after being deployed. To run an inference containerized application, the driver device is required. In this case, the group ID cannot be configured. |
The value is a number ranging from 1 to 65535 and cannot be set to 0. That is, a containerized application cannot be run by the root group. When deploying an inference containerized application, set groupID to the group ID (usually 1000) of HwHiAiUser. |
command |
Optional |
Command executed for starting a containerized application |
Character string array. The command list supports a maximum of 16 commands. Each command contains 1 to 256 characters, including lowercase letters, uppercase letters, lowercase letters, digits, spaces, and spacial characters (-/._). The command must end with a letter or digit. |
args |
Optional |
Command parameters for starting a containerized application |
Character string array. The parameter list supports a maximum of 16 parameters. Each parameter contains 1 to 256 characters, including lowercase letters, uppercase letters, digits, spaces, and spacial characters (-/._=). The parameter must end with a letter or digit. |
containerPort |
Optional |
Host port and intra-container port mapping configured for a containerized application |
ContainerPort object array. A maximum of 16 groups of ports are supported. |
hostPathVolumes |
Optional |
Mounting path configuration of a containerized application When creating an inference containerized application, you need to configure the mounting path. Otherwise, the application may fail to run. |
HostPathVolumes object array. A maximum of 256 groups are supported. |
Parameter |
Mandatory/Optional |
Description |
Value |
|---|---|---|---|
name |
Mandatory |
Port mapping name |
The value is a string of 1 to 32 characters, including lowercase letters, digits, and hyphens (-). It must start and end with a lowercase letter or digit. |
proto |
Mandatory |
Network transport layer protocol specified by port mapping |
Character string. The value can be TCP or UDP. |
containerPort |
Mandatory |
Port in a containerized application |
The value is an integer ranging from 1 to 65535. |
hostIP |
Mandatory |
IP address of the host bound for port mapping |
The value is a character string and must be a valid host IP address. Only IPv4 addresses are supported. The value cannot be all 0s or all 255s. |
hostPort |
Mandatory |
Host port address for port mapping |
The value is an integer ranging from 1024 to 65535. |
Parameter |
Mandatory/Optional |
Description |
Value |
|---|---|---|---|
name |
Mandatory |
Name of an environment variable |
The value is a string of 2 to 32 characters, including uppercase letters, lowercase letters, digits, and spacial characters (-._). It must start with a letter and end with a letter or digit. |
value |
Mandatory |
Value of an environment variable |
The value is a string of 1 to 512 characters, including uppercase letters, lowercase letters, digits, spacial characters (-._/:), and spaces. |
Parameter |
Mandatory/Optional |
Description |
Value |
|---|---|---|---|
name |
Mandatory |
Name of the volume to be attached |
The value is a string of 1 to 32 characters, including lowercase letters, digits, and hyphens (-). It must start and end with a letter or digit. The name of the volume mounted to the same containerized application must be unique. |
hostPath |
Mandatory |
Host path used by a containerized application to mount volumes NOTE:
Only the host paths of the listed files or directories can be configured. If you create a container image by referring to Creating an Inference Image or Atlas 200I A2 Accelerator Module Ascend Software Quick Installation Guide, see "Creating a Container Image > Starting a Container". |
Only the host paths to which the following files or directories are mounted can be configured:
|
mountPath |
Mandatory |
Mounting path of a container |
The path must start with a slash (/) and then be followed by uppercase letters, lowercase letters, digits, and spacial characters (_./-). The path cannot contain two consecutive periods (..). The total length of the path is 2 to 512 characters. The mounting path names in the same container must be unique. |
Usage Example
Request:
PATCH https://10.10.10.10:30035/edgemanager/v1/app
{
"appID": 3,
"appName": "mef-apptest1",
"containers": [
{
"name": "container1",
"cpuRequest": 1,
"cpuLimit": 1,
"memRequest": 200,
"memLimit": 200,
"image": "ubuntu",
"imageVersion": "18.04",
"env": [
{
"name": "lib",
"value": "/test"
}
],
"userId": 1001,
"groupId": 1001,
"command": [
"/bin/bash","-c"
],
"args" : [
"sleep 30000"
],
"containerPort" : [
{
"name" : "test-port",
"proto" : "TCP",
"containerPort" : 1234,
"hostIP" : "xx.xx.xx.xx",
"hostPort" : 30023
}
],
"hostPathVolumes":[
]
}
],
"description": "a test case for app-manager"
}
{
"status":"00000000",
"msg":"success"
}
Response status code: 200
Output Description
Parameter |
Type |
Description |
|---|---|---|
status |
String |
Error code |
msg |
String |
Description |