Updating a Deployment

Function

This API is used to update a Deployment.

URI

PUT /v2/{project_id}/edgemgr/deployments/{deployment_id}

Table 1 URI parameters

Parameter

Mandatory

Description

project_id

Yes

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

deployment_id

Yes

Instance ID.

Request

Table 2 Parameter description

Parameter

Mandatory

Type

Description

description

No

String

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

deployment

No

Table 3 object

Deployment configuration parameters.

Table 3 appPut

Parameter

Mandatory

Type

Description

image_url

No

String

Container image URL. The value contains a maximum of 2,083 characters and cannot be an empty string.

envs

No

Array of Table 10 objects

Environment variables.

volumes

No

Array of Table 11 objects

Volume configuration.

resources

No

Table 12 object

Container resource configuration.

configs

No

Table 14 object

Advanced settings.

toleration_seconds

No

Integer

Time that a fault can be tolerated before an application instance is migrated. This parameter is valid only when the application is deployed to a node group.

migration

No

Boolean

Whether application instances in a node group can be migrated after a node is faulty. This parameter is valid only when the application is deployed to a node group.

command

No

Array of strings

Container command.

args

No

Array of strings

Arguments.

liveness_probe

No

Table 15 object

Workload liveness probe. This parameter does not need to be provided in the request body if it is not required.

readiness_probe

No

Table 15 object

Workload readiness probe. This parameter does not need to be provided in the request body if it is not required.

Example request

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

Response

Table 4 Parameter description

Parameter

Type

Description

deployment

Table 18 object

Deployment details.

upgrade_ret

String

Upgrade result.

reason

String

Upgrade result description.

Example response

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

Error Codes

For details, see Error Codes.