{"action":"created","comment":{"url":"https://api.github.com/repos/kinvolk/habitat-operator/pulls/comments/133150010","pull_request_review_id":56297643,"id":133150010,"diff_hunk":"@@ -356,21 +369,27 @@ func (hc *HabitatController) writeIP(pod *apiv1.Pod) error {\n \tif err != nil {\n \t\treturn err\n \t}\n-\toldIP := cm.Data[peerFile]\n-\tif oldIP != \"\" {\n-\t\t// Do not overwrite IP with itself.\n-\t\tif ip == oldIP {\n+\n+\tcurrentLeaderIP := cm.Data[peerFile]\n+\tif currentLeaderIP != \"\" {\n+\t\tif ip == currentLeaderIP {\n \t\t\treturn nil\n \t\t}\n-\t\tpodList, err := hc.config.KubernetesClientset.CoreV1().Pods(apiv1.NamespaceDefault).List(metav1.ListOptions{})\n+\n+\t\t// Is the leader still running?\n+\t\t// If so, we don't need to do anything.\n+\t\tfs := fields.SelectorFromSet(fields.Set{\n+\t\t\t\"status.podIP\": currentLeaderIP,","path":"pkg/habitat/controller/controller.go","position":120,"original_position":120,"commit_id":"cc0075a5b10fc6b08e773fd326d034e966bbe29c","original_commit_id":"cc0075a5b10fc6b08e773fd326d034e966bbe29c","user":{"login":"asymmetric","id":101816,"avatar_url":"https://avatars1.githubusercontent.com/u/101816?v=4","gravatar_id":"","url":"https://api.github.com/users/asymmetric","html_url":"https://github.com/asymmetric","followers_url":"https://api.github.com/users/asymmetric/followers","following_url":"https://api.github.com/users/asymmetric/following{/other_user}","gists_url":"https://api.github.com/users/asymmetric/gists{/gist_id}","starred_url":"https://api.github.com/users/asymmetric/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/asymmetric/subscriptions","organizations_url":"https://api.github.com/users/asymmetric/orgs","repos_url":"https://api.github.com/users/asymmetric/repos","events_url":"https://api.github.com/users/asymmetric/events{/privacy}","received_events_url":"https://api.github.com/users/asymmetric/received_events","type":"User","site_admin":false},"body":"I'd say we can then wait for 1.7.4 to be released, which will hopefully fix this.","created_at":"2017-08-15T09:24:58Z","updated_at":"2017-08-15T09:24:58Z","html_url":"https://github.com/kinvolk/habitat-operator/pull/48#discussion_r133150010","pull_request_url":"https://api.github.com/repos/kinvolk/habitat-operator/pulls/48","_links":{"self":{"href":"https://api.github.com/repos/kinvolk/habitat-operator/pulls/comments/133150010"},"html":{"href":"https://github.com/kinvolk/habitat-operator/pull/48#discussion_r133150010"},"pull_request":{"href":"https://api.github.com/repos/kinvolk/habitat-operator/pulls/48"}}},"pull_request":{"url":"https://api.github.com/repos/kinvolk/habitat-operator/pulls/48","id":135625193,"html_url":"https://github.com/kinvolk/habitat-operator/pull/48","diff_url":"https://github.com/kinvolk/habitat-operator/pull/48.diff","patch_url":"https://github.com/kinvolk/habitat-operator/pull/48.patch","issue_url":"https://api.github.com/repos/kinvolk/habitat-operator/issues/48","number":48,"state":"open","locked":false,"title":"Simplify Leader IP handling","user":{"login":"asymmetric","id":101816,"avatar_url":"https://avatars1.githubusercontent.com/u/101816?v=4","gravatar_id":"","url":"https://api.github.com/users/asymmetric","html_url":"https://github.com/asymmetric","followers_url":"https://api.github.com/users/asymmetric/followers","following_url":"https://api.github.com/users/asymmetric/following{/other_user}","gists_url":"https://api.github.com/users/asymmetric/gists{/gist_id}","starred_url":"https://api.github.com/users/asymmetric/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/asymmetric/subscriptions","organizations_url":"https://api.github.com/users/asymmetric/orgs","repos_url":"https://api.github.com/users/asymmetric/repos","events_url":"https://api.github.com/users/asymmetric/events{/privacy}","received_events_url":"https://api.github.com/users/asymmetric/received_events","type":"User","site_admin":false},"body":"This PR simplifies the way we deal with the Leader IP file.\r\n\r\nWe can find out if the current leader is running using field selectors. This way, we only need to check if the length of the returned list of Pods is > 0, to know whether we need to do anything.\r\n\r\nThe PR also removes additional checks for the Pod status that are unnecessary since we already use fields to filter.","created_at":"2017-08-14T15:38:31Z","updated_at":"2017-08-15T09:24:58Z","closed_at":null,"merged_at":null,"merge_commit_sha":"4276b7d5d6aa308e2b074946ead55ad0885324db","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/kinvolk/habitat-operator/pulls/48/commits","review_comments_url":"https://api.github.com/repos/kinvolk/habitat-operator/pulls/48/comments","review_comment_url":"https://api.github.com/repos/kinvolk/habitat-operator/pulls/comments{/number}","comments_url":"https://api.github.com/repos/kinvolk/habitat-operator/issues/48/comments","statuses_url":"https://api.github.com/repos/kinvolk/habitat-operator/statuses/cc0075a5b10fc6b08e773fd326d034e966bbe29c","head":{"label":"kinvolk:asymmetric/leader-ip","ref":"asymmetric/leader-ip","sha":"cc0075a5b10fc6b08e773fd326d034e966bbe29c","user":{"login":"kinvolk","id":14073052,"avatar_url":"https://avatars0.githubusercontent.com/u/14073052?v=4","gravatar_id":"","url":"https://api.github.com/users/kinvolk","html_url":"https://github.com/kinvolk","followers_url":"https://api.github.com/users/kinvolk/followers","following_url":"https://api.github.com/users/kinvolk/following{/other_user}","gists_url":"https://api.github.com/users/kinvolk/gists{/gist_id}","starred_url":"https://api.github.com/users/kinvolk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kinvolk/subscriptions","organizations_url":"https://api.github.com/users/kinvolk/orgs","repos_url":"https://api.github.com/users/kinvolk/repos","events_url":"https://api.github.com/users/kinvolk/events{/privacy}","received_events_url":"https://api.github.com/users/kinvolk/received_events","type":"Organization","site_admin":false},"repo":{"id":97232904,"name":"habitat-operator","full_name":"kinvolk/habitat-operator","owner":{"login":"kinvolk","id":14073052,"avatar_url":"https://avatars0.githubusercontent.com/u/14073052?v=4","gravatar_id":"","url":"https://api.github.com/users/kinvolk","html_url":"https://github.com/kinvolk","followers_url":"https://api.github.com/users/kinvolk/followers","following_url":"https://api.github.com/users/kinvolk/following{/other_user}","gists_url":"https://api.github.com/users/kinvolk/gists{/gist_id}","starred_url":"https://api.github.com/users/kinvolk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kinvolk/subscriptions","organizations_url":"https://api.github.com/users/kinvolk/orgs","repos_url":"https://api.github.com/users/kinvolk/repos","events_url":"https://api.github.com/users/kinvolk/events{/privacy}","received_events_url":"https://api.github.com/users/kinvolk/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/kinvolk/habitat-operator","description":"A Kubernetes operator for Habitat services","fork":false,"url":"https://api.github.com/repos/kinvolk/habitat-operator","forks_url":"https://api.github.com/repos/kinvolk/habitat-operator/forks","keys_url":"https://api.github.com/repos/kinvolk/habitat-operator/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kinvolk/habitat-operator/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kinvolk/habitat-operator/teams","hooks_url":"https://api.github.com/repos/kinvolk/habitat-operator/hooks","issue_events_url":"https://api.github.com/repos/kinvolk/habitat-operator/issues/events{/number}","events_url":"https://api.github.com/repos/kinvolk/habitat-operator/events","assignees_url":"https://api.github.com/repos/kinvolk/habitat-operator/assignees{/user}","branches_url":"https://api.github.com/repos/kinvolk/habitat-operator/branches{/branch}","tags_url":"https://api.github.com/repos/kinvolk/habitat-operator/tags","blobs_url":"https://api.github.com/repos/kinvolk/habitat-operator/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kinvolk/habitat-operator/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kinvolk/habitat-operator/git/refs{/sha}","trees_url":"https://api.github.com/repos/kinvolk/habitat-operator/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kinvolk/habitat-operator/statuses/{sha}","languages_url":"https://api.github.com/repos/kinvolk/habitat-operator/languages","stargazers_url":"https://api.github.com/repos/kinvolk/habitat-operator/stargazers","contributors_url":"https://api.github.com/repos/kinvolk/habitat-operator/contributors","subscribers_url":"https://api.github.com/repos/kinvolk/habitat-operator/subscribers","subscription_url":"https://api.github.com/repos/kinvolk/habitat-operator/subscription","commits_url":"https://api.github.com/repos/kinvolk/habitat-operator/commits{/sha}","git_commits_url":"https://api.github.com/repos/kinvolk/habitat-operator/git/commits{/sha}","comments_url":"https://api.github.com/repos/kinvolk/habitat-operator/comments{/number}","issue_comment_url":"https://api.github.com/repos/kinvolk/habitat-operator/issues/comments{/number}","contents_url":"https://api.github.com/repos/kinvolk/habitat-operator/contents/{+path}","compare_url":"https://api.github.com/repos/kinvolk/habitat-operator/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kinvolk/habitat-operator/merges","archive_url":"https://api.github.com/repos/kinvolk/habitat-operator/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kinvolk/habitat-operator/downloads","issues_url":"https://api.github.com/repos/kinvolk/habitat-operator/issues{/number}","pulls_url":"https://api.github.com/repos/kinvolk/habitat-operator/pulls{/number}","milestones_url":"https://api.github.com/repos/kinvolk/habitat-operator/milestones{/number}","notifications_url":"https://api.github.com/repos/kinvolk/habitat-operator/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kinvolk/habitat-operator/labels{/name}","releases_url":"https://api.github.com/repos/kinvolk/habitat-operator/releases{/id}","deployments_url":"https://api.github.com/repos/kinvolk/habitat-operator/deployments","created_at":"2017-07-14T12:45:30Z","updated_at":"2017-08-11T06:15:49Z","pushed_at":"2017-08-15T09:19:12Z","git_url":"git://github.com/kinvolk/habitat-operator.git","ssh_url":"git@github.com:kinvolk/habitat-operator.git","clone_url":"https://github.com/kinvolk/habitat-operator.git","svn_url":"https://github.com/kinvolk/habitat-operator","homepage":null,"size":12162,"stargazers_count":8,"watchers_count":8,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":15,"forks":1,"open_issues":15,"watchers":8,"default_branch":"master"}},"base":{"label":"kinvolk:master","ref":"master","sha":"54a2a51c7b83384d12e4008d7bba8ea036246acc","user":{"login":"kinvolk","id":14073052,"avatar_url":"https://avatars0.githubusercontent.com/u/14073052?v=4","gravatar_id":"","url":"https://api.github.com/users/kinvolk","html_url":"https://github.com/kinvolk","followers_url":"https://api.github.com/users/kinvolk/followers","following_url":"https://api.github.com/users/kinvolk/following{/other_user}","gists_url":"https://api.github.com/users/kinvolk/gists{/gist_id}","starred_url":"https://api.github.com/users/kinvolk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kinvolk/subscriptions","organizations_url":"https://api.github.com/users/kinvolk/orgs","repos_url":"https://api.github.com/users/kinvolk/repos","events_url":"https://api.github.com/users/kinvolk/events{/privacy}","received_events_url":"https://api.github.com/users/kinvolk/received_events","type":"Organization","site_admin":false},"repo":{"id":97232904,"name":"habitat-operator","full_name":"kinvolk/habitat-operator","owner":{"login":"kinvolk","id":14073052,"avatar_url":"https://avatars0.githubusercontent.com/u/14073052?v=4","gravatar_id":"","url":"https://api.github.com/users/kinvolk","html_url":"https://github.com/kinvolk","followers_url":"https://api.github.com/users/kinvolk/followers","following_url":"https://api.github.com/users/kinvolk/following{/other_user}","gists_url":"https://api.github.com/users/kinvolk/gists{/gist_id}","starred_url":"https://api.github.com/users/kinvolk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kinvolk/subscriptions","organizations_url":"https://api.github.com/users/kinvolk/orgs","repos_url":"https://api.github.com/users/kinvolk/repos","events_url":"https://api.github.com/users/kinvolk/events{/privacy}","received_events_url":"https://api.github.com/users/kinvolk/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/kinvolk/habitat-operator","description":"A Kubernetes operator for Habitat services","fork":false,"url":"https://api.github.com/repos/kinvolk/habitat-operator","forks_url":"https://api.github.com/repos/kinvolk/habitat-operator/forks","keys_url":"https://api.github.com/repos/kinvolk/habitat-operator/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kinvolk/habitat-operator/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kinvolk/habitat-operator/teams","hooks_url":"https://api.github.com/repos/kinvolk/habitat-operator/hooks","issue_events_url":"https://api.github.com/repos/kinvolk/habitat-operator/issues/events{/number}","events_url":"https://api.github.com/repos/kinvolk/habitat-operator/events","assignees_url":"https://api.github.com/repos/kinvolk/habitat-operator/assignees{/user}","branches_url":"https://api.github.com/repos/kinvolk/habitat-operator/branches{/branch}","tags_url":"https://api.github.com/repos/kinvolk/habitat-operator/tags","blobs_url":"https://api.github.com/repos/kinvolk/habitat-operator/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kinvolk/habitat-operator/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kinvolk/habitat-operator/git/refs{/sha}","trees_url":"https://api.github.com/repos/kinvolk/habitat-operator/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kinvolk/habitat-operator/statuses/{sha}","languages_url":"https://api.github.com/repos/kinvolk/habitat-operator/languages","stargazers_url":"https://api.github.com/repos/kinvolk/habitat-operator/stargazers","contributors_url":"https://api.github.com/repos/kinvolk/habitat-operator/contributors","subscribers_url":"https://api.github.com/repos/kinvolk/habitat-operator/subscribers","subscription_url":"https://api.github.com/repos/kinvolk/habitat-operator/subscription","commits_url":"https://api.github.com/repos/kinvolk/habitat-operator/commits{/sha}","git_commits_url":"https://api.github.com/repos/kinvolk/habitat-operator/git/commits{/sha}","comments_url":"https://api.github.com/repos/kinvolk/habitat-operator/comments{/number}","issue_comment_url":"https://api.github.com/repos/kinvolk/habitat-operator/issues/comments{/number}","contents_url":"https://api.github.com/repos/kinvolk/habitat-operator/contents/{+path}","compare_url":"https://api.github.com/repos/kinvolk/habitat-operator/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kinvolk/habitat-operator/merges","archive_url":"https://api.github.com/repos/kinvolk/habitat-operator/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kinvolk/habitat-operator/downloads","issues_url":"https://api.github.com/repos/kinvolk/habitat-operator/issues{/number}","pulls_url":"https://api.github.com/repos/kinvolk/habitat-operator/pulls{/number}","milestones_url":"https://api.github.com/repos/kinvolk/habitat-operator/milestones{/number}","notifications_url":"https://api.github.com/repos/kinvolk/habitat-operator/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kinvolk/habitat-operator/labels{/name}","releases_url":"https://api.github.com/repos/kinvolk/habitat-operator/releases{/id}","deployments_url":"https://api.github.com/repos/kinvolk/habitat-operator/deployments","created_at":"2017-07-14T12:45:30Z","updated_at":"2017-08-11T06:15:49Z","pushed_at":"2017-08-15T09:19:12Z","git_url":"git://github.com/kinvolk/habitat-operator.git","ssh_url":"git@github.com:kinvolk/habitat-operator.git","clone_url":"https://github.com/kinvolk/habitat-operator.git","svn_url":"https://github.com/kinvolk/habitat-operator","homepage":null,"size":12162,"stargazers_count":8,"watchers_count":8,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":15,"forks":1,"open_issues":15,"watchers":8,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/kinvolk/habitat-operator/pulls/48"},"html":{"href":"https://github.com/kinvolk/habitat-operator/pull/48"},"issue":{"href":"https://api.github.com/repos/kinvolk/habitat-operator/issues/48"},"comments":{"href":"https://api.github.com/repos/kinvolk/habitat-operator/issues/48/comments"},"review_comments":{"href":"https://api.github.com/repos/kinvolk/habitat-operator/pulls/48/comments"},"review_comment":{"href":"https://api.github.com/repos/kinvolk/habitat-operator/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/kinvolk/habitat-operator/pulls/48/commits"},"statuses":{"href":"https://api.github.com/repos/kinvolk/habitat-operator/statuses/cc0075a5b10fc6b08e773fd326d034e966bbe29c"}}}}
{"actor":{"display_login":"asymmetric"}}