Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 tenancy: only delete LogicalCluster if needed #2957

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions pkg/reconciler/tenancy/workspace/workspace_reconcile_deletion.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ func (r *deletionReconciler) reconcile(ctx context.Context, workspace *tenancyv1
clusterName = logicalcluster.Name(a)
}

if _, err := r.getLogicalCluster(ctx, clusterName.Path()); err != nil && !apierrors.IsNotFound(err) {
logicalCluster, err := r.getLogicalCluster(ctx, clusterName.Path())
if err != nil && !apierrors.IsNotFound(err) {
return reconcileStatusStopAndRequeue, err
} else if apierrors.IsNotFound(err) {
finalizers := sets.NewString(workspace.Finalizers...)
Expand All @@ -74,9 +75,11 @@ func (r *deletionReconciler) reconcile(ctx context.Context, workspace *tenancyv1
return reconcileStatusContinue, nil
}

logger.Info("Deleting LogicalCluster")
if err := r.deleteLogicalCluster(ctx, clusterName.Path()); err != nil {
return reconcileStatusStopAndRequeue, err
if logicalCluster.DeletionTimestamp.IsZero() {
logger.Info("Deleting LogicalCluster")
if err := r.deleteLogicalCluster(ctx, clusterName.Path()); err != nil {
return reconcileStatusStopAndRequeue, err
}
}

// here we are waiting for the other shard to remove the finalizer of the Workspace
Expand Down