controller-runtime icon indicating copy to clipboard operation
controller-runtime copied to clipboard

Add a util method to recognize if resource in reconcile loop is being deleted

Open grzesuav opened this issue 1 year ago • 3 comments

I noticed there is no common method so I see a lot of if xxx.,metadata.deletionTimestamp... logic, I thin it would be profitable to add utility method like isBeingDeleted(object) to determine that.

WDYT ?

grzesuav avatar Sep 13 '22 16:09 grzesuav

For me, it's still a one-liner to do obj.GetDeletionTimestamp().IsZero(), so this feels like overkill.

austince avatar Sep 19 '22 21:09 austince

+1 bc I think complex controllers are increasingly coon and this would reduce cognitive load on outsiders trying to reason about a controllers logic

jayunit100 avatar Oct 11 '22 04:10 jayunit100

For me, it's still a one-liner to do obj.GetDeletionTimestamp().IsZero(), so this feels like overkill.

+1. And you can see this logic everywhere in the core k/k repo, I don't see anyone feels pain or wants to put it into a utility method.

FillZpp avatar Oct 12 '22 09:10 FillZpp