Reclaim space of namespace
* Namespace controller
* Not possible because we dont get any updates on the namespace object when PVC is created
* PVC controller
* We already have a PVC controller, we can do below operations
* Have a configuration in configmap where its mentioned key and values for default operations like `AUTO_RECLAIMSPACE_FOR_NAMESPACE_STARTS_WITH` `AUTO_RECLAIMSPACE_FOR_DRIVERS`
* Ask User/admin to label to namespace for reclaim space options (optional)
* watch for the PVC events and check the namespace name and use the namespace labels for the reclaimspace operations
* If nothing exists use the defaults from the configmap
* Create the ReclaimSpace CronJob on the PVC object.
Questions:
* If they dont want reclaimspace or the PVC document what need to be changed on the schedule to skip the reclaim space
* lets admin add the annotations to skip the reclaim space if namespace is not required to the reclaimed automatically
Anything else we need to take care of?
Drawbacks//
* updating the schedule on namespace will not update the schedule on the PVC, it need to be directly changed on the PVC.
Final comment:
* We can go ahead with Namespace annotation for now but still customer need to annotate the label with two values
* schdule internal
* driver which need space reclaim
* One Draw back is that if they want to update/delete the annotation it will be considered only for new PVC not for existing PVC as it needs csi-addons operator restarts we it wont trigger PVC update operation
* We can also provide NACK and provide below details
* We dont know who are the consumers of the openshift-storage, if you are creating the PVC from ODF you also need to take care of day 2 operations (which is one time operations which we can document it)
* Can we add alert at PVC level if the rbd image usage is greater than the PVC size? (As we are working on new ceph metrics this might also be useful?)
* fstrim/sparsify can also affects the performance of the workernode and mounted filesystem
* rbd sparsify fails if the rbd image is inuse/busy because of this reason we cannot automatically choose when we want to schdule it. suppose if we schdule per week during at the time if the rbd image is busy or pvc is not mounted to application we might skip reclaiming the space.
changes after discussion
* Namespace controller :-
* New namespace controller will be added to the ocs-operator to add/update the annotation on the namespaces that stats with openshift-*
* PVC controller :-
* PVC controller is already watching for the PVC events
* If the annotation is missing on the PVC it will passthrough and checks the annotations on the namespace
* If the annotation is present it will create update the annotation on the PVC and it will continue the Reconcile operation
// Drawbacks
* If the admin updates/deletes the annotations on the namespace, the PVC's in the namespace will not get updated for the new value, its admin responsibility to take care of adding/removing the annotation on the PVC.
* If the annotation is added later on the Namespace its admin responsibility to restart the controller server to consider existing PVC in the namespace for reclaimspace operations as updating the namespace will not trigger any events on the kubernetes-csi-addons side.