Skip to content

Commit e437f57

Browse files
authored
fix: Do not require leader election for CAPI hooks server (#150)
This means it will always run even if there are multiple replicas running. Leader election is only really useful for controllers, not for webhooks.
1 parent 14347de commit e437f57

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

common/pkg/server/server.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,12 @@ func (s *ServerOptions) AddFlags(fs *pflag.FlagSet) {
5858
)
5959
}
6060

61+
// NeedLeaderElection implements the LeaderElectionRunnable interface, which indicates
62+
// the webhook server doesn't need leader election.
63+
func (*Server) NeedLeaderElection() bool {
64+
return false
65+
}
66+
6167
func (s *Server) Start(ctx context.Context) error {
6268
// Creates a logger to be used during the main func.
6369
setupLog := ctrl.Log.WithName("runtimehooks")

0 commit comments

Comments
 (0)