10.3. Enabling reclaim space operation using ReclaimSpaceCronJob
ReclaimSpaceCronJob invokes the reclaim space operation based on the given schedule such as daily, weekly, and so on. You have to create ReclaimSpaceCronJob only once for a persistent volume claim. The CSI-addons controller creates a ReclaimSpaceJob at the requested time and interval with the schedule attribute.
참고
-
Recommended schedule interval is
@weekly. -
Minimum interval between each scheduled operation should be at least 24 hours. For example,
@daily(At 00:00 every day) or “0 3 * * *” (At 3:00 every day). - Schedule the ReclaimSpace operation during off-peak, maintenance window, or the interval when workload input/output is expected to be low.
Procedure
Create and apply the following custom resource for reclaim space operation
apiVersion: csiaddons.openshift.io/v1alpha1 kind: ReclaimSpaceCronJob metadata: name: reclaimspacecronjob-sample spec: jobTemplate: spec: target: persistentVolumeClaim: data-pvc timeout: 360 schedule: '@weekly' concurrencyPolicy: Forbidwhere,
concurrencyPolicy-
Describes the changes when a new
ReclaimSpaceJobis scheduled by theReclaimSpaceCronJob, while a previousReclaimSpaceJobis still running. The defaultForbidprevents starting a new job whereasReplacecan be used to delete the running job potentially in a failure state and create a new one. failedJobsHistoryLimit-
Specifies the number of failed
ReclaimSpaceJobsthat are kept for troubleshooting. jobTemplate-
Specifies the
ReclaimSpaceJob.specstructure that describes the details of the requestedReclaimSpaceJoboperation. successfulJobsHistoryLimit-
Specifies the number of successful
ReclaimSpaceJoboperations. schedule- Specifieds the and/or interval of the recurring operation request and it is in the same format as the Kubernetes CronJobs.
-
Delete the
ReclaimSpaceCronJobcustom resource when execution of reclaim space operation is no longer needed or when the target PVC is deleted.