From cc9870f2a4893dc697d350261abcff0b01e3f5c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20GLON?= Date: Tue, 30 Jul 2024 21:46:36 +0200 Subject: [PATCH] fix(oscMachineTemplate): Nil pointer due to error not managed --- controllers/oscmachinetemplate_capacity_controller.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/controllers/oscmachinetemplate_capacity_controller.go b/controllers/oscmachinetemplate_capacity_controller.go index 5ac2fdcb7..aca4a4b1f 100644 --- a/controllers/oscmachinetemplate_capacity_controller.go +++ b/controllers/oscmachinetemplate_capacity_controller.go @@ -68,6 +68,12 @@ func (r *OscMachineTemplateReconciler) Reconcile(ctx context.Context, req ctrl.R Logger: log, OscMachineTemplate: machineTemplate, }) + + if err != nil { + log.V(2).Info("Cluster is not available yet") + log.Error(err, "failed to get machineTemplate.") + return reconcile.Result{RequeueAfter: 30 * time.Second}, nil + } clusterName := machineTemplateScope.GetClusterName() labels := map[string]string{"ccm": clusterName + "-crs-ccm"}