Skip to content

Commit e5afc46

Browse files
yashmehrotramoshloop
authored andcommitted
chore: return reconciler object to allow status updates
1 parent c19002a commit e5afc46

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

reconciler.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ import (
1717
func SetupReconciler[T any, PT interface {
1818
*T
1919
client.Object
20-
}](ctx context.Context, mgr ctrl.Manager, OnUpsertFunc func(context.Context, PT) error, OnDeleteFunc func(context.Context, string) error, finalizer string) error {
20+
}](ctx context.Context, mgr ctrl.Manager, OnUpsertFunc func(context.Context, PT) error, OnDeleteFunc func(context.Context, string) error, finalizer string) (Reconciler[T, PT], error) {
2121
if finalizer == "" {
22-
return fmt.Errorf("field Finalizer cannot be empty")
22+
return Reconciler[T, PT]{}, fmt.Errorf("field Finalizer cannot be empty")
2323
}
2424

2525
r := Reconciler[T, PT]{
@@ -31,7 +31,11 @@ func SetupReconciler[T any, PT interface {
3131
Finalizer: finalizer,
3232
}
3333

34-
return r.SetupWithManager(mgr)
34+
if err := r.SetupWithManager(mgr); err != nil {
35+
return Reconciler[T, PT]{}, fmt.Errorf("error setting up manager: %w", err)
36+
}
37+
38+
return r, nil
3539
}
3640

3741
type Reconciler[T any, PT interface {

0 commit comments

Comments
 (0)