Skip to content

Commit

Permalink
Merge pull request #398 from mrkm4ntr/leaderelector-context
Browse files Browse the repository at this point in the history
馃悰Pass appropriate context to leaderelector.Run
  • Loading branch information
k8s-ci-robot committed Jun 7, 2019
2 parents d708e3d + 3f9a825 commit 056a18a
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 @@ -361,7 +361,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 056a18a

Please sign in to comment.