Skip to content

Commit 7d7ce35

Browse files
committed
Allow disabling of webhooks via env variable
1 parent 7794f58 commit 7d7ce35

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

cmd/main.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,11 @@ func main() {
108108
setupLog.Error(err, "unable to create controller", "controller", "Pattern")
109109
os.Exit(1)
110110
}
111-
if err = (&gitopsv1alpha1.PatternValidator{}).SetupWebhookWithManager(mgr); err != nil {
112-
setupLog.Error(err, "unable to create webhook", "webhook", "Pattern")
113-
os.Exit(1)
111+
if os.Getenv("ENABLE_WEBHOOKS") != "false" {
112+
if err = (&gitopsv1alpha1.PatternValidator{}).SetupWebhookWithManager(mgr); err != nil {
113+
setupLog.Error(err, "unable to create webhook", "webhook", "Pattern")
114+
os.Exit(1)
115+
}
114116
}
115117
//+kubebuilder:scaffold:builder
116118

0 commit comments

Comments
 (0)