升级服务
更新时间:2025-05-26
接口描述
更新服务
请求结构
Bash
1POST ?action=ModifyService&serviceId=serviceId&description=description
2HTTP/1.1
3Host:aihc.bj.baidubce.com
4version: v2
5Authorization:authorization string
6{
7 "log": {
8 "persistent": persistent
9 },
10 "instanceCount": instanceCount,
11 "misc": {
12 "podAnnotations": podAnnotations,
13 "podLabels": podLabels,
14 "gracePeriodSec": gracePeriodSec,
15 "fedPodsPerIns": fedPodsPerIns
16 },
17 "resourcePool": {
18 "resourcePoolId": resourcePoolId,
19 "resourcePoolName": resourcePoolName,
20 "queueName": queueName,
21 "resourcePoolType": resourcePoolType
22 },
23 "deploy": {
24 "schedule": {
25 "priority": priority
26 },
27 "canaryStrategy": {
28 "maxSurge": maxSurge,
29 "maxUnavailable": maxUnavailable
30 }
31 },
32 "name": name,
33 "acceleratorType": acceleratorType,
34 "workloadType": workloadType,
35 "containers": [
36 {
37 "name": name,
38 "cpus": cpus,
39 "memory": memory,
40 "acceleratorCount": acceleratorCount,
41 "command": command,
42 "ports": [
43 {
44 "name": name,
45 "port": port
46 }
47 ],
48 "envs": envs,
49 "image": {
50 "imageType": imageType,
51 "imageUrl": imageUrl
52 },
53 "volumeMounts": volumeMounts,
54 "startupsProbe": startupsProbe,
55 "readinessProbe": readinessProbe,
56 "livenessProbe": livenessProbe
57 }
58 ],
59 "access": {
60 "publicAccess": publicAccess,
61 "networkType": networkType,
62 "aiGateway": {
63 "enableAuth": enableAuth
64 }
65 }
66}
请求头域
除公共头域外,无其它特殊头域。
请求参数
参数名 | 参数类型 | 是否必须 | 参数位置 | 参数说明 |
---|---|---|---|---|
serviceId | String | 是 | Query参数 | query 参数 |
description | String | 否 | Query参数 | 更新描述 |
serviceConf | ServiceConf | 是 | body参数 | 与创建参数一致,但不允许修改网络配置 |
其中ServceConf中支持修改的参数如下:
参数名称 | 参数类型 | 是否必须 | 参数位置 | 参数说明 |
---|---|---|---|---|
acceleratorType | String | 是 | Body参数 | 加速芯片类型 |
instanceCount | Integer | 是 | Body参数 | 部署实例数,取值>=0 |
storage | StorageConf | 否 | Body参数 | 存储卷、共享内存配置 |
containers | List<ContainerConf> | 是 | Body参数 | 服务容器信息,最少需要1个,最多10个,见containers结构 |
log | LogConf | 否 | Body参数 | 日志配置 |
deploy | DeployConf | 否 | Body参数 | 部署配置,默认为最大超量和最大不可用均为25% |
misc | Misc | 否 | Body参数 | 实例label、annotations配置 |
返回头域
除公共头域,无其它特殊头域。
返回参数
参数名称 | 类型 | 说明 |
---|---|---|
serviceId | String | 服务ID |
requestId | String | 请求唯一标识 |
请求示例
Bash
1POST ?action=ModifyService&serviceId=s-r7d45dcffa0a&description=two instance
2HTTP/1.1
3Host:aihc.bj.baidubce.com
4version: v2
5Authorization: bce-auth-v1/f81d3b34e48048fbb2634dc7882d7e21/2024-08-11T04:17:29Z/3600/host/74c506f68c65e26c633bfa104c863fffac5190fdec1ec24b7c03eb5d67d2e1de
6{
7 "access": {
8 "aiGateway": {
9 "enableAuth": true
10 },
11 "networkType": "aiGateway",
12 "publicAccess": false
13 },
14 "name": "openapi-test-4",
15 "acceleratorType": "",
16 "containers": [
17 {
18 "name": "custom-container",
19 "cpus": 1,
20 "memory": 2,
21 "acceleratorCount": 0,
22 "command": ["/bin/sh", "-c", "sleep inf"],
23 "ports": [
24 {
25 "name": "HTTP",
26 "port": 10088
27 }
28 ],
29 "envs": {},
30 "image": {
31 "imageType": 0,
32 "imageUrl": "registry.baidubce.com/inference/vllm-openai:v0.8.3"
33 },
34 "volumeMounts": [],
35 "startupsProbe": null,
36 "readinessProbe": null,
37 "livenessProbe": null
38 }
39 ],
40 "deploy": {
41 "canaryStrategy": {
42 "maxSurge": 25,
43 "maxUnavailable": 25
44 },
45 "schedule": {
46 "priority": "high"
47 }
48 },
49 "instanceCount": 2,
50 "log": {
51 "persistent": false
52 },
53 "misc": {
54 "fedPodsPerIns": 0,
55 "gracePeriodSec": 30,
56 "pdMode": null,
57 "podAnnotations": {
58 "prometheus.io/scrape": "false"
59 },
60 "podLabels": {
61 "scheduling.volcano.sh/group-min-member": "1"
62 }
63 },
64 "resourcePool": {
65 "queueName": "default",
66 "resourcePoolId": "cce-7t7mqjci",
67 "resourcePoolName": "aihc-pom",
68 "resourcePoolType": ""
69 },
70 "workloadType": ""
71}
72
返回示例
Bash
1HTTP/1.1 200 OK
2x-bce-request-id: 7020b540-5710-454a-bc52-0222831c0a6
3Date:Wed, 23 Apr 2025 13:41:53 GMT
4Content-Type: application/json;charset=UTF-8
5Server:Service
6{
7 "requestId": "7020b540-5710-454a-bc52-0222831c0a6f",
8 "serviceId": "s-r7d45dcffa0a"
9
10}