Bug 2046677

Summary: Reclaimspacecronjob is not created after adding the annotation reclaimspace.csiaddons.openshift.io/schedule in PVC
Product: [Red Hat Storage] Red Hat OpenShift Data Foundation Reporter: Jilju Joy <jijoy>
Component: csi-addonsAssignee: Rakshith <rar>
Status: CLOSED ERRATA QA Contact: Jilju Joy <jijoy>
Severity: high Docs Contact:
Priority: unspecified    
Version: 4.10CC: mashetty, muagarwa, nberry, ocs-bugs, odf-bz-bot, rar
Target Milestone: ---Keywords: AutomationBackLog, TestBlocker
Target Release: ODF 4.10.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: 4.10.0-132 Doc Type: No Doc Update
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-04-13 18:52:21 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Jilju Joy 2022-01-27 08:02:00 UTC
Description of problem (please be detailed as possible and provide log
snippests):
Reclaimspacecronjob is not created automatically after adding the annotation "reclaimspace.csiaddons.openshift.io/schedule=@midnight" in the PVC.

PVC before adding the annotation:

$ oc get pvc -n test-project -o yaml
apiVersion: v1
items:
- apiVersion: v1
  kind: PersistentVolumeClaim
  metadata:
    annotations:
      pv.kubernetes.io/bind-completed: "yes"
      pv.kubernetes.io/bound-by-controller: "yes"
      volume.beta.kubernetes.io/storage-provisioner: openshift-storage.rbd.csi.ceph.com
      volume.kubernetes.io/storage-provisioner: openshift-storage.rbd.csi.ceph.com
    creationTimestamp: "2022-01-27T07:40:30Z"
    finalizers:
    - kubernetes.io/pvc-protection
    name: pvcrbd10
    namespace: test-project
    resourceVersion: "113029"
    uid: 57398f22-8f9d-49d9-83ac-3b05643e5df0
  spec:
    accessModes:
    - ReadWriteOnce
    resources:
      requests:
        storage: 5Gi
    storageClassName: ocs-storagecluster-ceph-rbd
    volumeMode: Filesystem
    volumeName: pvc-57398f22-8f9d-49d9-83ac-3b05643e5df0
  status:
    accessModes:
    - ReadWriteOnce
    capacity:
      storage: 5Gi
    phase: Bound
kind: List
metadata:
  resourceVersion: ""
  selfLink: ""


Adding annotation:
$ oc annotate pvc pvcrbd10 "reclaimspace.csiaddons.openshift.io/schedule=@midnight"
persistentvolumeclaim/pvcrbd10 annotated


PVC yaml after adding annotation:

$ oc get pvc -n test-project -o yaml
apiVersion: v1
items:
- apiVersion: v1
  kind: PersistentVolumeClaim
  metadata:
    annotations:
      pv.kubernetes.io/bind-completed: "yes"
      pv.kubernetes.io/bound-by-controller: "yes"
      reclaimspace.csiaddons.openshift.io/cronjob: pvcrbd10-1643269448
      reclaimspace.csiaddons.openshift.io/schedule: '@midnight'
      volume.beta.kubernetes.io/storage-provisioner: openshift-storage.rbd.csi.ceph.com
      volume.kubernetes.io/storage-provisioner: openshift-storage.rbd.csi.ceph.com
    creationTimestamp: "2022-01-27T07:40:30Z"
    finalizers:
    - kubernetes.io/pvc-protection
    name: pvcrbd10
    namespace: test-project
    resourceVersion: "115263"
    uid: 57398f22-8f9d-49d9-83ac-3b05643e5df0
  spec:
    accessModes:
    - ReadWriteOnce
    resources:
      requests:
        storage: 5Gi
    storageClassName: ocs-storagecluster-ceph-rbd
    volumeMode: Filesystem
    volumeName: pvc-57398f22-8f9d-49d9-83ac-3b05643e5df0
  status:
    accessModes:
    - ReadWriteOnce
    capacity:
      storage: 5Gi
    phase: Bound
kind: List
metadata:
  resourceVersion: ""
  selfLink: ""


Reclaimspacecronjob not found after adding annotation.
$ oc get reclaimspacecronjobs.csiaddons.openshift.io -n test-project
No resources found in test-project namespace.

$ oc get reclaimspacecronjob pvcrbd10-1643269448 -n test-project
Error from server (NotFound): reclaimspacecronjobs.csiaddons.openshift.io "pvcrbd10-1643269448" not found

===============================================================
Version of all relevant components (if applicable):
ODF 4.10.0-122
OCP 4.10.0-0.nightly-2022-01-25-023600

Does this issue impact your ability to continue to work with the product
(please explain in detail what is the user impact)?
The method to create ReclaimSpaceCronJob automatically is not working.

Is there any workaround available to the best of your knowledge?
No

Rate from 1 - 5 the complexity of the scenario you performed that caused this
bug (1 - very simple, 5 - very complex)?
1

Can this issue reproducible?
Yes

Can this issue reproduce from the UI?
Yes

If this is a regression, please provide more details to justify this:
New feature in 4.10

=========================================================
Steps to Reproduce:
1. Create a RBD PVC
2. Add annotation in the PVC to create ReclaimSpaceCronJob
example:
$ oc annotate pvc pvcrbd10 "reclaimspace.csiaddons.openshift.io/schedule=@midnight"
persistentvolumeclaim/pvcrbd10 annotated

3. Verify the presence of new reclaimspacecronjob.
examples:
$ oc get reclaimspacecronjobs.csiaddons.openshift.io -n test-project
$ oc get reclaimspacecronjob pvcrbd10-1643269448 -n test-project

Actual results:
Reclaimspacecronjob is not created

Expected results:
Reclaimspacecronjob should be created automatically after adding the annotation

Additional info:
logs will be added shortly

Comment 6 Jilju Joy 2022-02-01 14:50:54 UTC
Verified in version:
ODF 4.10.0-132
OCP 4.10.0-0.nightly-2022-01-31-012936


$ oc annotate pvc pvc-test-39359ba1335242e982ab1b7fab07fef "reclaimspace.csiaddons.openshift.io/schedule=@hourly" 
persistentvolumeclaim/pvc-test-39359ba1335242e982ab1b7fab07fef annotated

$ oc get reclaimspacecronjob  -n namespace-test-4b538b7c4334447bbb82dc171
NAME                                                  SCHEDULE   SUSPEND   ACTIVE   LASTSCHEDULE   AGE
pvc-test-39359ba1335242e982ab1b7fab07fef-1643726802   @hourly                                      58s


This is also tested by adding annotation from the console.

Comment 11 errata-xmlrpc 2022-04-13 18:52:21 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Important: Red Hat OpenShift Data Foundation 4.10.0 enhancement, security & bug fix update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2022:1372