Skip to content

Commit 46a5f65

Browse files
author
Adolfo Duarte
authored
Merge pull request #157 from vmware-tanzu/topic/adduarte/better_finalizer_information
Inform user of failure to remove finalizer from cluster during deletion
2 parents fa1fa13 + 244ea43 commit 46a5f65

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

controllers/akodeploymentconfig/cluster/cluster_controller.go

+4-1
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ func (r *ClusterReconciler) ReconcileDelete(
8181
ctrlutil.RemoveFinalizer(cluster, akoov1alpha1.ClusterFinalizer)
8282
} else {
8383
log.Info("AKO deletion is in progress, requeue", "after", requeueAfterForAKODeletion.String())
84+
log.Info("Cluster can not be deleted until finalizer is removed", "finalizer", akoov1alpha1.ClusterFinalizer)
8485
return ctrl.Result{Requeue: true, RequeueAfter: requeueAfterForAKODeletion}, nil
8586
}
8687
}
@@ -94,7 +95,8 @@ func (r *ClusterReconciler) cleanup(
9495
obj *clusterv1.Cluster,
9596
) (bool, error) {
9697
// Firstly we check if there is a cleanup condition in the Cluster
97-
// status , if not, we update it
98+
// status , if not, we update it. If cleanup condition is succeeded=true nothing left to do
99+
// ------- return true since deletion has been marked as succesfull
98100
if !conditions.Has(obj, akoov1alpha1.AviResourceCleanupSucceededCondition) {
99101
conditions.MarkFalse(obj, akoov1alpha1.AviResourceCleanupSucceededCondition, akoov1alpha1.AviResourceCleanupReason, clusterv1.ConditionSeverityInfo, "Cleaning up the AVI load balancing resources before deletion")
100102
log.Info("Trigger the AKO cleanup in the target Cluster and set Cluster condition", "condition", akoov1alpha1.AviResourceCleanupSucceededCondition)
@@ -128,6 +130,7 @@ func (r *ClusterReconciler) cleanup(
128130
}, akoAddonSecret); err != nil {
129131
if apierrors.IsNotFound(err) {
130132
log.Info(fmt.Sprintf("since secret %s/%s is not found, assume the ako resource deletion succeed", akoov1alpha1.TKGSystemNamespace, secretName))
133+
conditions.MarkTrue(obj, akoov1alpha1.AviResourceCleanupSucceededCondition)
131134
return true, nil
132135
}
133136
log.Error(err, "Failed to get AKO Addon Data Values, AKO clean up failed")

0 commit comments

Comments
 (0)