To disable reclaim space for a specific PersistentVolumeClaim (PVC), modify the
associated ReclaimSpaceCronJob custom resource (CR).
Procedure
-
Identify the
ReclaimSpaceCronJob CR for the PVC you want to disable reclaim
space.
For example:
oc get reclaimspacecronjobs -o jsonpath='{range .items[?(@.spec.jobTemplate.spec.target.persistentVolumeClaim=="<PVC_NAME>")]}{.metadata.name}{"\n"}{end}'
Replace "<PVC_NAME>" with the name of the PVC.
- Disable the reclaim space from the
ReclaimSpaceCronJob CR as
follows:
- Update the
csiaddons.openshift.io/state annotation from
"managed" to "unmanaged".
For example:
oc annotate reclaimspacecronjobs <RECLAIMSPACECRONJOB_NAME> "csiaddons.openshift.io/state=unmanaged" --overwrite=true
Replace <RECLAIMSPACECRONJOB_NAME> with the
ReclaimSpaceCronJob CR.
- Add
suspend: true under the spec field.
For example:
oc patch reclaimspacecronjobs <RECLAIMSPACECRONJOB_NAME> -p '{"spec": {"suspend": true}}' --type=merge