From 40a36b9477faefa797a0d7e54597f3d99a7d1bf5 Mon Sep 17 00:00:00 2001 From: Alexandr Stefurishin Date: Fri, 22 Nov 2024 09:10:55 +0300 Subject: [PATCH] fix Signed-off-by: Alexandr Stefurishin --- images/agent/src/internal/controller/controller.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/images/agent/src/internal/controller/controller.go b/images/agent/src/internal/controller/controller.go index 090ea5ad..b248837d 100644 --- a/images/agent/src/internal/controller/controller.go +++ b/images/agent/src/internal/controller/controller.go @@ -162,7 +162,9 @@ func makeReconcileDispatcher[T client.Object]( // load object being reconciled log.Info(fmt.Sprintf("[ReconcileDispatcher] Reconciler starts to reconcile the request %s", req.NamespacedName.String())) - var obj T + t := reflect.TypeFor[T]() + obj := reflect.New(t.Elem()).Interface().(T) + if err := cl.Get(ctx, req.NamespacedName, obj); err != nil { if errors.IsNotFound(err) { log.Warning(fmt.Sprintf("[ReconcileDispatcher] seems like the object was deleted as unable to get it, err: %s. Stop to reconcile", err.Error()))