-
Notifications
You must be signed in to change notification settings - Fork 690
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cmd/contour: simplify leadership election setup #2348
Conversation
Updates projectcontour#403 Ingress status updates depend on leadership election. This PR moves leadership setup outside doServe and simplifies the interaction with EventHandler.IsLeader. Signed-off-by: Dave Cheney <[email protected]>
@jpeach I looked at moving this logic to |
Codecov Report
@@ Coverage Diff @@
## master #2348 +/- ##
==========================================
+ Coverage 77.96% 77.97% +0.01%
==========================================
Files 60 60
Lines 5205 5204 -1
==========================================
Hits 4058 4058
+ Misses 1059 1058 -1
Partials 88 88
Continue to review full report at Codecov.
|
// a channel which will become ready when this process becomes the leader, or, in the | ||
// event that leadership election is disabled, the channel will be ready immediately. | ||
func setupLeadershipElection(g *workgroup.Group, log logrus.FieldLogger, ctx *serveContext, clients *k8s.Clients, updateNow func()) chan struct{} { | ||
if ctx.DisableLeaderElection { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggest you pull this into a separate function becomeElectedLeader()
, then check ctx.DisableLeaderElection
from the caller.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Updates #403
Ingress status updates depend on leadership election. This PR moves
leadership setup outside doServe and simplifies the interaction with
EventHandler.IsLeader.
Signed-off-by: Dave Cheney [email protected]