IBM Storage Scale container native supports cache volumes to cache the contents of the remote object storage bucket. For more information, see Caching data from object storage. And a CacheVolumeOperation CR is used to trigger download or eviction operation for a cache volume.
CacheVolumeOperation Spec
Property | Required | Default | Description |
---|---|---|---|
cacheVolume | Yes | None | The name of the CacheVolume CR. |
action | Yes | None | The type of the operation to trigger Download or Evict |
contentType | Yes | None | The type of the contents to consider for an operation, data, metadata or both. The possible values are DataAndMetadata , DataOnly , or MetadataOnly . \n For the action Download , the allowed values are DataAndMetadata and MetadataOnly . \n For the action Evict , the allowed values are DataAndMetadata and DataOnly . |
contentFilter | No | None | The list of the contents to download from a bucket for a Download operation or the list of the contents to evict from a cache volume for an Eviction operation. \n Skipping the field contentFilter considers
all the contents for an operation, and alternatively you can specify a "*" in the contentFilter list to explicitly mention considering all the contents for an operation. |
ttlDuration | No | 24h | ttlDuration specifies the time duration to wait before automatically deleting a CacheVolumeOperation CR after successful completion. It can be specified in hours (for example 5h ) or in days (for example 2d ). |
Download
When a CacheVolume CR is created for a cache volume, you can download the contents of an object storage bucket by creating a CacheVolumeOperation CR. For more information on how to create a cache volume, see Creating cache volumes.
The following steps describe creating a sample CacheVolumeOperation CR for a download operation.
- Download a copy of the sample
cachevolumeoperation.download.yaml
from the GitHub repository.
curl -fs https://raw.githubusercontent.com/IBM/ibm-spectrum-scale-container-native/v5.2.3.x/generated/scale/cr/cachevolumeoperation/cachevolumeoperation.download.yaml > cachevolumeoperation.download.yaml || echo "Failed to download CacheVolumeOperation sample CR"
- Edit the sample
cachevolumeoperation.download.yaml
file and change the fields specific to your download operation. For more information about the fields, see CacheVolumeOperation Spec. Make sure that the CacheVolumeOperation CR uses the same namespace as the CacheVolume CR.
To download all the contents of an object storage bucket, remove the contentFilter
altogether from the sample CacheVolumeOperation CR.
You can choose to specify object names or folder names in the contentFilter
list for download.
If the cache volume size is less than the data to download from a bucket, the data at the cache volume is overwritten. The data gets cached again on demand when an application accesses it.
- Apply the resource by using the following command:
oc apply -f cachevolumeoperation.download.yaml
- A successful download CacheVolumeOperation looks like this:
# kubectl get cvo cvo-sample -n ns1
NAME ACTION CACHEVOLUME STATUS REASON AGE
cvo-sample Download pvc-a1d91618-1c9d-4773-92a5-1492f6b0736e True DownloadSuccessful 33s
Eviction
To make a space available in the cache volume for the necessary data, you can evict the current cache volume contents by creating a CacheVolumeOperation CR.
The following steps describe creating a CacheVolumeOperation CR for an eviction operation.
- Download a copy of the sample
cachevolumeoperation.evict.yaml
from the GitHub repository.
curl -fs https://raw.githubusercontent.com/IBM/ibm-spectrum-scale-container-native/v5.2.3.x/generated/scale/cr/cachevolumeoperation/cachevolumeoperation.evict.yaml > cachevolumeoperation.evict.yaml || echo "Failed to download CacheVolumeOperation sample CR"
- Edit the sample
cachevolumeoperation.evict.yaml
file and change the fields specific to your eviction operation. For more information about the fields, see CacheVolumeOperation Spec. Make sure that the CacheVolumeOperation CR uses the same namespace as the CacheVolume CR.
To evict all the contents of a cache volume, remove the contentFilter
altogether from the sample CacheVolumeOperation CR.
- Apply the resource by using the following command:
oc apply -f cachevolumeoperation.evict.yaml
- A successful eviction CacheVolumeOperation looks like this:
# kubectl get cvo cvo-sample -n ns1
NAME ACTION CACHEVOLUME STATUS REASON AGE
cvo-sample Eviction pvc-a1d91618-1c9d-4773-92a5-1492f6b0736e True EvictionSuccessful 33s