• Cloud Container Engine

cce
  1. Help Center
  2. Cloud Container Engine
  3. API Reference 2.0
  4. API
  5. Storage Management
  6. Deleting a Persistent Volume Claim

Deleting a Persistent Volume Claim

Function

This API is used to delete a persistent volume claim from a specified namespace. Using this API, you can determine whether to retain the cloud storage associated with the persistent volume claim.

URI

DELETE /api/v1/namespaces/{namespace}/cloudpersistentvolumeclaims/{name}

Table 1 describes the parameters of the API.

Table 1 Parameter description

Parameter

Mandatory

Description

namespace

Yes

Namespace where the persistent volume claim is located.

name

Yes

Name of the persistent volume claim to be deleted.

deleteVolume

No

Whether to retain the backend associated cloud storage after the persistent volume claim is deleted.

false: retain the cloud storage.

true: delete the cloud storage.

Default: false.

storageType

No

Cloud storage type. This parameter is used together with deleteVolume. That is, storageType is configurable only when deleteVolume has been configured.

  • bs: EVS.
  • nfs: SFS.

Request

N/A

Response

Response parameters:

Table 2 describes the response parameters.

Table 2 Parameter description

Parameter

Type

Description

apiVersion

String

API version. The value is fixed to v1.

kind

String

API type. The value is fixed to PersistentVolumeClaim.

metadata

Table 3

Standard object's metadata.

spec

Table 4

Spec defines the desired characteristics of a volume requested by a pod author.

status

Table 6

Status represents the current information/status of a persistent volume claim.

Table 3 Data structure of the metadata field

Parameter

Type

Description

name

String

Name of the persistent volume claim.

namespace

String

Namespace where the persistent volume claim is located.

selfLink

String

A URL representing this object. Populated by the system. Read-only.

NOTE:

This field is automatically generated. Do not assign any value to this field. Otherwise, API calls would fail.

uid

String

UID is the unique in time and space value for this object. It is typically generated by the server on successful creation of a resource and is not allowed to change on PUT operations. Populated by the system. Read-only.

NOTE:

This field is automatically generated. Do not assign any value to this field. Otherwise, API calls would fail.

resourceVersion

String

An opaque value that represents the internal version of this object that can be used by clients to determine when objects have changed. May be used for optimistic concurrency, change detection, and the watch operation on a resource or set of resources. Clients must treat these values as opaque and passed unmodified back to the server. They may only be valid for a particular resource or set of resources. Populated by the system. Read-only. Value must be treated as opaque by clients.

NOTE:

This field is automatically generated. Do not assign any value to this field. Otherwise, API calls would fail.

creationTimestamp

String

A timestamp representing the server time when this object was created. It is not guaranteed to be set in happens-before order across separate operations. Clients may not set this value. It is represented in RFC3339 form and is in UTC. Populated by the system. Read-only. Null for lists.

NOTE:

This field is automatically generated. Do not assign any value to this field. Otherwise, API calls would fail.

deletionTimestamp

String

RFC 3339 date and time at which this resource will be deleted. This field is set by the server when a graceful deletion is requested by the user, and is not directly settable by a client. The resource will be deleted (no longer visible from resource lists, and not reachable by name) after the time in this field. Once set, this value may not be unset or be set further into the future, although it may be shortened or the resource may be deleted prior to this time. For example, a user may request that a pod is deleted in 30 seconds. The Kubelet will react by sending a graceful termination signal to the containers in the pod. Once the resource is deleted in the API, the Kubelet will send a hard termination signal to the container. If not set, graceful deletion of the object has not been requested. Populated by the system when a graceful deletion is requested. Read-only.

deletionGracePeriodSeconds

Integer

Number of seconds allowed for this object to gracefully terminate before it will be removed from the system. Only set when deletionTimestamp is also set. May only be shortened. Read-only.

labels

String

Label of the persistent volume claim. A label is a key-value pair.

annotations

Map[string]string

An unstructured key value map stored with a resource that may be set by external tools to store and retrieve arbitrary metadata. They are not queryable and should be preserved when modifying objects.

finalizers

String array

Must be empty before the object is deleted from the registry. Each entry is an identifier for the responsible component that will remove the entry from the list. If the deletionTimestamp of the object is non-nil, entries in this list can only be removed.

enable

Boolean

Enable identify whether the resource is available.

Table 4 Data structure of the spec field

Parameter

Type

Description

accessModes

String array

Access mode of the persistent volume.

resources

Table 5

Resources represents the minimum resources the volume should have.

volumeName

String

Name of the persistent volume bound to the persistent volume claim.

Table 5 Data structure of the resources field

Parameter

Type

Description

requests

object

Requests describes the minimum amount of compute resources required.

If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, otherwise to an implementation-defined value.

Table 6 Data structure of the status field

Parameter

Type

Description

phase

String

Current status of the persistent volume claim.

accessModes

String array

Access mode of the persistent volume.

capacity

Object

Actual resources and capacity of the persistent volume.

Example response:

{
    "kind": "PersistentVolumeClaim",
    "apiVersion": "v1",
    "metadata": {
        "name": "csms-dev-boce",
        "namespace": "default",
        "selfLink": "/api/v1/namespaces/default/persistentvolumeclaims/csms-dev-boce",
        "uid": "fe4a514c-722a-11e9-bc40-fa163e8e6bf0",
        "resourceVersion": "3759",
        "creationTimestamp": "2019-05-09T07:20:59Z",
        "deletionTimestamp": "2019-05-09T07:21:09Z",
        "deletionGracePeriodSeconds": 0,
        "labels": {
            "failure-domain.beta.kubernetes.io/region": "eu-de",
            "failure-domain.beta.kubernetes.io/zone": "az1.dc1"
        },
        "annotations": {
            "pv.kubernetes.io/bind-completed": "yes",
            "volume.beta.kubernetes.io/storage-class": "sata",
            "volume.beta.kubernetes.io/storage-provisioner": "flexvolume-huawei.com/fuxivol"
        },
        "finalizers": [
            "kubernetes.io/pvc-protection"
        ],
        "enable": true
    },
    "spec": {
        "accessModes": [
            "ReadWriteOnce"
        ],
        "resources": {
            "requests": {
                "storage": "10Gi"
            }
        },
        "volumeName": "volume-dwb-test"
    },
    "status": {
        "phase": "Bound",
        "accessModes": [
            "ReadWriteOnce"
        ],
        "capacity": {
            "storage": "10Gi"
        }
    }
}

Status Code

Table 7 describes the status code of the API.

Table 7 Status code

Status Code

Description

200

The job for deleting a persistent volume claim is successfully delivered.