main.go: Allow disabling of webhook
@@ -114,7 +114,7 @@ func main() {
flag.IntVar(&webhookPort,
"webhook-port",
9443,
- "Webhook server port",
+ "Webhook server port (set to 0 to disable)",
)
flag.Parse()
@@ -171,10 +171,13 @@ func main() {
setupLog.Error(err, "unable to create controller", "controller", "AWSCluster")
os.Exit(1)
}
+
+ if webhookPort != 0 {
if err = (&infrav1alpha3.AWSMachineTemplate{}).SetupWebhookWithManager(mgr); err != nil {
setupLog.Error(err, "unable to create webhook", "webhook", "AWSMachineTemplate")
os.Exit(1)
}
+ }
// +kubebuilder:scaffold:builder
setupLog.Info("starting manager")
