(ctx context.Context, mgr manager.Manager, s *options.CoreOptions)
| 237 | } |
| 238 | |
| 239 | func prepareRun(ctx context.Context, mgr manager.Manager, s *options.CoreOptions) error { |
| 240 | if s.UseWebhook { |
| 241 | klog.InfoS("Enable webhook", "server port", strconv.Itoa(s.WebhookPort)) |
| 242 | oamwebhook.Register(mgr, *s.ControllerArgs) |
| 243 | if err := waitWebhookSecretVolume(s.CertDir, waitSecretTimeout, waitSecretInterval); err != nil { |
| 244 | klog.ErrorS(err, "Unable to get webhook secret") |
| 245 | return err |
| 246 | } |
| 247 | } |
| 248 | |
| 249 | if err := oamv1beta1.Setup(mgr, *s.ControllerArgs); err != nil { |
| 250 | klog.ErrorS(err, "Unable to setup the oam controller") |
| 251 | return err |
| 252 | } |
| 253 | |
| 254 | if err := multicluster.InitClusterInfo(mgr.GetConfig()); err != nil { |
| 255 | klog.ErrorS(err, "Init control plane cluster info") |
| 256 | return err |
| 257 | } |
| 258 | |
| 259 | klog.Info("Start the vela controller manager") |
| 260 | for _, hook := range []hooks.PreStartHook{hooks.NewSystemCRDValidationHook()} { |
| 261 | if err := hook.Run(ctx); err != nil { |
| 262 | return fmt.Errorf("failed to run hook %T: %w", hook, err) |
| 263 | } |
| 264 | } |
| 265 | |
| 266 | return nil |
| 267 | } |
| 268 | |
| 269 | // registerHealthChecks is used to create readiness&liveness probes |
| 270 | func registerHealthChecks(mgr ctrl.Manager) error { |
no test coverage detected