Skip to content

Commit

Permalink
Generate complete leader election record to resolve leader election i…
Browse files Browse the repository at this point in the history
…ssues with LeaseLocks

Kubernetes-commit: dfa528ed0bd94cd603366d7a40fc880d4ab1af63
  • Loading branch information
zachomedia authored and k8s-publishing-bot committed Aug 3, 2019
1 parent 0716e81 commit 228a223
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion tools/leaderelection/leaderelection.go
Original file line number Diff line number Diff line change
Expand Up @@ -289,8 +289,12 @@ func (le *LeaderElector) release() bool {
if !le.IsLeader() {
return true
}
now := metav1.Now()
leaderElectionRecord := rl.LeaderElectionRecord{
LeaderTransitions: le.observedRecord.LeaderTransitions,
LeaderTransitions: le.observedRecord.LeaderTransitions,
LeaseDurationSeconds: 1,
RenewTime: now,
AcquireTime: now,
}
if err := le.config.Lock.Update(context.TODO(), leaderElectionRecord); err != nil {
klog.Errorf("Failed to release lock: %v", err)
Expand Down

0 comments on commit 228a223

Please sign in to comment.