Skip to content

Commit 09ffb5e

Browse files
tmshortclaude
andcommitted
fix(controller): Skip resolution when ClusterExtension is being deleted
Move the deletion timestamp check to occur immediately after finalizer error handling in the reconcile loop. This ensures that resolution, unpacking, and installation are skipped entirely when a ClusterExtension is being deleted, regardless of whether finalizers have been updated. This fixes OCPBUGS-62942 where ClusterExtensions could not be deleted after enabling the BoxcutterRuntime feature gate, because the controller would attempt to resolve bundles even during deletion. If the original catalog was no longer available (deleted or cache cleared), this would fail with "cache for catalog not found" error and prevent deletion. The fix ensures that when a ClusterExtension has a deletion timestamp, the reconcile loop returns early without attempting any resolution or installation operations. Fixes: OCPBUGS-62942 🤖 Generated with [Claude Code](https://claude.com/claude-code) via /jira:solve OCPBUGS-62942 origin Co-Authored-By: Claude <noreply@anthropic.com> Signed-off-by: Todd Short <tshort@redhat.com>
1 parent 7fe0769 commit 09ffb5e

1 file changed

Lines changed: 13 additions & 8 deletions

File tree

internal/operator-controller/controllers/clusterextension_controller.go

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -189,17 +189,22 @@ func (r *ClusterExtensionReconciler) reconcile(ctx context.Context, ext *ocv1.Cl
189189
setStatusProgressing(ext, err)
190190
return ctrl.Result{}, err
191191
}
192-
if finalizeResult.Updated || finalizeResult.StatusUpdated {
193-
// On create: make sure the finalizer is applied before we do anything
194-
// On delete: make sure we do nothing after the finalizer is removed
192+
193+
// If the ClusterExtension is being deleted, we should not proceed with resolution or installation.
194+
// This prevents errors when catalogs that were used for installation are no longer available.
195+
// We check this immediately after finalizer handling to ensure we skip all reconciliation logic
196+
// for resources that are being deleted, even if the finalizers haven't been updated.
197+
if ext.GetDeletionTimestamp() != nil {
198+
// The cluster extension is being deleted. We've handled finalizer registration/removal above,
199+
// but the cluster extension may still be present in the cluster because there are other
200+
// finalizers that other controllers need to handle (e.g. the orphan deletion finalizer).
201+
// In this case, we should not proceed with resolution, unpacking, or installation.
195202
return ctrl.Result{}, nil
196203
}
197204

198-
if ext.GetDeletionTimestamp() != nil {
199-
// If we've gotten here, that means the cluster extension is being deleted, we've handled all of
200-
// _our_ finalizers (above), but the cluster extension is still present in the cluster, likely
201-
// because there are _other_ finalizers that other controllers need to handle, (e.g. the orphan
202-
// deletion finalizer).
205+
if finalizeResult.Updated || finalizeResult.StatusUpdated {
206+
// On create: make sure the finalizer is applied before we do anything
207+
// On delete: make sure we do nothing after the finalizer is removed
203208
return ctrl.Result{}, nil
204209
}
205210

0 commit comments

Comments
 (0)