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

fix cluster deletion #942

Merged
merged 1 commit into from
May 9, 2024
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
7 changes: 6 additions & 1 deletion controller/internal/controller/cluster_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ func (r *ClusterReconciler) Reconcile(ctx context.Context, req reconcile.Request

// Get Provider ID from the reference if it is set and ensure that controller reference is set properly.
providerId, result, err := r.getProviderIdAndSetControllerRef(ctx, cluster)
if result != nil {
if result != nil || err != nil {
utils.MarkCondition(cluster.SetCondition, v1alpha1.SynchronizedConditionType, v1.ConditionFalse, v1alpha1.SynchronizedConditionReasonError, "")
return *result, err
}
Expand Down Expand Up @@ -191,6 +191,11 @@ func (r *ClusterReconciler) addOrRemoveFinalizer(cluster *v1alpha1.Cluster) *ctr

// If object is being deleted cleanup and remove the finalizer.
if !cluster.ObjectMeta.DeletionTimestamp.IsZero() {
if cluster.Status.ID == nil {
controllerutil.RemoveFinalizer(cluster, ClusterFinalizer)
return &ctrl.Result{}
}

// If object is already being deleted from Console API requeue.
if r.ConsoleClient.IsClusterDeleting(cluster.Status.ID) {
return &requeue
Expand Down
Loading