fix: do not infinitely reconcile in case of exit code > 0 #284
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Current situation
Currently if the reconciler exits > 0 the controller infintely requeues the resource
without backoff.
The problem is that the controller watches for owned pods (reconcilers) which triggers the requeue also in case of the delete events.
And currently the controller deletes the reconciler pod in case of any exit code and recreate it. There is no way of having a backoff that way.
Proposal
It actually makes far more sense to just let the pod controller do the restart backoff of a reconciler.
The realm controller will now only delete the pod if exit==0. In case of an error the pod controller will just backoff restart the container.
If the reconciliation was sucessful (exit code == 0) the controller will delete the pod and only requeue with spec.interval. (or not requeueing at all if no interval is set).