Add Lease implementation to leaderelection package#70778
Conversation
There was a problem hiding this comment.
this allows empty holder identity and zero lease duration in the record, which looks slightly odd. but stepping thru the elector, it will work fine i suppose.
There was a problem hiding this comment.
Hmm, I see that LeaseSpec went with microtime. It should be fine. We don't actually use it to implement correctness. Also metav1.MicroTime to metav1.Time is just:
time := metav1.Time{microTime.Time}
No need for this function.
There was a problem hiding this comment.
wow 👍 fixed in new patch
|
/cc @cheftako |
91f527d to
5da7a58
Compare
|
/test pull-kubernetes-e2e-kops-aws |
58a2b76 to
a041e47
Compare
|
cc @wojtek-t |
|
/assign |
| return ll.LockConfig.Identity | ||
| } | ||
|
|
||
| func LeaderElectionRecordToLeaseSpec(ler *LeaderElectionRecord) coordinationv1.LeaseSpec { |
There was a problem hiding this comment.
can't access from leaderelection/leaderelection_test.go otherwise, same as the new leaseSpecToLeaderElectionRecord
|
I'm generally happy with this. Had a couple suggestions. /approve |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: mikedanese, wongma7 The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
LGTM |
|
squashed, thank you |
|
/lgtm |
|
/retest |
1 similar comment
|
/retest |
|
@wongma7: The following test failed, say
Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
What type of PR is this?
/kind feature
What this PR does / why we need it: enables components to use coordination/Lease objects for leaderelection as opposed to endpoints/configmaps. e.g. https://github.com/kubernetes-csi/external-attacher (which doesn't need the configmap) and https://github.com/kubernetes-csi/external-provisioner/ (which is currently using endpoints (oops) and would like to move away)
Which issue(s) this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)format, will close the issue(s) when PR gets merged):Fixes #https://github.com/kubernetes/client-go/issues/499
Special notes for your reviewer: Don't know if this is wanted, I see the Lease object is used by kubelet but don't see it anywhere else. Created https://github.com/kubernetes/client-go/issues/499 & didn't get a response.
Does this PR introduce a user-facing change?: