fix(leaderelection): nil check in OnStoppedLeading func

This commit is contained in:
googs1025 2024-10-04 00:21:42 +08:00
parent 1ef7d66879
commit c94baacfff

View File

@ -50,7 +50,9 @@ func RunWithLeaderElection(ctx context.Context, config *rest.Config, newRunnerFn
run(ctx, 1)
},
OnStoppedLeading: func() {
cancel()
if cancel != nil {
cancel()
}
},
}