Skip to content
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

leader election: a records's observedTime is checked instead of an actual timestamp #448

Closed
kdomanski opened this issue Aug 8, 2018 · 3 comments
Assignees

Comments

@kdomanski
Copy link

in https://github.com/kubernetes/client-go/blob/master/tools/leaderelection/leaderelection.go#L269 the client makes sure that at least LeaseDuration has expired since the election record is observed and the leader doesn't renew the lease in this time.

However this means that the client will always wait at least LeaseDuration on startup, since observedTime is only ever set to time.Now() and the actual age of the record is irrelevant.

The client should instead take the record's AcquireTime and RenewTime under consideration when waiting for hearbeat, and thus instantly acquire the lease if the last record is already expired.

@liggitt
Copy link
Member

liggitt commented Aug 8, 2018

I don't think this is correct. The recorded times are more for debugging and observability. Using them instead of observed time would make us vulnerable to clock skew.

@liggitt
Copy link
Member

liggitt commented Aug 8, 2018

cc @wojtek-t @mtaufen

@liggitt
Copy link
Member

liggitt commented Aug 8, 2018

see discussion in the formalization of the Lease API - kubernetes/kubernetes#64246 (comment)

/close

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants