From 328927bf66a91917acccfe51fd1fc0b4325af52d 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 | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/controllers/oscmachinetemplate_capacity_controller.go b/controllers/oscmachinetemplate_capacity_controller.go index 5ac2fdcb7..a46c3e428 100644 --- a/controllers/oscmachinetemplate_capacity_controller.go +++ b/controllers/oscmachinetemplate_capacity_controller.go @@ -68,6 +68,13 @@ 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 + } + log.V(2).WithValues("machineTemplateScope", machineTemplateScope).Info("ubble-test") clusterName := machineTemplateScope.GetClusterName() labels := map[string]string{"ccm": clusterName + "-crs-ccm"}