Skip to content

Commit

Permalink
🐛 Fix cluster deletion without LB ref (#183)
Browse files Browse the repository at this point in the history
**What is the purpose of this pull request/Why do we need it?**

Fixes NPE when trying to delete a cluster without LB ref.
  • Loading branch information
avorima authored Jul 17, 2024
1 parent ece00d0 commit 32a818b
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions internal/controller/ionoscloudcluster_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -207,9 +207,14 @@ func (r *IonosCloudClusterReconciler) reconcileDelete(
return ctrl.Result{RequeueAfter: defaultReconcileDuration}, nil
}

reconcileSequence := []serviceReconcileStep[scope.Cluster]{
{"ReconcileControlPlaneEndpointDeletion", cloudService.ReconcileControlPlaneEndpointDeletion},
var reconcileSequence []serviceReconcileStep[scope.Cluster]
// TODO: This logic needs to move to another controller.
if clusterScope.IonosCluster.Spec.LoadBalancerProviderRef != nil {
reconcileSequence = []serviceReconcileStep[scope.Cluster]{
{"ReconcileControlPlaneEndpointDeletion", cloudService.ReconcileControlPlaneEndpointDeletion},
}
}

for _, step := range reconcileSequence {
if requeue, err := step.fn(ctx, clusterScope); err != nil || requeue {
if err != nil {
Expand Down

0 comments on commit 32a818b

Please sign in to comment.