更新时间:2023-11-23 GMT+08:00

创建应用模板版本

功能介绍

该API用于创建一个应用模板版本。

URI

POST /v2/{project_id}/edgemgr/apps/{app_id}/versions

表1 Path参数

名称

是否必选

说明

project_id

项目ID,获取方法请参见获取项目ID

app_id

应用模板ID

请求消息

请求参数

表2 请求Header参数

参数

是否必选

类型

描述

Content-Type

String

消息体的类型(格式)

推荐您使用默认值application/json。

X-Auth-Token

String

用户Token。通过调用IAM服务获取用户Token接口获取(响应消息头中X-Subject-Token的值)。

表3 请求Body参数

名称

是否必选

参数类型

说明

version

表4 object

应用模板版本

表4 version

名称

是否必选

参数类型

说明

version

String

版本描述,只允许英文小写字母、数字、中划线、点,最大长度64,英文小写字母或数字开头

image_url

String

镜像存储地址,最大长度2083,不能为空字符串

envs

Array of 表10 objects

环境变量

volumes

Array of 表11 objects

卷配置

resources

表12 object

容器资源配置

configs

表14 object

高级配置参数

liveness_probe

表15 object

工作负载存活探针

readiness_probe

表15 object

工作负载业务探针

arch

String

架构,只支持x86_64、arm32、arm64

command

Array of String

启动命令

args

Array of String

参数

npu_type

String

npu类型,支持D310类型。

  • D310表示D310类型
  • 不填表示为D310类型

请求示例

{
    "version": {
        "version": "v2",
        "image_url": "edge-demo-app:latest",
        "resources": {
            "limits": {
                "cpu": 0.1,
                "memory": 1024,
                "gpu": 3.9
            },
            "requests": {
                "cpu": 0.1,
                "memory": 1024,
                "gpu": 3.9
            }
        },
        "envs": [
            {
                "name": "key",
                "value": "name"
            }
        ],
        "volumes": [
            {
                "name": "test",
                "type": "hostPath",
                "source": "/tmp",
                "destination": "/tmp0",
                "read_only": true
            }
        ],
        "configs": {
            "privileged": true,
            "host_network": true,
            "restart_policy": "Always"
        }
    }
}

响应消息

响应参数

表5 响应Body参数

名称

参数类型

说明

version

表17 object

应用版本详细信息

响应示例

{
    "version": {
        "envs": [
            {
                "name": "key",
                "value": "name"
            }
        ],
        "created_at": "2018-07-16T14:16:28",
        "updated_at": null,
        "version": "v2",
        "image_url": "edge-demo-app:latest",
        "npu_type": "",
        "volumes": [
            {
                "read_only": true,
                "source": "/tmp",
                "destination": "/tmp0",
                "type": "hostPath",
                "name": "test"
            }
        ],
        "configs": {
            "host_network": true,
            "restart_policy": "Always",
            "privileged": true
        },
        "project_id": "{project_id}",
        "id": "9537b861-f4e0-40e5-8b79-da842e0d3ea2",
        "resources": {
            "requests": {
                "gpu": 3.9,
                "cpu": 0.1,
                "memory": 1024
            },
            "limits": {
                "gpu": 3.9,
                "cpu": 0.1,
                "memory": 1024
            }
        }
    }
}

错误码

请参见错误码