Skip to content

Commit

Permalink
Log enabled controllers and warn if no controllers are enabled (#3710)
Browse files Browse the repository at this point in the history
Because the default is to enable no controllers, it is easy to
mistakenly start a no-op controller.
  • Loading branch information
justinsb committed Jan 5, 2023
1 parent 119a3ae commit dc931ec
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions porch/controllers/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,13 +144,21 @@ func run(ctx context.Context) error {
}

enabledReconcilers := parseReconcilers(enabledReconcilersString)
var enabled []string
for name, reconciler := range reconcilers {
if !reconcilerIsEnabled(enabledReconcilers, name) {
continue
}
if err = reconciler.SetupWithManager(mgr); err != nil {
return fmt.Errorf("error creating %s reconciler: %w", name, err)
}
enabled = append(enabled, name)
}

if len(enabled) == 0 {
klog.Warningf("no reconcilers are enabled; did you forget to pass the --reconcilers flag?")
} else {
klog.Infof("enabled reconcilers: %v", strings.Join(enabled, ","))
}

//+kubebuilder:scaffold:builder
Expand Down

0 comments on commit dc931ec

Please sign in to comment.