Skip to content
Closed
Show file tree
Hide file tree
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
5 changes: 5 additions & 0 deletions controllers/awscluster_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,11 @@ func (r *AWSClusterReconciler) reconcileLoadBalancer(ctx context.Context, cluste
}

func (r *AWSClusterReconciler) reconcileNormal(ctx context.Context, clusterScope *scope.ClusterScope) (reconcile.Result, error) {
if !clusterScope.Cluster.DeletionTimestamp.IsZero() {
clusterScope.Info("Cluster owning the AWSCluster is being deleted, skipping reconciliation")
return reconcile.Result{}, nil
}

clusterScope.Info("Reconciling AWSCluster")

awsCluster := clusterScope.AWSCluster
Expand Down
6 changes: 6 additions & 0 deletions controllers/awscluster_controller_unit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,12 @@ func TestAWSClusterReconcilerReconcile(t *testing.T) {
ownerCluster: &clusterv1.Cluster{ObjectMeta: metav1.ObjectMeta{GenerateName: "capi-test-"}},
expectError: false,
},
{
name: "Should not Reconcile if owner cluster is deleted",
awsCluster: &infrav1.AWSCluster{ObjectMeta: metav1.ObjectMeta{GenerateName: "aws-test-"}},
ownerCluster: &clusterv1.Cluster{ObjectMeta: metav1.ObjectMeta{GenerateName: "capi-test-", DeletionTimestamp: &metav1.Time{Time: time.Now()}}},
expectError: false,
},
{
name: "Should Reconcile successfully if no AWSCluster found",
expectError: false,
Expand Down