Skip to content

Commit

Permalink
Fix controller enabling logic (#21)
Browse files Browse the repository at this point in the history
  • Loading branch information
Gchbg authored Mar 26, 2024
1 parent bcefed7 commit 6a361e7
Showing 1 changed file with 35 additions and 23 deletions.
58 changes: 35 additions & 23 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,30 +184,42 @@ func main() {
return
}

err = controller.NewMachineReconciler().SetupWithManager(mgr)
if err != nil {
log.Error(ctx, fmt.Errorf("cannot create controller: %w", err), "controller", "Machine")
exitCode = 1
return
}
err = controller.NewMachineClaimReconciler().SetupWithManager(mgr)
if err != nil {
log.Error(ctx, fmt.Errorf("cannot create controller: %w", err), "controller", "MachineClaim")
exitCode = 1
return
}
err = controller.NewOOBReconciler().SetupWithManager(mgr)
if err != nil {
log.Error(ctx, fmt.Errorf("cannot create controller: %w", err), "controller", "OOB")
exitCode = 1
return
}
err = controller.NewOOBSecretReconciler().SetupWithManager(mgr)
if err != nil {
log.Error(ctx, fmt.Errorf("cannot create controller: %w", err), "controller", "OOBSecret")
exitCode = 1
return
if p.enableMachineController {
err = controller.NewMachineReconciler().SetupWithManager(mgr)
if err != nil {
log.Error(ctx, fmt.Errorf("cannot create controller: %w", err), "controller", "Machine")
exitCode = 1
return
}
}

if p.enableMachineClaimController {
err = controller.NewMachineClaimReconciler().SetupWithManager(mgr)
if err != nil {
log.Error(ctx, fmt.Errorf("cannot create controller: %w", err), "controller", "MachineClaim")
exitCode = 1
return
}
}

if p.enableOOBController {
err = controller.NewOOBReconciler().SetupWithManager(mgr)
if err != nil {
log.Error(ctx, fmt.Errorf("cannot create controller: %w", err), "controller", "OOB")
exitCode = 1
return
}
}

if p.enableOOBSecretController {
err = controller.NewOOBSecretReconciler().SetupWithManager(mgr)
if err != nil {
log.Error(ctx, fmt.Errorf("cannot create controller: %w", err), "controller", "OOBSecret")
exitCode = 1
return
}
}

//+kubebuilder:scaffold:builder

err = mgr.AddHealthzCheck("health", healthz.Ping)
Expand Down

0 comments on commit 6a361e7

Please sign in to comment.