{"action":"created","comment":{"url":"https://api.github.com/repos/kubernetes/kubernetes/pulls/comments/146999262","pull_request_review_id":71997170,"id":146999262,"diff_hunk":"@@ -606,18 +595,8 @@ func (rsc *ReplicaSetController) syncReplicaSet(key string) error {\n \t\t\tfilteredPods = append(filteredPods, pod)\n \t\t}\n \t}\n-\t// If any adoptions are attempted, we should first recheck for deletion with\n-\t// an uncached quorum read sometime after listing Pods (see #42639).\n-\tcanAdoptFunc := controller.RecheckDeletionTimestamp(func() (metav1.Object, error) {\n-\t\tfresh, err := rsc.kubeClient.ExtensionsV1beta1().ReplicaSets(rs.Namespace).Get(rs.Name, metav1.GetOptions{})\n-\t\tif err != nil {\n-\t\t\treturn nil, err\n-\t\t}\n-\t\tif fresh.UID != rs.UID {\n-\t\t\treturn nil, fmt.Errorf(\"original ReplicaSet %v/%v is gone: got uid %v, wanted %v\", rs.Namespace, rs.Name, fresh.UID, rs.UID)\n-\t\t}\n-\t\treturn fresh, nil\n-\t})\n+\n+\tcanAdoptFunc := getCanAdoptFunc(rsc, rs)","path":"pkg/controller/replicaset/replica_set.go","position":184,"original_position":184,"commit_id":"343bde84ab86ec2dc9420e021b485de94473e84d","original_commit_id":"343bde84ab86ec2dc9420e021b485de94473e84d","user":{"login":"enisoc","id":6733629,"avatar_url":"https://avatars3.githubusercontent.com/u/6733629?v=4","gravatar_id":"","url":"https://api.github.com/users/enisoc","html_url":"https://github.com/enisoc","followers_url":"https://api.github.com/users/enisoc/followers","following_url":"https://api.github.com/users/enisoc/following{/other_user}","gists_url":"https://api.github.com/users/enisoc/gists{/gist_id}","starred_url":"https://api.github.com/users/enisoc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/enisoc/subscriptions","organizations_url":"https://api.github.com/users/enisoc/orgs","repos_url":"https://api.github.com/users/enisoc/repos","events_url":"https://api.github.com/users/enisoc/events{/privacy}","received_events_url":"https://api.github.com/users/enisoc/received_events","type":"User","site_admin":false},"body":"On second thought, I'm thinking we should keep this as is, but move everything from here down to `cm.ClaimPods` into a method `rsc.claimPods()`. That makes more sense to me as a unit.","created_at":"2017-10-25T22:01:18Z","updated_at":"2017-10-25T22:10:34Z","html_url":"https://github.com/kubernetes/kubernetes/pull/54185#discussion_r146999262","pull_request_url":"https://api.github.com/repos/kubernetes/kubernetes/pulls/54185","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/kubernetes/kubernetes/pulls/comments/146999262"},"html":{"href":"https://github.com/kubernetes/kubernetes/pull/54185#discussion_r146999262"},"pull_request":{"href":"https://api.github.com/repos/kubernetes/kubernetes/pulls/54185"}}},"pull_request":{"url":"https://api.github.com/repos/kubernetes/kubernetes/pulls/54185","id":147444174,"html_url":"https://github.com/kubernetes/kubernetes/pull/54185","diff_url":"https://github.com/kubernetes/kubernetes/pull/54185.diff","patch_url":"https://github.com/kubernetes/kubernetes/pull/54185.patch","issue_url":"https://api.github.com/repos/kubernetes/kubernetes/issues/54185","number":54185,"state":"open","locked":false,"title":"refactor ReplicaSet sync call tree","user":{"login":"crimsonfaith91","id":13921630,"avatar_url":"https://avatars0.githubusercontent.com/u/13921630?v=4","gravatar_id":"","url":"https://api.github.com/users/crimsonfaith91","html_url":"https://github.com/crimsonfaith91","followers_url":"https://api.github.com/users/crimsonfaith91/followers","following_url":"https://api.github.com/users/crimsonfaith91/following{/other_user}","gists_url":"https://api.github.com/users/crimsonfaith91/gists{/gist_id}","starred_url":"https://api.github.com/users/crimsonfaith91/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/crimsonfaith91/subscriptions","organizations_url":"https://api.github.com/users/crimsonfaith91/orgs","repos_url":"https://api.github.com/users/crimsonfaith91/repos","events_url":"https://api.github.com/users/crimsonfaith91/events{/privacy}","received_events_url":"https://api.github.com/users/crimsonfaith91/received_events","type":"User","site_admin":false},"body":"**What this PR does / why we need it**:\r\nThis PR refactors ReplicaSet sync call tree by refactoring `manageReplicas` and `syncReplicaSet` functions into smaller functions, and adding unit tests to each of the smaller functions.\r\n\r\n**Which issue this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*: xref #52118\r\n\r\n**Release note**:\r\n<!--  Steps to write your release note:\r\n1. Use the release-note-* labels to set the release note state (if you have access)\r\n2. Enter your extended release note in the below block; leaving it blank means using the PR title as the release note. If no release note is required, just write `NONE`.\r\n-->\r\n```release-note\r\nNONE\r\n```\r\n**TODO**:\r\n- `manageReplicas`\r\n  - [x] move both outer and inner `batchSize` loops to a helper function named `slowStartBatch`, and test the function\r\n  - [x] add a helper function returning a list named `podsToDelete`, test the function, and refactor `DeletePod` loop to use the list\r\n  - [x] refactor skipped pod handling such that it happens after `slowStartBatch` returns\r\n\r\n- `syncReplicaSet`\r\n  - [x] add unit tests for `calculateStatus`\r\n  - [x] move `canAdoptFunc` to a helper function\r\n","created_at":"2017-10-19T00:45:34Z","updated_at":"2017-10-25T22:10:34Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5477fabc28b1c1a5a434200afe938c24a61c3051","assignee":{"login":"enisoc","id":6733629,"avatar_url":"https://avatars3.githubusercontent.com/u/6733629?v=4","gravatar_id":"","url":"https://api.github.com/users/enisoc","html_url":"https://github.com/enisoc","followers_url":"https://api.github.com/users/enisoc/followers","following_url":"https://api.github.com/users/enisoc/following{/other_user}","gists_url":"https://api.github.com/users/enisoc/gists{/gist_id}","starred_url":"https://api.github.com/users/enisoc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/enisoc/subscriptions","organizations_url":"https://api.github.com/users/enisoc/orgs","repos_url":"https://api.github.com/users/enisoc/repos","events_url":"https://api.github.com/users/enisoc/events{/privacy}","received_events_url":"https://api.github.com/users/enisoc/received_events","type":"User","site_admin":false},"assignees":[{"login":"enisoc","id":6733629,"avatar_url":"https://avatars3.githubusercontent.com/u/6733629?v=4","gravatar_id":"","url":"https://api.github.com/users/enisoc","html_url":"https://github.com/enisoc","followers_url":"https://api.github.com/users/enisoc/followers","following_url":"https://api.github.com/users/enisoc/following{/other_user}","gists_url":"https://api.github.com/users/enisoc/gists{/gist_id}","starred_url":"https://api.github.com/users/enisoc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/enisoc/subscriptions","organizations_url":"https://api.github.com/users/enisoc/orgs","repos_url":"https://api.github.com/users/enisoc/repos","events_url":"https://api.github.com/users/enisoc/events{/privacy}","received_events_url":"https://api.github.com/users/enisoc/received_events","type":"User","site_admin":false}],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/kubernetes/kubernetes/pulls/54185/commits","review_comments_url":"https://api.github.com/repos/kubernetes/kubernetes/pulls/54185/comments","review_comment_url":"https://api.github.com/repos/kubernetes/kubernetes/pulls/comments{/number}","comments_url":"https://api.github.com/repos/kubernetes/kubernetes/issues/54185/comments","statuses_url":"https://api.github.com/repos/kubernetes/kubernetes/statuses/343bde84ab86ec2dc9420e021b485de94473e84d","head":{"label":"crimsonfaith91:sync","ref":"sync","sha":"343bde84ab86ec2dc9420e021b485de94473e84d","user":{"login":"crimsonfaith91","id":13921630,"avatar_url":"https://avatars0.githubusercontent.com/u/13921630?v=4","gravatar_id":"","url":"https://api.github.com/users/crimsonfaith91","html_url":"https://github.com/crimsonfaith91","followers_url":"https://api.github.com/users/crimsonfaith91/followers","following_url":"https://api.github.com/users/crimsonfaith91/following{/other_user}","gists_url":"https://api.github.com/users/crimsonfaith91/gists{/gist_id}","starred_url":"https://api.github.com/users/crimsonfaith91/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/crimsonfaith91/subscriptions","organizations_url":"https://api.github.com/users/crimsonfaith91/orgs","repos_url":"https://api.github.com/users/crimsonfaith91/repos","events_url":"https://api.github.com/users/crimsonfaith91/events{/privacy}","received_events_url":"https://api.github.com/users/crimsonfaith91/received_events","type":"User","site_admin":false},"repo":{"id":86755950,"name":"kubernetes","full_name":"crimsonfaith91/kubernetes","owner":{"login":"crimsonfaith91","id":13921630,"avatar_url":"https://avatars0.githubusercontent.com/u/13921630?v=4","gravatar_id":"","url":"https://api.github.com/users/crimsonfaith91","html_url":"https://github.com/crimsonfaith91","followers_url":"https://api.github.com/users/crimsonfaith91/followers","following_url":"https://api.github.com/users/crimsonfaith91/following{/other_user}","gists_url":"https://api.github.com/users/crimsonfaith91/gists{/gist_id}","starred_url":"https://api.github.com/users/crimsonfaith91/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/crimsonfaith91/subscriptions","organizations_url":"https://api.github.com/users/crimsonfaith91/orgs","repos_url":"https://api.github.com/users/crimsonfaith91/repos","events_url":"https://api.github.com/users/crimsonfaith91/events{/privacy}","received_events_url":"https://api.github.com/users/crimsonfaith91/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/crimsonfaith91/kubernetes","description":"Production-Grade Container Scheduling and Management","fork":true,"url":"https://api.github.com/repos/crimsonfaith91/kubernetes","forks_url":"https://api.github.com/repos/crimsonfaith91/kubernetes/forks","keys_url":"https://api.github.com/repos/crimsonfaith91/kubernetes/keys{/key_id}","collaborators_url":"https://api.github.com/repos/crimsonfaith91/kubernetes/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/crimsonfaith91/kubernetes/teams","hooks_url":"https://api.github.com/repos/crimsonfaith91/kubernetes/hooks","issue_events_url":"https://api.github.com/repos/crimsonfaith91/kubernetes/issues/events{/number}","events_url":"https://api.github.com/repos/crimsonfaith91/kubernetes/events","assignees_url":"https://api.github.com/repos/crimsonfaith91/kubernetes/assignees{/user}","branches_url":"https://api.github.com/repos/crimsonfaith91/kubernetes/branches{/branch}","tags_url":"https://api.github.com/repos/crimsonfaith91/kubernetes/tags","blobs_url":"https://api.github.com/repos/crimsonfaith91/kubernetes/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/crimsonfaith91/kubernetes/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/crimsonfaith91/kubernetes/git/refs{/sha}","trees_url":"https://api.github.com/repos/crimsonfaith91/kubernetes/git/trees{/sha}","statuses_url":"https://api.github.com/repos/crimsonfaith91/kubernetes/statuses/{sha}","languages_url":"https://api.github.com/repos/crimsonfaith91/kubernetes/languages","stargazers_url":"https://api.github.com/repos/crimsonfaith91/kubernetes/stargazers","contributors_url":"https://api.github.com/repos/crimsonfaith91/kubernetes/contributors","subscribers_url":"https://api.github.com/repos/crimsonfaith91/kubernetes/subscribers","subscription_url":"https://api.github.com/repos/crimsonfaith91/kubernetes/subscription","commits_url":"https://api.github.com/repos/crimsonfaith91/kubernetes/commits{/sha}","git_commits_url":"https://api.github.com/repos/crimsonfaith91/kubernetes/git/commits{/sha}","comments_url":"https://api.github.com/repos/crimsonfaith91/kubernetes/comments{/number}","issue_comment_url":"https://api.github.com/repos/crimsonfaith91/kubernetes/issues/comments{/number}","contents_url":"https://api.github.com/repos/crimsonfaith91/kubernetes/contents/{+path}","compare_url":"https://api.github.com/repos/crimsonfaith91/kubernetes/compare/{base}...{head}","merges_url":"https://api.github.com/repos/crimsonfaith91/kubernetes/merges","archive_url":"https://api.github.com/repos/crimsonfaith91/kubernetes/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/crimsonfaith91/kubernetes/downloads","issues_url":"https://api.github.com/repos/crimsonfaith91/kubernetes/issues{/number}","pulls_url":"https://api.github.com/repos/crimsonfaith91/kubernetes/pulls{/number}","milestones_url":"https://api.github.com/repos/crimsonfaith91/kubernetes/milestones{/number}","notifications_url":"https://api.github.com/repos/crimsonfaith91/kubernetes/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/crimsonfaith91/kubernetes/labels{/name}","releases_url":"https://api.github.com/repos/crimsonfaith91/kubernetes/releases{/id}","deployments_url":"https://api.github.com/repos/crimsonfaith91/kubernetes/deployments","created_at":"2017-03-30T22:50:03Z","updated_at":"2017-03-30T22:50:34Z","pushed_at":"2017-10-24T23:53:53Z","git_url":"git://github.com/crimsonfaith91/kubernetes.git","ssh_url":"git@github.com:crimsonfaith91/kubernetes.git","clone_url":"https://github.com/crimsonfaith91/kubernetes.git","svn_url":"https://github.com/crimsonfaith91/kubernetes","homepage":"http://kubernetes.io","size":507773,"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,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"kubernetes:master","ref":"master","sha":"191ff804ead937d9d7041361110e1d3c65ad14cd","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":20580498,"name":"kubernetes","full_name":"kubernetes/kubernetes","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/kubernetes","description":"Production-Grade Container Scheduling and Management","fork":false,"url":"https://api.github.com/repos/kubernetes/kubernetes","forks_url":"https://api.github.com/repos/kubernetes/kubernetes/forks","keys_url":"https://api.github.com/repos/kubernetes/kubernetes/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kubernetes/kubernetes/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kubernetes/kubernetes/teams","hooks_url":"https://api.github.com/repos/kubernetes/kubernetes/hooks","issue_events_url":"https://api.github.com/repos/kubernetes/kubernetes/issues/events{/number}","events_url":"https://api.github.com/repos/kubernetes/kubernetes/events","assignees_url":"https://api.github.com/repos/kubernetes/kubernetes/assignees{/user}","branches_url":"https://api.github.com/repos/kubernetes/kubernetes/branches{/branch}","tags_url":"https://api.github.com/repos/kubernetes/kubernetes/tags","blobs_url":"https://api.github.com/repos/kubernetes/kubernetes/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kubernetes/kubernetes/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kubernetes/kubernetes/git/refs{/sha}","trees_url":"https://api.github.com/repos/kubernetes/kubernetes/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kubernetes/kubernetes/statuses/{sha}","languages_url":"https://api.github.com/repos/kubernetes/kubernetes/languages","stargazers_url":"https://api.github.com/repos/kubernetes/kubernetes/stargazers","contributors_url":"https://api.github.com/repos/kubernetes/kubernetes/contributors","subscribers_url":"https://api.github.com/repos/kubernetes/kubernetes/subscribers","subscription_url":"https://api.github.com/repos/kubernetes/kubernetes/subscription","commits_url":"https://api.github.com/repos/kubernetes/kubernetes/commits{/sha}","git_commits_url":"https://api.github.com/repos/kubernetes/kubernetes/git/commits{/sha}","comments_url":"https://api.github.com/repos/kubernetes/kubernetes/comments{/number}","issue_comment_url":"https://api.github.com/repos/kubernetes/kubernetes/issues/comments{/number}","contents_url":"https://api.github.com/repos/kubernetes/kubernetes/contents/{+path}","compare_url":"https://api.github.com/repos/kubernetes/kubernetes/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kubernetes/kubernetes/merges","archive_url":"https://api.github.com/repos/kubernetes/kubernetes/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kubernetes/kubernetes/downloads","issues_url":"https://api.github.com/repos/kubernetes/kubernetes/issues{/number}","pulls_url":"https://api.github.com/repos/kubernetes/kubernetes/pulls{/number}","milestones_url":"https://api.github.com/repos/kubernetes/kubernetes/milestones{/number}","notifications_url":"https://api.github.com/repos/kubernetes/kubernetes/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kubernetes/kubernetes/labels{/name}","releases_url":"https://api.github.com/repos/kubernetes/kubernetes/releases{/id}","deployments_url":"https://api.github.com/repos/kubernetes/kubernetes/deployments","created_at":"2014-06-06T22:56:04Z","updated_at":"2017-10-25T21:51:30Z","pushed_at":"2017-10-25T22:01:40Z","git_url":"git://github.com/kubernetes/kubernetes.git","ssh_url":"git@github.com:kubernetes/kubernetes.git","clone_url":"https://github.com/kubernetes/kubernetes.git","svn_url":"https://github.com/kubernetes/kubernetes","homepage":"http://kubernetes.io","size":725055,"stargazers_count":28132,"watchers_count":28132,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":10076,"mirror_url":null,"archived":false,"open_issues_count":5615,"forks":10076,"open_issues":5615,"watchers":28132,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/kubernetes/kubernetes/pulls/54185"},"html":{"href":"https://github.com/kubernetes/kubernetes/pull/54185"},"issue":{"href":"https://api.github.com/repos/kubernetes/kubernetes/issues/54185"},"comments":{"href":"https://api.github.com/repos/kubernetes/kubernetes/issues/54185/comments"},"review_comments":{"href":"https://api.github.com/repos/kubernetes/kubernetes/pulls/54185/comments"},"review_comment":{"href":"https://api.github.com/repos/kubernetes/kubernetes/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/kubernetes/kubernetes/pulls/54185/commits"},"statuses":{"href":"https://api.github.com/repos/kubernetes/kubernetes/statuses/343bde84ab86ec2dc9420e021b485de94473e84d"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"enisoc"}}