• 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

Deleting a Persistent Volume

Function

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

URI

DELETE /api/v1/cloudpersistentvolumes/{name}

Table 1 describes the parameters of the API.

Table 1 Parameter description

Parameter

Mandatory

Description

name

Yes

Name of the persistent volume to be deleted.

deleteVolume

No

Whether to retain the backend associated cloud storage after the persistent volume 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 PersistentVolume.

metadata

Table 3

Standard object's metadata.

spec

Table 4

Spec defines a specification of a persistent volume owned by the cluster. Provisioned by an administrator.

status

Table 7

Status represents the current information/status for the persistent volume. Populated by the system. Read-only.

Table 3 Data structure of the metadata field

Name

Type

Description

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.

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.

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.

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.

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.

labels

Map[string]string

Map of string keys and values that can be used to organize and categorize (scope and select) objects. May match selectors of replication controllers and services.

name

String

Name must be unique within a namespace. Is required when creating resources, although some resources may allow a client to request the generation of an appropriate name automatically. Name is primarily intended for creation idempotence and configuration definition. Cannot be updated.

0 characters < name length ≤ 253 characters.

The name must be a regular expression [a-z0-9]([-a-z0-9]*[a-z0-9])?.

resourceVersion

String

Specific resourceVersion to which this reference is made, if any.

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.

Table 4 Data structure of the spec field

Parameter

Type

Description

accessModes

String array

Access mode of the persistent volume.

capacity

Object

Actual resources and capacity of the persistent volume.

flexVolume

Table 5

FlexVolume storage plug-in of Kubernetes.

persistentVolumeReclaimPolicy

String

What happens to a persistent volume when released from its claim. Valid options are Retain (default) and

Recycle. Recycling must be supported by the volume plugin underlying this persistent volume.

Table 5 Data structure of the flexVolume field

Parameter

Type

Description

driver

String

Name of the FlexVolume storage plug-in. Set this parameter based on the storage type.

  • huawei.com/fuxivol: EVS
  • huawei.com/fuxinfs: NFS

fsType

String

File system type. Set this parameter based on the storage type.

  • ext4: EVS.
  • nfs: SFS.

options

String

-

Table 6 Data structure of the options field

Parameter

Type

Description

driver

String

Name of the FlexVolume storage plug-in. Set this parameter based on the storage type.

  • huawei.com/fuxivol: EVS
  • huawei.com/fuxinfs: NFS

region

String

Region where the cloud storage is located.

volumeID

String

UUID of the cloud storage.

Table 7 Data structure of the status field

Parameter

Type

Description

phase

String

Current status of the persistent volume.

Example response:

{
    "apiVersion": "v1",
    "kind": "PersistentVolume",
    "metadata": {
        "annotations": {
            "pv.kubernetes.io/namespace": "default"
        },
        "creationTimestamp": "2019-05-09T07:08:57Z",
        "deletionGracePeriodSeconds": 0,
        "deletionTimestamp": "2019-05-09T07:10:09Z",
        "finalizers": [
            "kubernetes.io/pv-protection"
        ],
        "labels": {
            "name": "volume-dwb-test"
        },
        "name": "volume-dwb-test",
        "resourceVersion": "2335",
        "selfLink": "/api/v1/persistentvolumes/volume-dwb-test",
        "uid": "500b1d85-7229-11e9-bc40-fa163e8e6bf0"
    },
    "spec": {
        "accessModes": [
            "ReadWriteOnce"
        ],
        "capacity": {
            "storage": "10Gi"
        },
        "flexVolume": {
            "driver": "huawei.com/fuxinfs",
            "fsType": "ext4",
            "options": {
                "fsType": "ext4",
                "region": "eu-de",
                "volumeID": "46f9553c-4aaf-46e9-911b-9e7751e5ae9a"
            }
        },
        "persistentVolumeReclaimPolicy": "Recycle"
    },
    "status": {
        "phase": "Available"
    }
}

Status Code

Table 8 describes the status code of the API.

Table 8 Status code

Status Code

Description

200

The job for deleting a persistent volume is successfully delivered.