(mgr ctrl.Manager, l logr.Logger, bs *config.BaseOperatorConf)
| 504 | } |
| 505 | |
| 506 | func initControllers(mgr ctrl.Manager, l logr.Logger, bs *config.BaseOperatorConf) error { |
| 507 | disabledControllerNames := sets.New[string]() |
| 508 | if len(*disableControllerForCRD) > 0 { |
| 509 | names := strings.Split(*disableControllerForCRD, ",") |
| 510 | for _, cn := range names { |
| 511 | if _, ok := controllersByName[cn]; !ok { |
| 512 | return fmt.Errorf("bad value=%q for flag=controller.disableReconcileFor. Expected name of reconcile controller", cn) |
| 513 | } |
| 514 | disabledControllerNames.Insert(cn) |
| 515 | } |
| 516 | } |
| 517 | for name, ct := range controllersByName { |
| 518 | if disabledControllerNames.Has(name) || ct.IsDisabled(bs, disabledControllerNames) { |
| 519 | l.Info("controller disabled by provided flag", "name", name, "controller.disableReconcileFor", *disableControllerForCRD) |
| 520 | continue |
| 521 | } |
| 522 | ct.Init(mgr.GetClient(), l, mgr.GetScheme(), bs) |
| 523 | if err := ct.SetupWithManager(mgr); err != nil { |
| 524 | return fmt.Errorf("cannot setup controller=%q: %w", name, err) |
| 525 | } |
| 526 | } |
| 527 | build.SetDisabledControllers(disabledControllerNames) |
| 528 | return nil |
| 529 | } |
| 530 | |
| 531 | func mustGetLoggerEncodingOpts() []zap.EncoderConfigOption { |
| 532 | fieldRemaps := *loggerJSONFields |
no test coverage detected