Register reconcilers/webhooks if and only if webhookPort ==/!= 0
@@ -173,6 +173,7 @@ func main() {
// Initialize event recorder.
record.InitFromRecorder(mgr.GetEventRecorderFor("aws-controller"))
+ if webhookPort == 0 {
if err = (&controllers.AWSMachineReconciler{
Client: mgr.GetClient(),
Log: ctrl.Log.WithName("controllers").WithName("AWSMachine"),
@@ -189,8 +190,7 @@ func main() {
setupLog.Error(err, "unable to create controller", "controller", "AWSCluster")
os.Exit(1)
}
-
- if webhookPort != 0 {
+ } else {
if err = (&infrav1alpha3.AWSMachineTemplate{}).SetupWebhookWithManager(mgr); err != nil {
setupLog.Error(err, "unable to create webhook", "webhook", "AWSMachineTemplate")
os.Exit(1)
