Skip to content

Commit dc931ec

Browse files
authored
Log enabled controllers and warn if no controllers are enabled (#3710)
Because the default is to enable no controllers, it is easy to mistakenly start a no-op controller.
1 parent 119a3ae commit dc931ec

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

porch/controllers/main.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,13 +144,21 @@ func run(ctx context.Context) error {
144144
}
145145

146146
enabledReconcilers := parseReconcilers(enabledReconcilersString)
147+
var enabled []string
147148
for name, reconciler := range reconcilers {
148149
if !reconcilerIsEnabled(enabledReconcilers, name) {
149150
continue
150151
}
151152
if err = reconciler.SetupWithManager(mgr); err != nil {
152153
return fmt.Errorf("error creating %s reconciler: %w", name, err)
153154
}
155+
enabled = append(enabled, name)
156+
}
157+
158+
if len(enabled) == 0 {
159+
klog.Warningf("no reconcilers are enabled; did you forget to pass the --reconcilers flag?")
160+
} else {
161+
klog.Infof("enabled reconcilers: %v", strings.Join(enabled, ","))
154162
}
155163

156164
//+kubebuilder:scaffold:builder

0 commit comments

Comments
 (0)