verifa / horizon

Building blocks and patterns for creating a minimal internal developer platform
Apache License 2.0
8 stars 1 forks source link

Implement an alternative to `Reconciler` that has specific `Create`/`Update`/`Delete` methods #9

Closed jlarfors closed 3 months ago

jlarfors commented 3 months ago

Writing reconcile logic always requires serious head scratching. In some cases, you simply want to separate the Create from the Update from the Delete.

It would be possible to provide some basic construct for doing Create/Update/Delete operations on objects, as an alternative to a Reconciler.

How this could work requires some thought.

jlarfors commented 3 months ago

Since server-side apply checks for a diff and performs a no-op if the object has not changed, this can quite easily be achieved now by setting the object .status field and checking that in the reconciler.

I feel this is a better approach than separate Create/Update/Delete methods. Take the scenario where a Create command makes an object which is not reconcilable and requires and update. With reconciliation that checks for .status we do not have this problem.