{"action":"created","comment":{"url":"https://api.github.com/repos/turbonomic/kubeturbo/pulls/comments/178646643","pull_request_review_id":108738072,"id":178646643,"diff_hunk":"@@ -187,6 +187,27 @@ func TestGetReadyPods(t *testing.T) {\n \t}\n }\n \n+func TestMonitored(t *testing.T) {\n+\tpod := newPod(\"pod-foo\")\n+\tpod.Annotations = map[string]string{\n+\t\t\"kubernetes.io/created-by\": `{\"reference\":{\"kind\":\"DaemonSet\",\"name\":\"daemon-set-foo\"}}`,\n+\t}\n+\n+\tpodWithOwnerRef := pod\n+\tisController := true\n+\tpodWithOwnerRef.OwnerReferences = []metav1.OwnerReference{{Kind: \"DaemonSet\", Name: \"daemon-set-foo\", Controller: &isController}}\n+\n+\t// Without Owner reference\n+\tif Monitored(pod) {\n+\t\tt.Errorf(\"The pod in DaemonSet shouldn't be monitored\")\n+\t}\n+\n+\t// With Owner reference\n+\tif Monitored(podWithOwnerRef) {","path":"pkg/discovery/util/pod_util_test.go","position":20,"original_position":20,"commit_id":"02389d1eae629b19e203cd3e9e7e18aceb6a14a1","original_commit_id":"02389d1eae629b19e203cd3e9e7e18aceb6a14a1","user":{"login":"songbinliu","id":27221807,"avatar_url":"https://avatars2.githubusercontent.com/u/27221807?v=4","gravatar_id":"","url":"https://api.github.com/users/songbinliu","html_url":"https://github.com/songbinliu","followers_url":"https://api.github.com/users/songbinliu/followers","following_url":"https://api.github.com/users/songbinliu/following{/other_user}","gists_url":"https://api.github.com/users/songbinliu/gists{/gist_id}","starred_url":"https://api.github.com/users/songbinliu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/songbinliu/subscriptions","organizations_url":"https://api.github.com/users/songbinliu/orgs","repos_url":"https://api.github.com/users/songbinliu/repos","events_url":"https://api.github.com/users/songbinliu/events{/privacy}","received_events_url":"https://api.github.com/users/songbinliu/received_events","type":"User","site_admin":false},"body":"`podWithOwnerRef` has the same `Annotations` as `pod` does.  If the plan is to test the case that Pod with `OwnerReference`, then the annotations should be cleared first.\r\n","created_at":"2018-04-02T20:50:03Z","updated_at":"2018-04-02T20:50:03Z","html_url":"https://github.com/turbonomic/kubeturbo/pull/172#discussion_r178646643","pull_request_url":"https://api.github.com/repos/turbonomic/kubeturbo/pulls/172","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/turbonomic/kubeturbo/pulls/comments/178646643"},"html":{"href":"https://github.com/turbonomic/kubeturbo/pull/172#discussion_r178646643"},"pull_request":{"href":"https://api.github.com/repos/turbonomic/kubeturbo/pulls/172"}}},"pull_request":{"url":"https://api.github.com/repos/turbonomic/kubeturbo/pulls/172","id":178899528,"html_url":"https://github.com/turbonomic/kubeturbo/pull/172","diff_url":"https://github.com/turbonomic/kubeturbo/pull/172.diff","patch_url":"https://github.com/turbonomic/kubeturbo/pull/172.patch","issue_url":"https://api.github.com/repos/turbonomic/kubeturbo/issues/172","number":172,"state":"open","locked":false,"title":"Fix DaemonSet pods as monitored issue","user":{"login":"maxwangvmt","id":12261551,"avatar_url":"https://avatars3.githubusercontent.com/u/12261551?v=4","gravatar_id":"","url":"https://api.github.com/users/maxwangvmt","html_url":"https://github.com/maxwangvmt","followers_url":"https://api.github.com/users/maxwangvmt/followers","following_url":"https://api.github.com/users/maxwangvmt/following{/other_user}","gists_url":"https://api.github.com/users/maxwangvmt/gists{/gist_id}","starred_url":"https://api.github.com/users/maxwangvmt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/maxwangvmt/subscriptions","organizations_url":"https://api.github.com/users/maxwangvmt/orgs","repos_url":"https://api.github.com/users/maxwangvmt/repos","events_url":"https://api.github.com/users/maxwangvmt/events{/privacy}","received_events_url":"https://api.github.com/users/maxwangvmt/received_events","type":"User","site_admin":false},"body":"In some pods of DaemonSet, they are set to be monitored if they don't have the \"createdBy\" annotation. This is undesired since we don't want to monitor those pods.\r\n\r\nWe already have right logic to check the controller info using \"OwnerReference\" object associated to pods in addition to the annotation check. The fix here is to cleanup the duplicate logic and keep the desired one to check pods' controller info. Hence, it can correct detect DaemonSet pods and set them as not monitored.\r\n\r\nMost code change here is to move around the related functions for getting parent controller info.","created_at":"2018-04-02T18:35:25Z","updated_at":"2018-04-02T20:50:03Z","closed_at":null,"merged_at":null,"merge_commit_sha":"fbbe64c8259fc00e18677e7746dfe76fbf5265a5","assignee":null,"assignees":[],"requested_reviewers":[{"login":"enlinxu","id":4391815,"avatar_url":"https://avatars1.githubusercontent.com/u/4391815?v=4","gravatar_id":"","url":"https://api.github.com/users/enlinxu","html_url":"https://github.com/enlinxu","followers_url":"https://api.github.com/users/enlinxu/followers","following_url":"https://api.github.com/users/enlinxu/following{/other_user}","gists_url":"https://api.github.com/users/enlinxu/gists{/gist_id}","starred_url":"https://api.github.com/users/enlinxu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/enlinxu/subscriptions","organizations_url":"https://api.github.com/users/enlinxu/orgs","repos_url":"https://api.github.com/users/enlinxu/repos","events_url":"https://api.github.com/users/enlinxu/events{/privacy}","received_events_url":"https://api.github.com/users/enlinxu/received_events","type":"User","site_admin":false},{"login":"pallavidn","id":11964436,"avatar_url":"https://avatars0.githubusercontent.com/u/11964436?v=4","gravatar_id":"","url":"https://api.github.com/users/pallavidn","html_url":"https://github.com/pallavidn","followers_url":"https://api.github.com/users/pallavidn/followers","following_url":"https://api.github.com/users/pallavidn/following{/other_user}","gists_url":"https://api.github.com/users/pallavidn/gists{/gist_id}","starred_url":"https://api.github.com/users/pallavidn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pallavidn/subscriptions","organizations_url":"https://api.github.com/users/pallavidn/orgs","repos_url":"https://api.github.com/users/pallavidn/repos","events_url":"https://api.github.com/users/pallavidn/events{/privacy}","received_events_url":"https://api.github.com/users/pallavidn/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/turbonomic/kubeturbo/pulls/172/commits","review_comments_url":"https://api.github.com/repos/turbonomic/kubeturbo/pulls/172/comments","review_comment_url":"https://api.github.com/repos/turbonomic/kubeturbo/pulls/comments{/number}","comments_url":"https://api.github.com/repos/turbonomic/kubeturbo/issues/172/comments","statuses_url":"https://api.github.com/repos/turbonomic/kubeturbo/statuses/02389d1eae629b19e203cd3e9e7e18aceb6a14a1","head":{"label":"maxwangvmt:daemonset-not-monitor","ref":"daemonset-not-monitor","sha":"02389d1eae629b19e203cd3e9e7e18aceb6a14a1","user":{"login":"maxwangvmt","id":12261551,"avatar_url":"https://avatars3.githubusercontent.com/u/12261551?v=4","gravatar_id":"","url":"https://api.github.com/users/maxwangvmt","html_url":"https://github.com/maxwangvmt","followers_url":"https://api.github.com/users/maxwangvmt/followers","following_url":"https://api.github.com/users/maxwangvmt/following{/other_user}","gists_url":"https://api.github.com/users/maxwangvmt/gists{/gist_id}","starred_url":"https://api.github.com/users/maxwangvmt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/maxwangvmt/subscriptions","organizations_url":"https://api.github.com/users/maxwangvmt/orgs","repos_url":"https://api.github.com/users/maxwangvmt/repos","events_url":"https://api.github.com/users/maxwangvmt/events{/privacy}","received_events_url":"https://api.github.com/users/maxwangvmt/received_events","type":"User","site_admin":false},"repo":{"id":105817519,"name":"kubeturbo","full_name":"maxwangvmt/kubeturbo","owner":{"login":"maxwangvmt","id":12261551,"avatar_url":"https://avatars3.githubusercontent.com/u/12261551?v=4","gravatar_id":"","url":"https://api.github.com/users/maxwangvmt","html_url":"https://github.com/maxwangvmt","followers_url":"https://api.github.com/users/maxwangvmt/followers","following_url":"https://api.github.com/users/maxwangvmt/following{/other_user}","gists_url":"https://api.github.com/users/maxwangvmt/gists{/gist_id}","starred_url":"https://api.github.com/users/maxwangvmt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/maxwangvmt/subscriptions","organizations_url":"https://api.github.com/users/maxwangvmt/orgs","repos_url":"https://api.github.com/users/maxwangvmt/repos","events_url":"https://api.github.com/users/maxwangvmt/events{/privacy}","received_events_url":"https://api.github.com/users/maxwangvmt/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/maxwangvmt/kubeturbo","description":null,"fork":true,"url":"https://api.github.com/repos/maxwangvmt/kubeturbo","forks_url":"https://api.github.com/repos/maxwangvmt/kubeturbo/forks","keys_url":"https://api.github.com/repos/maxwangvmt/kubeturbo/keys{/key_id}","collaborators_url":"https://api.github.com/repos/maxwangvmt/kubeturbo/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/maxwangvmt/kubeturbo/teams","hooks_url":"https://api.github.com/repos/maxwangvmt/kubeturbo/hooks","issue_events_url":"https://api.github.com/repos/maxwangvmt/kubeturbo/issues/events{/number}","events_url":"https://api.github.com/repos/maxwangvmt/kubeturbo/events","assignees_url":"https://api.github.com/repos/maxwangvmt/kubeturbo/assignees{/user}","branches_url":"https://api.github.com/repos/maxwangvmt/kubeturbo/branches{/branch}","tags_url":"https://api.github.com/repos/maxwangvmt/kubeturbo/tags","blobs_url":"https://api.github.com/repos/maxwangvmt/kubeturbo/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/maxwangvmt/kubeturbo/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/maxwangvmt/kubeturbo/git/refs{/sha}","trees_url":"https://api.github.com/repos/maxwangvmt/kubeturbo/git/trees{/sha}","statuses_url":"https://api.github.com/repos/maxwangvmt/kubeturbo/statuses/{sha}","languages_url":"https://api.github.com/repos/maxwangvmt/kubeturbo/languages","stargazers_url":"https://api.github.com/repos/maxwangvmt/kubeturbo/stargazers","contributors_url":"https://api.github.com/repos/maxwangvmt/kubeturbo/contributors","subscribers_url":"https://api.github.com/repos/maxwangvmt/kubeturbo/subscribers","subscription_url":"https://api.github.com/repos/maxwangvmt/kubeturbo/subscription","commits_url":"https://api.github.com/repos/maxwangvmt/kubeturbo/commits{/sha}","git_commits_url":"https://api.github.com/repos/maxwangvmt/kubeturbo/git/commits{/sha}","comments_url":"https://api.github.com/repos/maxwangvmt/kubeturbo/comments{/number}","issue_comment_url":"https://api.github.com/repos/maxwangvmt/kubeturbo/issues/comments{/number}","contents_url":"https://api.github.com/repos/maxwangvmt/kubeturbo/contents/{+path}","compare_url":"https://api.github.com/repos/maxwangvmt/kubeturbo/compare/{base}...{head}","merges_url":"https://api.github.com/repos/maxwangvmt/kubeturbo/merges","archive_url":"https://api.github.com/repos/maxwangvmt/kubeturbo/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/maxwangvmt/kubeturbo/downloads","issues_url":"https://api.github.com/repos/maxwangvmt/kubeturbo/issues{/number}","pulls_url":"https://api.github.com/repos/maxwangvmt/kubeturbo/pulls{/number}","milestones_url":"https://api.github.com/repos/maxwangvmt/kubeturbo/milestones{/number}","notifications_url":"https://api.github.com/repos/maxwangvmt/kubeturbo/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/maxwangvmt/kubeturbo/labels{/name}","releases_url":"https://api.github.com/repos/maxwangvmt/kubeturbo/releases{/id}","deployments_url":"https://api.github.com/repos/maxwangvmt/kubeturbo/deployments","created_at":"2017-10-04T20:55:59Z","updated_at":"2018-03-29T15:40:15Z","pushed_at":"2018-04-02T19:19:56Z","git_url":"git://github.com/maxwangvmt/kubeturbo.git","ssh_url":"git@github.com:maxwangvmt/kubeturbo.git","clone_url":"https://github.com/maxwangvmt/kubeturbo.git","svn_url":"https://github.com/maxwangvmt/kubeturbo","homepage":null,"size":58062,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":null,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"turbonomic:master","ref":"master","sha":"4fb731a9b4aae7c2b8b852e22077d5d8260abcb8","user":{"login":"turbonomic","id":20601535,"avatar_url":"https://avatars3.githubusercontent.com/u/20601535?v=4","gravatar_id":"","url":"https://api.github.com/users/turbonomic","html_url":"https://github.com/turbonomic","followers_url":"https://api.github.com/users/turbonomic/followers","following_url":"https://api.github.com/users/turbonomic/following{/other_user}","gists_url":"https://api.github.com/users/turbonomic/gists{/gist_id}","starred_url":"https://api.github.com/users/turbonomic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/turbonomic/subscriptions","organizations_url":"https://api.github.com/users/turbonomic/orgs","repos_url":"https://api.github.com/users/turbonomic/repos","events_url":"https://api.github.com/users/turbonomic/events{/privacy}","received_events_url":"https://api.github.com/users/turbonomic/received_events","type":"Organization","site_admin":false},"repo":{"id":56551519,"name":"kubeturbo","full_name":"turbonomic/kubeturbo","owner":{"login":"turbonomic","id":20601535,"avatar_url":"https://avatars3.githubusercontent.com/u/20601535?v=4","gravatar_id":"","url":"https://api.github.com/users/turbonomic","html_url":"https://github.com/turbonomic","followers_url":"https://api.github.com/users/turbonomic/followers","following_url":"https://api.github.com/users/turbonomic/following{/other_user}","gists_url":"https://api.github.com/users/turbonomic/gists{/gist_id}","starred_url":"https://api.github.com/users/turbonomic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/turbonomic/subscriptions","organizations_url":"https://api.github.com/users/turbonomic/orgs","repos_url":"https://api.github.com/users/turbonomic/repos","events_url":"https://api.github.com/users/turbonomic/events{/privacy}","received_events_url":"https://api.github.com/users/turbonomic/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/turbonomic/kubeturbo","description":null,"fork":false,"url":"https://api.github.com/repos/turbonomic/kubeturbo","forks_url":"https://api.github.com/repos/turbonomic/kubeturbo/forks","keys_url":"https://api.github.com/repos/turbonomic/kubeturbo/keys{/key_id}","collaborators_url":"https://api.github.com/repos/turbonomic/kubeturbo/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/turbonomic/kubeturbo/teams","hooks_url":"https://api.github.com/repos/turbonomic/kubeturbo/hooks","issue_events_url":"https://api.github.com/repos/turbonomic/kubeturbo/issues/events{/number}","events_url":"https://api.github.com/repos/turbonomic/kubeturbo/events","assignees_url":"https://api.github.com/repos/turbonomic/kubeturbo/assignees{/user}","branches_url":"https://api.github.com/repos/turbonomic/kubeturbo/branches{/branch}","tags_url":"https://api.github.com/repos/turbonomic/kubeturbo/tags","blobs_url":"https://api.github.com/repos/turbonomic/kubeturbo/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/turbonomic/kubeturbo/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/turbonomic/kubeturbo/git/refs{/sha}","trees_url":"https://api.github.com/repos/turbonomic/kubeturbo/git/trees{/sha}","statuses_url":"https://api.github.com/repos/turbonomic/kubeturbo/statuses/{sha}","languages_url":"https://api.github.com/repos/turbonomic/kubeturbo/languages","stargazers_url":"https://api.github.com/repos/turbonomic/kubeturbo/stargazers","contributors_url":"https://api.github.com/repos/turbonomic/kubeturbo/contributors","subscribers_url":"https://api.github.com/repos/turbonomic/kubeturbo/subscribers","subscription_url":"https://api.github.com/repos/turbonomic/kubeturbo/subscription","commits_url":"https://api.github.com/repos/turbonomic/kubeturbo/commits{/sha}","git_commits_url":"https://api.github.com/repos/turbonomic/kubeturbo/git/commits{/sha}","comments_url":"https://api.github.com/repos/turbonomic/kubeturbo/comments{/number}","issue_comment_url":"https://api.github.com/repos/turbonomic/kubeturbo/issues/comments{/number}","contents_url":"https://api.github.com/repos/turbonomic/kubeturbo/contents/{+path}","compare_url":"https://api.github.com/repos/turbonomic/kubeturbo/compare/{base}...{head}","merges_url":"https://api.github.com/repos/turbonomic/kubeturbo/merges","archive_url":"https://api.github.com/repos/turbonomic/kubeturbo/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/turbonomic/kubeturbo/downloads","issues_url":"https://api.github.com/repos/turbonomic/kubeturbo/issues{/number}","pulls_url":"https://api.github.com/repos/turbonomic/kubeturbo/pulls{/number}","milestones_url":"https://api.github.com/repos/turbonomic/kubeturbo/milestones{/number}","notifications_url":"https://api.github.com/repos/turbonomic/kubeturbo/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/turbonomic/kubeturbo/labels{/name}","releases_url":"https://api.github.com/repos/turbonomic/kubeturbo/releases{/id}","deployments_url":"https://api.github.com/repos/turbonomic/kubeturbo/deployments","created_at":"2016-04-19T00:21:30Z","updated_at":"2018-04-02T14:27:46Z","pushed_at":"2018-04-02T19:19:57Z","git_url":"git://github.com/turbonomic/kubeturbo.git","ssh_url":"git@github.com:turbonomic/kubeturbo.git","clone_url":"https://github.com/turbonomic/kubeturbo.git","svn_url":"https://github.com/turbonomic/kubeturbo","homepage":null,"size":58019,"stargazers_count":18,"watchers_count":18,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":11,"mirror_url":null,"archived":false,"open_issues_count":7,"license":null,"forks":11,"open_issues":7,"watchers":18,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/turbonomic/kubeturbo/pulls/172"},"html":{"href":"https://github.com/turbonomic/kubeturbo/pull/172"},"issue":{"href":"https://api.github.com/repos/turbonomic/kubeturbo/issues/172"},"comments":{"href":"https://api.github.com/repos/turbonomic/kubeturbo/issues/172/comments"},"review_comments":{"href":"https://api.github.com/repos/turbonomic/kubeturbo/pulls/172/comments"},"review_comment":{"href":"https://api.github.com/repos/turbonomic/kubeturbo/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/turbonomic/kubeturbo/pulls/172/commits"},"statuses":{"href":"https://api.github.com/repos/turbonomic/kubeturbo/statuses/02389d1eae629b19e203cd3e9e7e18aceb6a14a1"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"songbinliu"}}