{"action":"created","issue":{"url":"https://api.github.com/repos/kubernetes/kubernetes/issues/16830","labels_url":"https://api.github.com/repos/kubernetes/kubernetes/issues/16830/labels{/name}","comments_url":"https://api.github.com/repos/kubernetes/kubernetes/issues/16830/comments","events_url":"https://api.github.com/repos/kubernetes/kubernetes/issues/16830/events","html_url":"https://github.com/kubernetes/kubernetes/pull/16830","id":115191110,"number":16830,"title":"WIP: simple client library that implements leader election for a service","user":{"login":"mikedanese","id":1787169,"avatar_url":"https://avatars.githubusercontent.com/u/1787169?v=3","gravatar_id":"","url":"https://api.github.com/users/mikedanese","html_url":"https://github.com/mikedanese","followers_url":"https://api.github.com/users/mikedanese/followers","following_url":"https://api.github.com/users/mikedanese/following{/other_user}","gists_url":"https://api.github.com/users/mikedanese/gists{/gist_id}","starred_url":"https://api.github.com/users/mikedanese/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mikedanese/subscriptions","organizations_url":"https://api.github.com/users/mikedanese/orgs","repos_url":"https://api.github.com/users/mikedanese/repos","events_url":"https://api.github.com/users/mikedanese/events{/privacy}","received_events_url":"https://api.github.com/users/mikedanese/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/kubernetes/kubernetes/labels/area/HA","name":"area/HA","color":"bfd4f2"},{"url":"https://api.github.com/repos/kubernetes/kubernetes/labels/cla:%20yes","name":"cla: yes","color":"bfe5bf"},{"url":"https://api.github.com/repos/kubernetes/kubernetes/labels/size/L","name":"size/L","color":"ee9900"}],"state":"open","locked":false,"assignee":{"login":"mikedanese","id":1787169,"avatar_url":"https://avatars.githubusercontent.com/u/1787169?v=3","gravatar_id":"","url":"https://api.github.com/users/mikedanese","html_url":"https://github.com/mikedanese","followers_url":"https://api.github.com/users/mikedanese/followers","following_url":"https://api.github.com/users/mikedanese/following{/other_user}","gists_url":"https://api.github.com/users/mikedanese/gists{/gist_id}","starred_url":"https://api.github.com/users/mikedanese/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mikedanese/subscriptions","organizations_url":"https://api.github.com/users/mikedanese/orgs","repos_url":"https://api.github.com/users/mikedanese/repos","events_url":"https://api.github.com/users/mikedanese/events{/privacy}","received_events_url":"https://api.github.com/users/mikedanese/received_events","type":"User","site_admin":false},"milestone":null,"comments":32,"created_at":"2015-11-05T01:45:12Z","updated_at":"2015-11-22T18:45:08Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/kubernetes/kubernetes/pulls/16830","html_url":"https://github.com/kubernetes/kubernetes/pull/16830","diff_url":"https://github.com/kubernetes/kubernetes/pull/16830.diff","patch_url":"https://github.com/kubernetes/kubernetes/pull/16830.patch"},"body":"This client library helps to elect a leader for a service. It uses an annotation of the service's endpoints object to hold the leaderElectionRecord. Callbacks are triggered OnStartedLeading and OnStoppedLeading.\r\n\r\nThis is podmaster.go refactored into a library and adapted to use an endpoints annotation rather than an etcd key to store the leader record. Otherwise I've tried to keep the implementation as similar as possible.\r\n\r\nMy goal is to run controller-manager and scheduler self hosted, and update these components using a deployment object. \r\n\r\nTODO: unit, e2e tests\r\n\r\ncc @erictune @davidopp @brendandburns @bgrant0607 "},"comment":{"url":"https://api.github.com/repos/kubernetes/kubernetes/issues/comments/158788063","html_url":"https://github.com/kubernetes/kubernetes/pull/16830#issuecomment-158788063","issue_url":"https://api.github.com/repos/kubernetes/kubernetes/issues/16830","id":158788063,"user":{"login":"mikedanese","id":1787169,"avatar_url":"https://avatars.githubusercontent.com/u/1787169?v=3","gravatar_id":"","url":"https://api.github.com/users/mikedanese","html_url":"https://github.com/mikedanese","followers_url":"https://api.github.com/users/mikedanese/followers","following_url":"https://api.github.com/users/mikedanese/following{/other_user}","gists_url":"https://api.github.com/users/mikedanese/gists{/gist_id}","starred_url":"https://api.github.com/users/mikedanese/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mikedanese/subscriptions","organizations_url":"https://api.github.com/users/mikedanese/orgs","repos_url":"https://api.github.com/users/mikedanese/repos","events_url":"https://api.github.com/users/mikedanese/events{/privacy}","received_events_url":"https://api.github.com/users/mikedanese/received_events","type":"User","site_admin":false},"created_at":"2015-11-22T18:45:07Z","updated_at":"2015-11-22T18:45:07Z","body":"> have a time buffer between \"process 1 stop being master\" and \"process 2 start being master\" signal;\r\n\r\nThis is definitely just a safety net. Is it worth including?\r\n\r\n> not care about being master\r\n\r\nProbably the best option for now.\r\n\r\n> make commiting a write and checking mastership part of a single atomic operation.\r\n\r\nMasters need to commit across types. This will prevent sharding our data layer. I don't think we want to lock ourselves into that yet.\r\n\r\nWe could implement cert rotation where only the master is allowed to write. Still eventually consistent but we could probably make cutover quick in practice. I don't think we need it right now though."}}