Skip to content

Commit

Permalink
doc: support for storageclass annotation
Browse files Browse the repository at this point in the history
Signed-off-by: Praveen M <[email protected]>
  • Loading branch information
iPraveenParihar committed Jun 10, 2024
1 parent 7a9c476 commit a346e6f
Showing 1 changed file with 29 additions and 5 deletions.
34 changes: 29 additions & 5 deletions docs/reclaimspace.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,30 @@ data-pvc-1642664617 */1 * * * * 3s
[go_cron]:
https://pkg.go.dev/github.com/robfig/cron/v3#hdr-CRON_Expression_Format

## Annotating StorageClass

You can create `ReclaimSpaceCronJob` CR automatically by adding the
`reclaimspace.csiaddons.openshift.io/schedule: "@midnight"` annotations to the StorageClass object.
This will only affect new PersistentVolumeClaims created from this StorageClass for ReclaimSpace
operations. To include existing PersistentVolumeClaims in ReclaimSpace operations, you must restart
the controller. This will ensure that reclaimspace annotations are added to the existing
PersistentVolumeClaims and `ReclaimSpaceCronJob` resources are created for them.

```console
$ kubectl get storageclass rbd-sc
NAME PROVISIONER RECLAIMPOLICY VOLUMEBINDINGMODE ALLOWVOLUMEEXPANSION AGE
rbd-sc rbd.csi.ceph.com Delete Immediate true 5d2h

$ kubectl annotate storageclass rbd-sc "reclaimspace.csiaddons.openshift.io/schedule=@midnight"
storageclass.storage.k8s.io/rbd-sc annotated
```

**Note** Please note that the PersistentVolumeClaim annotation takes priority
over StorageClass annotation. The kubernetes-csi-addons only generate a
`ReclaimSpaceCronJob` if the annotation exists on the StorageClass. If an admin
needs to modify or delete the annotation on the StorageClass, they must perform
the same action on all the PersistentVolumeClaims created from this StorageClass.

## Annotating Namespace

You can create `ReclaimSpaceCronJob` CR automatically by adding the
Expand All @@ -121,8 +145,8 @@ $ kubectl annotate namespace default "reclaimspace.csiaddons.openshift.io/schedu
namespace/default annotated
```

**Note** Please note that the PersistentVolumeClaim annotation takes priority
over Namespace annotation. The kubernetes-csi-addons only generate a
`ReclaimSpaceCronJob` if the annotation exists on the Namespace. If an admin
needs to modify or delete the annotation on the Namespace, they must perform
the same action on all the PersistentVolumeClaims within that Namespace.
**Note** Please note that the PersistentVolumeClaim and StorageClass annotation
takes priority over Namespace annotation. The kubernetes-csi-addons only generate a
`ReclaimSpaceCronJob` if the annotation exists on the Namespace. If an admin needs
to modify or delete the annotation on the Namespace, they must perform the same
action on all the PersistentVolumeClaims within that Namespace.

0 comments on commit a346e6f

Please sign in to comment.