From d3736f2039ac3294f3daa9d3fb01ce32e334536c Mon Sep 17 00:00:00 2001 From: Emilien Macchi Date: Tue, 23 Jan 2024 23:24:44 -0500 Subject: [PATCH] Fix returning non-empty reconcile result and error --- controllers/openstackcluster_controller.go | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/controllers/openstackcluster_controller.go b/controllers/openstackcluster_controller.go index 3b2c5f1110..ec33196c8c 100644 --- a/controllers/openstackcluster_controller.go +++ b/controllers/openstackcluster_controller.go @@ -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) { @@ -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()