Description
In case there is a retry currently in the reconciler it can be checked if this is the last retry attempt, however to set an error message or other flag on status, that the custom resource is in "error state" after few attempted retries, is still quite cumbersome. Since in this case there needs to be a try-catch block to capture all the controller logic, within the cache check if it's the last attempt etc.
It would be nice to explicitly support this with an interface like ErrorStatusHandler
(or something better) , this interface would be called and a user could implement a logic to update the custom resource, thus set an error message on status-sub resource. The framework would handle the rest.
Probably this should be opinionated, thus would work only for status sub-resource.
public interface ErrorStatusHandler<T extends CustomResource<?,?>> {
T updateErrorStatus(T cr)
}