Skip to content

Commit fdc8f1a

Browse files
committed
Fixup
1 parent d09668c commit fdc8f1a

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

internal/operator-controller/controllers/clusterextensionrevision_controller.go

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -83,16 +83,19 @@ func (c *ClusterExtensionRevisionReconciler) Reconcile(ctx context.Context, req
8383
// This situation can only appear if the ClusterExtension object has been deleted with --cascade=Orphan.
8484
// To not leave unactionable resources on the cluster, we are going to just
8585
// reap the revision reverences and propagate the Orphan deletion.
86-
err := client.IgnoreNotFound(
87-
c.Client.Delete(ctx, rev, client.PropagationPolicy(metav1.DeletePropagationOrphan), client.Preconditions{
88-
UID: ptr.To(rev.GetUID()),
89-
ResourceVersion: ptr.To(rev.GetResourceVersion()),
90-
}),
91-
)
92-
if err != nil {
93-
return res, err
86+
if rev.DeletionTimestamp.IsZero() {
87+
err := client.IgnoreNotFound(
88+
c.Client.Delete(ctx, rev, client.PropagationPolicy(metav1.DeletePropagationOrphan), client.Preconditions{
89+
UID: ptr.To(rev.GetUID()),
90+
ResourceVersion: ptr.To(rev.GetResourceVersion()),
91+
}),
92+
)
93+
if err != nil {
94+
return res, err
95+
}
96+
// we get requeued to remove the finalizer.
97+
return res, nil
9498
}
95-
9699
if err := c.removeFinalizer(ctx, rev, clusterExtensionRevisionTeardownFinalizer); err != nil {
97100
return res, err
98101
}

0 commit comments

Comments
 (0)