Skip to content

Commit

Permalink
Pass appropriate context to leaderelector.Run
Browse files Browse the repository at this point in the history
  • Loading branch information
mrkm4ntr committed Apr 15, 2019
1 parent 4276f38 commit 3f9a825
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion pkg/manager/internal.go
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,16 @@ func (cm *controllerManager) startLeaderElection() (err error) {
return err
}

ctx, cancel := context.WithCancel(context.Background())
go func() {
select {
case <-cm.internalStop:
cancel()
case <-ctx.Done():
}
}()

// Start the leader elector process
go l.Run(context.Background())
go l.Run(ctx)
return nil
}

0 comments on commit 3f9a825

Please sign in to comment.