// Module included in the following assemblies:
//
// * storage/understanding-persistent-storage.adoc
//

:_mod-docs-content-type: CONCEPT 
[id="storage-persistent-storage-pvc-volumeattributesclass_{context}"]
= Volume Attributes Classes

[role="_abstract"]
Volume Attributes Classes enable dynamic modification of storage performance, such as IOPS and throughput, on persistent volume claims without re-provisioning or downtime. Administrators define classes representing quality-of-service levels, and users apply them for on-demand performance tuning.

[id="storage-persistent-storage-pvc-volumeattributesclass-limitations_{context}"]
== Volume Attributes Classes Limitations
Volume Attributes Classes have the following limitations:

* Only supported with AWS Elastic Block Storage (EBS) and Google Cloud Platform (GCP) persistent disk (PD) Container Storage Interface (CSI).
* With GCP PD, volume modification using Volume Attributes Classes is only possible for hyperdisk-balanced disk types.
* No more than 512 parameters can be defined for a `VolumeAttributesClass`. 
* The total length of the parameter's object, including its keys and values, cannot exceed 256 KiB.
* If you apply a Volume Attributes Class to a PVC, you can change the applied Volume Attributes Class for that PVC, but you cannot delete it from the PVC. To delete the Volume Attributes Class from the PVC, you must delete the PVC, and then re-create the PVC.
* Volume Attributes Class parameters cannot be edited. If you need to change Volume Attributes Class parameters, create a new Volume Attributes Class with the desired parameters, and then apply it to a PVC.

[id="storage-persistent-storage-pvc-volumeattributesclass-defining{context}"]
== Defining Volume Attributes Classes
When defining Volume Attributes Classes, you must verify supported parameters with your storage provider and explicitly declare all parameters in every Volume Attributes Classes definition. 

If there are multiple Volume Attributes Classes on one driver with different parameters sets, and you change from one Volume Attributes Classes to another, you might expect every non-defined parameter to be set back to the default. However, that does not occur. The non-defined parameters stay the same.

For example, if you have:

* Volume Attributes Class A defines throughput `125` and iops `300`.

* Volume Attributes Class B only defines iops to `400`.

If a persistent volume claim (PVC) changes its Volume Attributes Class from A to B, the resulting volume's parameters are changed to throughput `125` and iops `400`.

The metric, `openshift_cluster_storage_vac_mismatch_parameters`, helps identify mismatched parameters that might lead to the persistence issues:

* `0`: All Volume Attributes Classes define the same set of parameters.

* `1`: Mismatch detected. At least one Volume Attributes Class defines a different set of parameters than the others.

You can modify a Volume Attributes Class on a PVC at any time. However, if a Volume Attributes Class is changed multiple times in a short time period, the underlying storage provider might enforce a delay of several hours before the most recent change is fully reconciled on the disk.

The following is an example Volume Attributes Class YAML file for AWS EBS.

.Example `VolumeAttributesClass` AWS EBS definition
[source,yaml]
----
apiVersion: storage.k8s.io/v1
kind: VolumeAttributesClass
metadata:
  name: silver
driverName: ebs.csi.aws.com
parameters:
  iops: "300"
  throughput: "125" 
  type: io2
  ...
----
* `kind`: Defines object as Volumes Attributes Classes.
* `metadata.Name`: Specifies the name of the `VolumeAttributesClass`. In this example, it is `silver`.
* `driverName`: Specifies the provisioner that determines what volume plugin is used for provisioning persistent volumes (PVs). In this example, it is `ebs.csi.aws.com` for AWS EBS.
* `parameters.type`: Defines the disk type.

The following is an example Volume Attributes Class YAML file for GPC PD.

.Example `VolumeAttributesClass` GPC PD definition
[source,yaml]
----
apiVersion: storage.k8s.io/v1
kind: VolumeAttributesClass
metadata:
  name: silver
driverName: pd.csi.storage.gke.io
parameters:
  iops: "3000"
  throughput: "150Mi"
  ...
----
* `kind`: Defines object as Volumes Attributes Classes.
* `metadata.Name`: Specifies the name of the `VolumeAttributesClass`. In this example, it is `silver`.
* `driverName`: Specifies the provisioner that determines what volume plugin is used for provisioning persistent volumes (PVs). In this example, it is "pd.csi.storage.gke.io" for GPC PD.