Skip to content

Commit 2d2af96

Browse files
committed
🐛 Fix delete of csr if assets cannot be downloaded
Fix delete of ClusterStackRelease object in case that there is a problem with the release assets. Currently, the reconcileDelete function requires assets to be downloaded properly. If this is not the case, then the object does not get deleted and is stuck forever. This happens for example when a user specifies a version of a clusterstack that does not exist. Then a ClusterStackRelease object is created, but will never get deleted again, because the downloading of the release assets fails, as the release does not exist. Now we have an additional check to remove the finalizer without any further logic in case there is an issue with the release assets. Signed-off-by: janiskemper <[email protected]>
1 parent 5b4364f commit 2d2af96

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

internal/controller/clusterstackrelease_controller.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,13 @@ func (r *ClusterStackReleaseReconciler) Reconcile(ctx context.Context, req recon
8989
defer func() {
9090
conditions.SetSummary(clusterStackRelease)
9191

92+
// Check if the object has a deletion timestamp and release assets have not been downloaded properly.
93+
// In that case, the controller cannot perform a proper reconcileDelete and we just remove the finalizer.
94+
if !clusterStackRelease.DeletionTimestamp.IsZero() &&
95+
conditions.IsFalse(clusterStackRelease, csov1alpha1.ClusterStackReleaseAssetsReadyCondition) {
96+
controllerutil.RemoveFinalizer(clusterStackRelease, csov1alpha1.ClusterStackReleaseFinalizer)
97+
}
98+
9299
if err := patchHelper.Patch(ctx, clusterStackRelease); err != nil {
93100
reterr = fmt.Errorf("failed to patch ClusterStackRelease: %w", err)
94101
}

0 commit comments

Comments
 (0)