@@ -96,8 +96,10 @@ func New(ctx context.Context, restCfg *rest.Config, svrCfg *ec.Server, resources
9696 Scheme : envoygateway .GetScheme (),
9797 Logger : svrCfg .Logger .Logger ,
9898 HealthProbeBindAddress : healthProbeBindAddress ,
99+ LeaderElection : false ,
99100 LeaderElectionID : "5b9825d2.gateway.envoyproxy.io" ,
100101 LeaderElectionNamespace : svrCfg .ControllerNamespace ,
102+ Controller : config.Controller {NeedLeaderElection : ptr .To (false )},
101103 }
102104
103105 log .SetLogger (mgrOpts .Logger )
@@ -107,6 +109,9 @@ func New(ctx context.Context, restCfg *rest.Config, svrCfg *ec.Server, resources
107109
108110 if ! ptr .Deref (svrCfg .EnvoyGateway .Provider .Kubernetes .LeaderElection .Disable , false ) {
109111 mgrOpts .LeaderElection = true
112+ mgrOpts .Controller .NeedLeaderElection = ptr .To (true )
113+ mgrOpts .Controller .EnableWarmup = ptr .To (true )
114+
110115 if svrCfg .EnvoyGateway .Provider .Kubernetes .LeaderElection .LeaseDuration != nil {
111116 ld , err := time .ParseDuration (string (* svrCfg .EnvoyGateway .Provider .Kubernetes .LeaderElection .LeaseDuration ))
112117 if err != nil {
@@ -130,7 +135,6 @@ func New(ctx context.Context, restCfg *rest.Config, svrCfg *ec.Server, resources
130135 }
131136 mgrOpts .RenewDeadline = ptr .To (rd )
132137 }
133- mgrOpts .Controller = config.Controller {NeedLeaderElection : ptr .To (false )}
134138 }
135139
136140 if svrCfg .EnvoyGateway .Provider .Kubernetes .CacheSyncPeriod != nil {
0 commit comments