Unit tests fail at random. This due the fact that the controller code is not that robustly implemented.
After the reconcile it stores the state in .Status and at the same time another reconcile loop is triggered from with a stale resource from
the client cache because it was triggered from the delete pod event which was issued before the status updates.
Proposal
Refactor code to be more robust in general. Meaning refactor into different phases which each will exit the reconciliation and start from the beginning if required.
This includes:
Unlink stale reconciler from the realm status
Delete reconciler pod if it is stale
Garbage collect reconciler pod
Skip reconciliation if last sucessful reconciliation is before spec.interval + now()
Current situation
Unit tests fail at random. This due the fact that the controller code is not that robustly implemented. After the reconcile it stores the state in .Status and at the same time another reconcile loop is triggered from with a stale resource from the client cache because it was triggered from the delete pod event which was issued before the status updates.
Proposal
Refactor code to be more robust in general. Meaning refactor into different phases which each will exit the reconciliation and start from the beginning if required. This includes: