{"action":"created","comment":{"url":"https://api.github.com/repos/kubernetes/kube-deploy/pulls/comments/180906262","pull_request_review_id":111412395,"id":180906262,"diff_hunk":"@@ -205,15 +249,49 @@ func machineFromMachineSet(machineSet *v1alpha1.MachineSet, name string) *v1alph\n \t\tSpec:       machineSet.Spec.Template.Spec,\n \t}\n \n-\tamachine.Name = name\n-\tamachine.GenerateName = fmt.Sprintf(\"%s-\", machineSet.Name)\n+\tm.Name = name\n+\tm.GenerateName = fmt.Sprintf(\"%s-\", machineSet.Name)\n+\n+\treturn m\n+}\n+\n+func machineFromMachineSet(machineSet *v1alpha1.MachineSet, name string) *v1alpha1.Machine {\n+\tm := machineWithoutOwnerRefs(machineSet, name)\n+\tm.ObjectMeta.OwnerReferences = []metav1.OwnerReference{*metav1.NewControllerRef(machineSet, controllerKind)}\n+\treturn m\n+}\n+\n+func machineWithPreservedExistingOwnerRefs(machineSet *v1alpha1.MachineSet, name string) *v1alpha1.Machine {\n+\tcontroller := false\n+\texistingRef := metav1.NewControllerRef(machineSet, controllerKind)\n+\texistingRef.UID = \"NotMe\"\n+\texistingRef.Controller = &controller\n \n-\treturn amachine\n+\tm := machineWithoutOwnerRefs(machineSet, name)\n+\tm.ObjectMeta.OwnerReferences = []metav1.OwnerReference{*existingRef, *metav1.NewControllerRef(machineSet, controllerKind)}\n+\treturn m\n }\n \n-func machineWithDifferentLabels(machineSet *v1alpha1.MachineSet, name string) *v1alpha1.Machine {\n-\tamachine := machineFromMachineSet(machineSet, name)\n-\tamachine.Labels = map[string]string{\"foo\":\"bar\"}\n-\treturn amachine\n+func setDifferentUID(m *v1alpha1.Machine) *v1alpha1.Machine {\n+\tm.ObjectMeta.OwnerReferences[0].UID = \"NotMe\"\n+\treturn m\n }\n \n+func setMachineDeleting(m *v1alpha1.Machine) *v1alpha1.Machine {\n+\tnow := metav1.NewTime(time.Now())\n+\tm.ObjectMeta.DeletionTimestamp = &now\n+\treturn m\n+}\n+\n+func setDifferentLabels(m *v1alpha1.Machine) *v1alpha1.Machine {\n+\tlabels := m.GetLabels()\n+\tlabels[\"type\"] = \"NOTME\"","path":"cluster-api/pkg/controller/machineset/reconcile_test.go","position":134,"original_position":134,"commit_id":"c5269c532a9d52a7158e966a00dbfa5c35344b85","original_commit_id":"c5269c532a9d52a7158e966a00dbfa5c35344b85","user":{"login":"k4leung4","id":16194785,"avatar_url":"https://avatars0.githubusercontent.com/u/16194785?v=4","gravatar_id":"","url":"https://api.github.com/users/k4leung4","html_url":"https://github.com/k4leung4","followers_url":"https://api.github.com/users/k4leung4/followers","following_url":"https://api.github.com/users/k4leung4/following{/other_user}","gists_url":"https://api.github.com/users/k4leung4/gists{/gist_id}","starred_url":"https://api.github.com/users/k4leung4/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/k4leung4/subscriptions","organizations_url":"https://api.github.com/users/k4leung4/orgs","repos_url":"https://api.github.com/users/k4leung4/repos","events_url":"https://api.github.com/users/k4leung4/events{/privacy}","received_events_url":"https://api.github.com/users/k4leung4/received_events","type":"User","site_admin":false},"body":"added const for key.","created_at":"2018-04-11T21:38:11Z","updated_at":"2018-04-11T21:38:12Z","html_url":"https://github.com/kubernetes/kube-deploy/pull/667#discussion_r180906262","pull_request_url":"https://api.github.com/repos/kubernetes/kube-deploy/pulls/667","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/kubernetes/kube-deploy/pulls/comments/180906262"},"html":{"href":"https://github.com/kubernetes/kube-deploy/pull/667#discussion_r180906262"},"pull_request":{"href":"https://api.github.com/repos/kubernetes/kube-deploy/pulls/667"}},"in_reply_to_id":180878795},"pull_request":{"url":"https://api.github.com/repos/kubernetes/kube-deploy/pulls/667","id":179751043,"html_url":"https://github.com/kubernetes/kube-deploy/pull/667","diff_url":"https://github.com/kubernetes/kube-deploy/pull/667.diff","patch_url":"https://github.com/kubernetes/kube-deploy/pull/667.patch","issue_url":"https://api.github.com/repos/kubernetes/kube-deploy/issues/667","number":667,"state":"open","locked":false,"title":"Add owner reference for machines created via machineset controller","user":{"login":"k4leung4","id":16194785,"avatar_url":"https://avatars0.githubusercontent.com/u/16194785?v=4","gravatar_id":"","url":"https://api.github.com/users/k4leung4","html_url":"https://github.com/k4leung4","followers_url":"https://api.github.com/users/k4leung4/followers","following_url":"https://api.github.com/users/k4leung4/following{/other_user}","gists_url":"https://api.github.com/users/k4leung4/gists{/gist_id}","starred_url":"https://api.github.com/users/k4leung4/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/k4leung4/subscriptions","organizations_url":"https://api.github.com/users/k4leung4/orgs","repos_url":"https://api.github.com/users/k4leung4/repos","events_url":"https://api.github.com/users/k4leung4/events{/privacy}","received_events_url":"https://api.github.com/users/k4leung4/received_events","type":"User","site_admin":false},"body":"**What this PR does / why we need it**:\r\nThis adds owner reference to machine objects created through the machineset controller. This allows garbage collection and cascading deletion to work.\r\nDeleting the machineset will trigger the corresponding machines to be deleted.\r\n\r\n**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:\r\nFixes #\r\n\r\n**Special notes for your reviewer**:\r\n\r\n**Release note**:\r\n@kubernetes/kube-deploy-reviewers\r\n","created_at":"2018-04-05T17:54:45Z","updated_at":"2018-04-11T21:38:12Z","closed_at":null,"merged_at":null,"merge_commit_sha":"65521c7b09d4d720fd1c373bde8bcf53af31cac8","assignee":{"login":"jessicaochen","id":25439230,"avatar_url":"https://avatars2.githubusercontent.com/u/25439230?v=4","gravatar_id":"","url":"https://api.github.com/users/jessicaochen","html_url":"https://github.com/jessicaochen","followers_url":"https://api.github.com/users/jessicaochen/followers","following_url":"https://api.github.com/users/jessicaochen/following{/other_user}","gists_url":"https://api.github.com/users/jessicaochen/gists{/gist_id}","starred_url":"https://api.github.com/users/jessicaochen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jessicaochen/subscriptions","organizations_url":"https://api.github.com/users/jessicaochen/orgs","repos_url":"https://api.github.com/users/jessicaochen/repos","events_url":"https://api.github.com/users/jessicaochen/events{/privacy}","received_events_url":"https://api.github.com/users/jessicaochen/received_events","type":"User","site_admin":false},"assignees":[{"login":"krousey","id":157083,"avatar_url":"https://avatars2.githubusercontent.com/u/157083?v=4","gravatar_id":"","url":"https://api.github.com/users/krousey","html_url":"https://github.com/krousey","followers_url":"https://api.github.com/users/krousey/followers","following_url":"https://api.github.com/users/krousey/following{/other_user}","gists_url":"https://api.github.com/users/krousey/gists{/gist_id}","starred_url":"https://api.github.com/users/krousey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/krousey/subscriptions","organizations_url":"https://api.github.com/users/krousey/orgs","repos_url":"https://api.github.com/users/krousey/repos","events_url":"https://api.github.com/users/krousey/events{/privacy}","received_events_url":"https://api.github.com/users/krousey/received_events","type":"User","site_admin":false},{"login":"jessicaochen","id":25439230,"avatar_url":"https://avatars2.githubusercontent.com/u/25439230?v=4","gravatar_id":"","url":"https://api.github.com/users/jessicaochen","html_url":"https://github.com/jessicaochen","followers_url":"https://api.github.com/users/jessicaochen/followers","following_url":"https://api.github.com/users/jessicaochen/following{/other_user}","gists_url":"https://api.github.com/users/jessicaochen/gists{/gist_id}","starred_url":"https://api.github.com/users/jessicaochen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jessicaochen/subscriptions","organizations_url":"https://api.github.com/users/jessicaochen/orgs","repos_url":"https://api.github.com/users/jessicaochen/repos","events_url":"https://api.github.com/users/jessicaochen/events{/privacy}","received_events_url":"https://api.github.com/users/jessicaochen/received_events","type":"User","site_admin":false}],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":499761014,"url":"https://api.github.com/repos/kubernetes/kube-deploy/labels/cncf-cla:%20yes","name":"cncf-cla: yes","color":"bfe5bf","default":false},{"id":724454391,"url":"https://api.github.com/repos/kubernetes/kube-deploy/labels/size/L","name":"size/L","color":"ee9900","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/kubernetes/kube-deploy/pulls/667/commits","review_comments_url":"https://api.github.com/repos/kubernetes/kube-deploy/pulls/667/comments","review_comment_url":"https://api.github.com/repos/kubernetes/kube-deploy/pulls/comments{/number}","comments_url":"https://api.github.com/repos/kubernetes/kube-deploy/issues/667/comments","statuses_url":"https://api.github.com/repos/kubernetes/kube-deploy/statuses/c5269c532a9d52a7158e966a00dbfa5c35344b85","head":{"label":"k4leung4:delete","ref":"delete","sha":"c5269c532a9d52a7158e966a00dbfa5c35344b85","user":{"login":"k4leung4","id":16194785,"avatar_url":"https://avatars0.githubusercontent.com/u/16194785?v=4","gravatar_id":"","url":"https://api.github.com/users/k4leung4","html_url":"https://github.com/k4leung4","followers_url":"https://api.github.com/users/k4leung4/followers","following_url":"https://api.github.com/users/k4leung4/following{/other_user}","gists_url":"https://api.github.com/users/k4leung4/gists{/gist_id}","starred_url":"https://api.github.com/users/k4leung4/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/k4leung4/subscriptions","organizations_url":"https://api.github.com/users/k4leung4/orgs","repos_url":"https://api.github.com/users/k4leung4/repos","events_url":"https://api.github.com/users/k4leung4/events{/privacy}","received_events_url":"https://api.github.com/users/k4leung4/received_events","type":"User","site_admin":false},"repo":{"id":128083349,"name":"kube-deploy","full_name":"k4leung4/kube-deploy","owner":{"login":"k4leung4","id":16194785,"avatar_url":"https://avatars0.githubusercontent.com/u/16194785?v=4","gravatar_id":"","url":"https://api.github.com/users/k4leung4","html_url":"https://github.com/k4leung4","followers_url":"https://api.github.com/users/k4leung4/followers","following_url":"https://api.github.com/users/k4leung4/following{/other_user}","gists_url":"https://api.github.com/users/k4leung4/gists{/gist_id}","starred_url":"https://api.github.com/users/k4leung4/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/k4leung4/subscriptions","organizations_url":"https://api.github.com/users/k4leung4/orgs","repos_url":"https://api.github.com/users/k4leung4/repos","events_url":"https://api.github.com/users/k4leung4/events{/privacy}","received_events_url":"https://api.github.com/users/k4leung4/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/k4leung4/kube-deploy","description":"A place for cluster deployment automation","fork":true,"url":"https://api.github.com/repos/k4leung4/kube-deploy","forks_url":"https://api.github.com/repos/k4leung4/kube-deploy/forks","keys_url":"https://api.github.com/repos/k4leung4/kube-deploy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/k4leung4/kube-deploy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/k4leung4/kube-deploy/teams","hooks_url":"https://api.github.com/repos/k4leung4/kube-deploy/hooks","issue_events_url":"https://api.github.com/repos/k4leung4/kube-deploy/issues/events{/number}","events_url":"https://api.github.com/repos/k4leung4/kube-deploy/events","assignees_url":"https://api.github.com/repos/k4leung4/kube-deploy/assignees{/user}","branches_url":"https://api.github.com/repos/k4leung4/kube-deploy/branches{/branch}","tags_url":"https://api.github.com/repos/k4leung4/kube-deploy/tags","blobs_url":"https://api.github.com/repos/k4leung4/kube-deploy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/k4leung4/kube-deploy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/k4leung4/kube-deploy/git/refs{/sha}","trees_url":"https://api.github.com/repos/k4leung4/kube-deploy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/k4leung4/kube-deploy/statuses/{sha}","languages_url":"https://api.github.com/repos/k4leung4/kube-deploy/languages","stargazers_url":"https://api.github.com/repos/k4leung4/kube-deploy/stargazers","contributors_url":"https://api.github.com/repos/k4leung4/kube-deploy/contributors","subscribers_url":"https://api.github.com/repos/k4leung4/kube-deploy/subscribers","subscription_url":"https://api.github.com/repos/k4leung4/kube-deploy/subscription","commits_url":"https://api.github.com/repos/k4leung4/kube-deploy/commits{/sha}","git_commits_url":"https://api.github.com/repos/k4leung4/kube-deploy/git/commits{/sha}","comments_url":"https://api.github.com/repos/k4leung4/kube-deploy/comments{/number}","issue_comment_url":"https://api.github.com/repos/k4leung4/kube-deploy/issues/comments{/number}","contents_url":"https://api.github.com/repos/k4leung4/kube-deploy/contents/{+path}","compare_url":"https://api.github.com/repos/k4leung4/kube-deploy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/k4leung4/kube-deploy/merges","archive_url":"https://api.github.com/repos/k4leung4/kube-deploy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/k4leung4/kube-deploy/downloads","issues_url":"https://api.github.com/repos/k4leung4/kube-deploy/issues{/number}","pulls_url":"https://api.github.com/repos/k4leung4/kube-deploy/pulls{/number}","milestones_url":"https://api.github.com/repos/k4leung4/kube-deploy/milestones{/number}","notifications_url":"https://api.github.com/repos/k4leung4/kube-deploy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/k4leung4/kube-deploy/labels{/name}","releases_url":"https://api.github.com/repos/k4leung4/kube-deploy/releases{/id}","deployments_url":"https://api.github.com/repos/k4leung4/kube-deploy/deployments","created_at":"2018-04-04T15:34:22Z","updated_at":"2018-04-04T15:34:26Z","pushed_at":"2018-04-11T17:34:50Z","git_url":"git://github.com/k4leung4/kube-deploy.git","ssh_url":"git@github.com:k4leung4/kube-deploy.git","clone_url":"https://github.com/k4leung4/kube-deploy.git","svn_url":"https://github.com/k4leung4/kube-deploy","homepage":null,"size":128748,"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":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"kubernetes:master","ref":"master","sha":"15d6c662adcb28a2a81bafa4e5f3b093194025a4","user":{"login":"kubernetes","id":13629408,"avatar_url":"https://avatars2.githubusercontent.com/u/13629408?v=4","gravatar_id":"","url":"https://api.github.com/users/kubernetes","html_url":"https://github.com/kubernetes","followers_url":"https://api.github.com/users/kubernetes/followers","following_url":"https://api.github.com/users/kubernetes/following{/other_user}","gists_url":"https://api.github.com/users/kubernetes/gists{/gist_id}","starred_url":"https://api.github.com/users/kubernetes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kubernetes/subscriptions","organizations_url":"https://api.github.com/users/kubernetes/orgs","repos_url":"https://api.github.com/users/kubernetes/repos","events_url":"https://api.github.com/users/kubernetes/events{/privacy}","received_events_url":"https://api.github.com/users/kubernetes/received_events","type":"Organization","site_admin":false},"repo":{"id":54912542,"name":"kube-deploy","full_name":"kubernetes/kube-deploy","owner":{"login":"kubernetes","id":13629408,"avatar_url":"https://avatars2.githubusercontent.com/u/13629408?v=4","gravatar_id":"","url":"https://api.github.com/users/kubernetes","html_url":"https://github.com/kubernetes","followers_url":"https://api.github.com/users/kubernetes/followers","following_url":"https://api.github.com/users/kubernetes/following{/other_user}","gists_url":"https://api.github.com/users/kubernetes/gists{/gist_id}","starred_url":"https://api.github.com/users/kubernetes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kubernetes/subscriptions","organizations_url":"https://api.github.com/users/kubernetes/orgs","repos_url":"https://api.github.com/users/kubernetes/repos","events_url":"https://api.github.com/users/kubernetes/events{/privacy}","received_events_url":"https://api.github.com/users/kubernetes/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/kubernetes/kube-deploy","description":"A place for cluster deployment automation","fork":false,"url":"https://api.github.com/repos/kubernetes/kube-deploy","forks_url":"https://api.github.com/repos/kubernetes/kube-deploy/forks","keys_url":"https://api.github.com/repos/kubernetes/kube-deploy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kubernetes/kube-deploy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kubernetes/kube-deploy/teams","hooks_url":"https://api.github.com/repos/kubernetes/kube-deploy/hooks","issue_events_url":"https://api.github.com/repos/kubernetes/kube-deploy/issues/events{/number}","events_url":"https://api.github.com/repos/kubernetes/kube-deploy/events","assignees_url":"https://api.github.com/repos/kubernetes/kube-deploy/assignees{/user}","branches_url":"https://api.github.com/repos/kubernetes/kube-deploy/branches{/branch}","tags_url":"https://api.github.com/repos/kubernetes/kube-deploy/tags","blobs_url":"https://api.github.com/repos/kubernetes/kube-deploy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kubernetes/kube-deploy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kubernetes/kube-deploy/git/refs{/sha}","trees_url":"https://api.github.com/repos/kubernetes/kube-deploy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kubernetes/kube-deploy/statuses/{sha}","languages_url":"https://api.github.com/repos/kubernetes/kube-deploy/languages","stargazers_url":"https://api.github.com/repos/kubernetes/kube-deploy/stargazers","contributors_url":"https://api.github.com/repos/kubernetes/kube-deploy/contributors","subscribers_url":"https://api.github.com/repos/kubernetes/kube-deploy/subscribers","subscription_url":"https://api.github.com/repos/kubernetes/kube-deploy/subscription","commits_url":"https://api.github.com/repos/kubernetes/kube-deploy/commits{/sha}","git_commits_url":"https://api.github.com/repos/kubernetes/kube-deploy/git/commits{/sha}","comments_url":"https://api.github.com/repos/kubernetes/kube-deploy/comments{/number}","issue_comment_url":"https://api.github.com/repos/kubernetes/kube-deploy/issues/comments{/number}","contents_url":"https://api.github.com/repos/kubernetes/kube-deploy/contents/{+path}","compare_url":"https://api.github.com/repos/kubernetes/kube-deploy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kubernetes/kube-deploy/merges","archive_url":"https://api.github.com/repos/kubernetes/kube-deploy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kubernetes/kube-deploy/downloads","issues_url":"https://api.github.com/repos/kubernetes/kube-deploy/issues{/number}","pulls_url":"https://api.github.com/repos/kubernetes/kube-deploy/pulls{/number}","milestones_url":"https://api.github.com/repos/kubernetes/kube-deploy/milestones{/number}","notifications_url":"https://api.github.com/repos/kubernetes/kube-deploy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kubernetes/kube-deploy/labels{/name}","releases_url":"https://api.github.com/repos/kubernetes/kube-deploy/releases{/id}","deployments_url":"https://api.github.com/repos/kubernetes/kube-deploy/deployments","created_at":"2016-03-28T18:05:52Z","updated_at":"2018-04-11T21:22:59Z","pushed_at":"2018-04-11T21:22:56Z","git_url":"git://github.com/kubernetes/kube-deploy.git","ssh_url":"git@github.com:kubernetes/kube-deploy.git","clone_url":"https://github.com/kubernetes/kube-deploy.git","svn_url":"https://github.com/kubernetes/kube-deploy","homepage":null,"size":133969,"stargazers_count":449,"watchers_count":449,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":209,"mirror_url":null,"archived":false,"open_issues_count":97,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":209,"open_issues":97,"watchers":449,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/kubernetes/kube-deploy/pulls/667"},"html":{"href":"https://github.com/kubernetes/kube-deploy/pull/667"},"issue":{"href":"https://api.github.com/repos/kubernetes/kube-deploy/issues/667"},"comments":{"href":"https://api.github.com/repos/kubernetes/kube-deploy/issues/667/comments"},"review_comments":{"href":"https://api.github.com/repos/kubernetes/kube-deploy/pulls/667/comments"},"review_comment":{"href":"https://api.github.com/repos/kubernetes/kube-deploy/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/kubernetes/kube-deploy/pulls/667/commits"},"statuses":{"href":"https://api.github.com/repos/kubernetes/kube-deploy/statuses/c5269c532a9d52a7158e966a00dbfa5c35344b85"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"k4leung4"}}