Skip to content

Commit

Permalink
Fix returning non-empty reconcile result and error
Browse files Browse the repository at this point in the history
  • Loading branch information
EmilienM committed Jan 24, 2024
1 parent 5d62dd5 commit d3736f2
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions controllers/openstackcluster_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,12 @@ func (r *OpenStackClusterReconciler) Reconcile(ctx context.Context, req ctrl.Req
}

// Handle non-deleted clusters
return reconcileNormal(scope, cluster, openStackCluster)
result, err := reconcileNormal(scope, cluster, openStackCluster)
if err != nil {
return reconcile.Result{}, err
}

return result, nil
}

func (r *OpenStackClusterReconciler) reconcileDelete(ctx context.Context, scope scope.Scope, cluster *clusterv1.Cluster, openStackCluster *infrav1.OpenStackCluster) (ctrl.Result, error) {
Expand Down Expand Up @@ -297,8 +302,11 @@ func reconcileNormal(scope scope.Scope, cluster *clusterv1.Cluster, openStackClu
}

result, err := reconcileBastion(scope, cluster, openStackCluster)
if err != nil || !reflect.DeepEqual(result, reconcile.Result{}) {
return result, err
if err != nil {
return reconcile.Result{}, err
}
if !reflect.DeepEqual(result, reconcile.Result{}) {
return result, nil
}

availabilityZones, err := computeService.GetAvailabilityZones()
Expand Down

0 comments on commit d3736f2

Please sign in to comment.