• Cloud Container Engine

cce
  1. Help Center
  2. Cloud Container Engine
  3. API Reference 2.0
  4. Kubernetes API
  5. PersistentVolume
  6. Updating a Specified PersistentVolume

Updating a Specified PersistentVolume

Function

This API is used to update a PersistentVolume object.

The following fields can be updated:

  • metadata.labels
  • metadata.generateName
  • spec.accessModes
  • spec.capacity
  • spec.hostPath.path
  • spec.persistentVolumeReclaimPolicy

URI

PATCH /api/v1/persistentvolumes/{name}

Table 1 describes the parameters of this API.

Table 1 Parameter description

Parameter

Mandatory

Description

name

Yes

Name of the PersistentVolume.

pretty

No

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

Request

Request parameters:

For the description about the Content-Type message header, see section Patch Request Method Operation Description.

Example request:

Content-Type: application/json-patch+json
[
    {
        "op": "add",
        "path": "/spec/persistentVolumeReclaimPolicy",
        "value": "Retain"
    }
]

Response

Response parameters:

For the description about response parameters, see the parameter description in Table 2.

Example response:

{
    "kind": "PersistentVolume",
    "apiVersion": "v1",
    "metadata": {
        "name": "pv-test11",
        "selfLink": "/api/v1/persistentvolumes/pv-test11",
        "uid": "e99dacfe-23de-11e7-9c83-fa163ec08232",
        "resourceVersion": "1814092",
        "creationTimestamp": "2017-04-18T02:29:56Z",
        "labels": {
            "app": "test"
        },
        "annotations": {
            "pv.kubernetes.io/bound-by-controller": "yes"
        }
    },
    "spec": { 
        "capacity": {
            "storage": "1Gi"
        },
        "hostPath": {
            "path": "/home"
        },
        "accessModes": [
            "ReadWriteMany"
        ],
        "persistentVolumeReclaimPolicy": "Retain"
    },
    "status": {
        "phase": "Bound"
    }
}

Status Code

Table 2 describes the status code of this API.

Table 2 Status code

Status Code

Description

200

This operation succeeds, and a PersistentVolume resource object is returned.

For the description about status codes, see Status Codes.