Rolling Back a Deployment

Function

This API is used to roll back a specified Deployment.

URI

POST /apis/apps/v1beta1/namespaces/{namespace}/deployments/{name}/rollback

Table 1 describes the parameters of this API.

Table 1 Parameter description

Parameter

Mandatory

Description

name

Yes

Name of the Deployment Rollback.

namespace

Yes

Namespace to which the Deployment you want to roll back belongs.

pretty

No

If 'true', then the output is pretty printed.

Request

Request parameters

Table 2 Request parameters

Parameter

Mandatory

Type

Description

apiVersion

Yes

String

APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values.

kind

Yes

String

Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase.

name

Yes

String

Required. This must match the name of a Deployment.

rollbackTo

No

Table 3

The config of this Deployment rollback.

updatedAnnotations

No

Object

The annotations to be updated to a Deployment.

Table 3 Data structure of the rollbackTo field

Parameter

Mandatory

Type

Description

revision

No

Integer

The revision to rollback to. If set to 0, rollback to the last revision.

Example request

{
    "kind": "DeploymentRollback", 
    "apiVersion": "apps/v1beta1", 
    "name": "deployment-test", 
    "rollbackTo": {
        "revision": 0
    }
}

Response

Response parameters

For the description about response parameters, see Table 2.

Example response

{
    "kind": "Status", 
    "apiVersion": "v1", 
    "metadata": {}, 
    "status": "Success", 
    "message": "rollback request for deployment \"deployment-test\" succeeded", 
    "code": 201
}

Status Code

Table 4 describes the status code of this API.

Table 4 Status code

Status Code

Description

201

The request has been fulfilled, resulting in the creation of a new resource.

For more status codes, see Status Codes.