🐛 short-circuit reconcile when objects are deleted by joelanford · Pull Request #2022 · operator-framework/operator-controller

@joelanford

This is necessary to ensure that we do not keep reconciling the objects
as if they were not deleted.

The need for this became apparent while trying to use --cascade=orphan
with a ClusterExtension. In theory, that should work out of the box
because, we set owner references on all managed objects.

However, that was not working because our controller was fully
reconciling objects with metadata.finalizers: ["orphan"], which was
writing owner references back into the objects that the orphan deletion
process had just removed.

Ultimately this meant that the managed objects would be background
deleted because they once again had an owner reference to the
now-deleted ClusterExtension, which then caused the kubernetes garbage
collector to clean them up.

In general, it stands to reason that once we have successfully processed
all of our finalizers after a deletion of an object, we should stop
reconciling that object.

Signed-off-by: Joe Lanford <joe.lanford@gmail.com>