更新应用部署
功能介绍
该API用于更新一个应用部署。
URI
PUT /v2/{project_id}/edgemgr/deployments/{deployment_id}
|
名称 |
是否必选 |
说明 |
|---|---|---|
|
project_id |
是 |
项目ID,获取方法请参见获取项目ID。 |
|
deployment_id |
是 |
实例ID |
请求消息
请求参数
|
参数 |
是否必选 |
类型 |
描述 |
|---|---|---|---|
|
Content-Type |
是 |
String |
消息体的类型(格式) 推荐您使用默认值application/json。 |
|
X-Auth-Token |
是 |
String |
用户Token 调用接口的认证方式分为Token和AK/SK两种,如果您使用Token方式,此参数为必填,请填写Token的值,获取方式请参见Token认证。 |
|
名称 |
是否必选 |
参数类型 |
说明 |
|---|---|---|---|
|
description |
否 |
String |
应用部署描述,最大长度255,不允许^ ~ # $ % & * < > ( ) [ ] { } ' " \ |
|
deployment |
否 |
表4 object |
deployment配置参数 |
|
名称 |
是否必选 |
参数类型 |
说明 |
|---|---|---|---|
|
image_url |
否 |
String |
容器镜像URL,最大长度2083,不能为空字符串。 |
|
envs |
否 |
Array of 表10 objects |
环境变量 |
|
volumes |
否 |
Array of 表11 objects |
卷配置 |
|
resources |
否 |
表12 object |
容器资源配置 |
|
configs |
否 |
表14 object |
高级配置 |
|
toleration_seconds |
否 |
Integer |
应用实例在节点故障后等待的迁移时间(仅在节点组中使用该功能) |
|
migration |
否 |
Boolean |
节点组中的应用实例是否允许在节点故障后迁移(仅在节点组中使用该功能) |
|
command |
否 |
Array of String |
容器命令 |
|
args |
否 |
Array of String |
参数 |
|
liveness_probe |
否 |
表15 object |
工作负载存活探针,如果不需要,请求消息体中不需要提供该字段 |
|
readiness_probe |
否 |
表15 object |
工作负载业务探针,如果不需要,请求消息体中不需要提供该字段 |
请求示例
{
"description":"ok",
"deployment": {
"image_url": "xxx.xxx.xxx/edgecloud/version:v1",
"envs":[
],
"volumes":[
{
"name":"test",
"type":"hostPath",
"source":"/var1",
"destination":"/var1",
"read_only":true
}
],
"configs":{
"privileged":false,
"host_network":false,
"restart_policy":"Always",
"ports":[
{
"host_port":99,
"container_port":5050
}
]
},
"liveness_probe":{
"http_get":{
"path":"/",
"port":9090,
"host":"127.0.0.1",
"scheme":"HTTP"
},
"initial_delay_seconds":20,
"timeout_seconds":10
},
"readiness_probe":{
"http_get":{
"path":"/",
"port":9090,
"host":"127.0.0.1",
"scheme":"HTTP"
},
"initial_delay_seconds":2,
"timeout_seconds":2
},
"resources":{
"requests":{
"cpu":0.25,
"memory":512
},
"limits":{
"cpu":1,
"memory":512
}
}
}
}
响应消息
响应参数
|
名称 |
参数类型 |
说明 |
|---|---|---|
|
deployment |
表18 object |
部署详细信息 |
|
upgrade_ret |
String |
升级结果 |
|
reason |
String |
升级结果描述 |
响应示例
{
"reason":null,
"upgrade_ret":"success",
"deployment":{
"name":"test1203",
"envs":[
{
"name":"IP",
"value":"127.0.0.1"
},
{
"name":"PORT",
"value":"9090"
},
{
"name":"VERSION",
"value":"2.1.0"
}
],
"liveness_probe":{
"timeout_seconds":10,
"http_get":{
"path":"/",
"host":"127.0.0.1",
"scheme":"HTTP",
"port":9090
},
"initial_delay_seconds":10
},
"instances":[
{
"name":"test-app-version",
"state":"PENDING",
"restarts":0,
"reason":null,
"is_ready":null,
"message":null,
"id":"56149553-d7b4-486d-92b2-0a691123551c"
}
],
"version":"1.0",
"image_url":"xxx.xxx.xxx/edgecloud/version:v1",
"volumes":[
],
"readiness_probe":{
"timeout_seconds":10,
"http_get":{
"path":"/",
"host":"127.0.0.1",
"scheme":"HTTP",
"port":9090
},
"initial_delay_seconds":10
},
"configs":{
"host_network":true,
"restart_policy":"Always",
"privileged":false,
"ports":null
},
"id":"8f900fa3-5dd4-48e1-a0f3-7b7af8c6d54c",
"resources":{
"requests":{
"cpu":0.25,
"memory":512
},
"limits":{
"cpu":1,
"memory":512
}
}
}
}
错误码
请参见错误码。