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: acadf81c6832dc55e109bba729da71cd69247958
  • Loading branch information
zachomedia authored and k8s-publishing-bot committed Aug 3, 2019
1 parent fa0b9c6 commit b32de8e
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 @@ -290,8 +290,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 b32de8e

Please sign in to comment.