detect ENABLE_WEBHOOKS!=false

This commit is contained in:
Chris Lu 2020-11-03 20:24:19 -08:00
parent 561e7fcc3a
commit ac68889024
1 changed files with 6 additions and 3 deletions

View File

@ -75,10 +75,13 @@ func main() {
setupLog.Error(err, "unable to create controller", "controller", "Seaweed") setupLog.Error(err, "unable to create controller", "controller", "Seaweed")
os.Exit(1) os.Exit(1)
} }
if os.Getenv("ENABLE_WEBHOOKS") != "false" {
if err = (&seaweedv1.Seaweed{}).SetupWebhookWithManager(mgr); err != nil { if err = (&seaweedv1.Seaweed{}).SetupWebhookWithManager(mgr); err != nil {
setupLog.Error(err, "unable to create webhook", "webhook", "Seaweed") setupLog.Error(err, "unable to create webhook", "webhook", "Seaweed")
os.Exit(1) os.Exit(1)
} }
}
// +kubebuilder:scaffold:builder // +kubebuilder:scaffold:builder
setupLog.Info("starting manager") setupLog.Info("starting manager")