{"action":"created","comment":{"url":"https://api.github.com/repos/kubernetes/kubernetes/pulls/comments/45856499","id":45856499,"diff_hunk":"@@ -84,8 +92,103 @@ func (d *DeploymentController) reconcileDeployment(deployment *extensions.Deploy\n }\n \n func (d *DeploymentController) reconcileRecreateDeployment(deployment extensions.Deployment) error {\n-\t// TODO: implement me.\n-\treturn nil\n+\toldRCs, err := d.getOldRCs(deployment)\n+\tif err != nil {\n+\t\treturn err\n+\t}\n+\n+\t// scale all old rcs to zero\n+\twaitScale := sync.WaitGroup{}\n+\twaitScale.Add(len(oldRCs))\n+\terrChan := make(chan error, len(oldRCs))\n+\tfor _, oldRC := range oldRCs {\n+\t\tgo func(rc *api.ReplicationController) {\n+\t\t\tdefer waitScale.Done()\n+\t\t\tif _, err := d.scaleRCAndRecordEvent(rc, 0, deployment); err != nil {\n+\t\t\t\tglog.Errorf(\"Fail to scale replication controller: %q/%q to zero\", rc.Namespace, rc.Name)\n+\t\t\t\terrChan <- err\n+\t\t\t\tutil.HandleError(err)\n+\t\t\t}\n+\t\t}(oldRC)\n+\t}\n+\twaitScale.Wait()\n+\tclose(errChan)\n+\tif len(errChan) != 0 {\n+\t\terrlist := []error{}\n+\t\tfor err := range errChan {\n+\t\t\terrlist = append(errlist, err)\n+\t\t}\n+\t\treturn errors.NewAggregate(errlist)\n+\t}\n+\n+\t// waite for all pods killed, then delete all old rcs","path":"pkg/controller/deployment/deployment_controller.go","position":50,"original_position":50,"commit_id":"0ec2586d1d628c0b0b5542ac6cd18eda3d317d62","original_commit_id":"0ec2586d1d628c0b0b5542ac6cd18eda3d317d62","user":{"login":"kargakis","id":3900799,"avatar_url":"https://avatars.githubusercontent.com/u/3900799?v=3","gravatar_id":"","url":"https://api.github.com/users/kargakis","html_url":"https://github.com/kargakis","followers_url":"https://api.github.com/users/kargakis/followers","following_url":"https://api.github.com/users/kargakis/following{/other_user}","gists_url":"https://api.github.com/users/kargakis/gists{/gist_id}","starred_url":"https://api.github.com/users/kargakis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kargakis/subscriptions","organizations_url":"https://api.github.com/users/kargakis/orgs","repos_url":"https://api.github.com/users/kargakis/repos","events_url":"https://api.github.com/users/kargakis/events{/privacy}","received_events_url":"https://api.github.com/users/kargakis/received_events","type":"User","site_admin":false},"body":"Rolling update is not deleting old rcs and neither recreate should.","created_at":"2015-11-25T11:35:05Z","updated_at":"2015-11-25T11:35:05Z","html_url":"https://github.com/kubernetes/kubernetes/pull/16713#discussion_r45856499","pull_request_url":"https://api.github.com/repos/kubernetes/kubernetes/pulls/16713","_links":{"self":{"href":"https://api.github.com/repos/kubernetes/kubernetes/pulls/comments/45856499"},"html":{"href":"https://github.com/kubernetes/kubernetes/pull/16713#discussion_r45856499"},"pull_request":{"href":"https://api.github.com/repos/kubernetes/kubernetes/pulls/16713"}}},"pull_request":{"url":"https://api.github.com/repos/kubernetes/kubernetes/pulls/16713","id":49520773,"html_url":"https://github.com/kubernetes/kubernetes/pull/16713","diff_url":"https://github.com/kubernetes/kubernetes/pull/16713.diff","patch_url":"https://github.com/kubernetes/kubernetes/pull/16713.patch","issue_url":"https://api.github.com/repos/kubernetes/kubernetes/issues/16713","number":16713,"state":"open","locked":false,"title":"implement reconcileRecreateDeployment","user":{"login":"mqliang","id":12423751,"avatar_url":"https://avatars.githubusercontent.com/u/12423751?v=3","gravatar_id":"","url":"https://api.github.com/users/mqliang","html_url":"https://github.com/mqliang","followers_url":"https://api.github.com/users/mqliang/followers","following_url":"https://api.github.com/users/mqliang/following{/other_user}","gists_url":"https://api.github.com/users/mqliang/gists{/gist_id}","starred_url":"https://api.github.com/users/mqliang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mqliang/subscriptions","organizations_url":"https://api.github.com/users/mqliang/orgs","repos_url":"https://api.github.com/users/mqliang/repos","events_url":"https://api.github.com/users/mqliang/events{/privacy}","received_events_url":"https://api.github.com/users/mqliang/received_events","type":"User","site_admin":false},"body":"simple implementation of `reconcileRecreateDeployment()`","created_at":"2015-11-03T05:31:45Z","updated_at":"2015-11-25T11:35:05Z","closed_at":null,"merged_at":null,"merge_commit_sha":"056f3c8c9cfba4cec1a49f53b10c8bc7c9ee2328","assignee":{"login":"brendandburns","id":5751682,"avatar_url":"https://avatars.githubusercontent.com/u/5751682?v=3","gravatar_id":"","url":"https://api.github.com/users/brendandburns","html_url":"https://github.com/brendandburns","followers_url":"https://api.github.com/users/brendandburns/followers","following_url":"https://api.github.com/users/brendandburns/following{/other_user}","gists_url":"https://api.github.com/users/brendandburns/gists{/gist_id}","starred_url":"https://api.github.com/users/brendandburns/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brendandburns/subscriptions","organizations_url":"https://api.github.com/users/brendandburns/orgs","repos_url":"https://api.github.com/users/brendandburns/repos","events_url":"https://api.github.com/users/brendandburns/events{/privacy}","received_events_url":"https://api.github.com/users/brendandburns/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/kubernetes/kubernetes/pulls/16713/commits","review_comments_url":"https://api.github.com/repos/kubernetes/kubernetes/pulls/16713/comments","review_comment_url":"https://api.github.com/repos/kubernetes/kubernetes/pulls/comments{/number}","comments_url":"https://api.github.com/repos/kubernetes/kubernetes/issues/16713/comments","statuses_url":"https://api.github.com/repos/kubernetes/kubernetes/statuses/0ec2586d1d628c0b0b5542ac6cd18eda3d317d62","head":{"label":"mqliang:RecreateDeployment","ref":"RecreateDeployment","sha":"0ec2586d1d628c0b0b5542ac6cd18eda3d317d62","user":{"login":"mqliang","id":12423751,"avatar_url":"https://avatars.githubusercontent.com/u/12423751?v=3","gravatar_id":"","url":"https://api.github.com/users/mqliang","html_url":"https://github.com/mqliang","followers_url":"https://api.github.com/users/mqliang/followers","following_url":"https://api.github.com/users/mqliang/following{/other_user}","gists_url":"https://api.github.com/users/mqliang/gists{/gist_id}","starred_url":"https://api.github.com/users/mqliang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mqliang/subscriptions","organizations_url":"https://api.github.com/users/mqliang/orgs","repos_url":"https://api.github.com/users/mqliang/repos","events_url":"https://api.github.com/users/mqliang/events{/privacy}","received_events_url":"https://api.github.com/users/mqliang/received_events","type":"User","site_admin":false},"repo":{"id":42916417,"name":"kubernetes","full_name":"mqliang/kubernetes","owner":{"login":"mqliang","id":12423751,"avatar_url":"https://avatars.githubusercontent.com/u/12423751?v=3","gravatar_id":"","url":"https://api.github.com/users/mqliang","html_url":"https://github.com/mqliang","followers_url":"https://api.github.com/users/mqliang/followers","following_url":"https://api.github.com/users/mqliang/following{/other_user}","gists_url":"https://api.github.com/users/mqliang/gists{/gist_id}","starred_url":"https://api.github.com/users/mqliang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mqliang/subscriptions","organizations_url":"https://api.github.com/users/mqliang/orgs","repos_url":"https://api.github.com/users/mqliang/repos","events_url":"https://api.github.com/users/mqliang/events{/privacy}","received_events_url":"https://api.github.com/users/mqliang/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mqliang/kubernetes","description":"Container Cluster Manager from Google","fork":true,"url":"https://api.github.com/repos/mqliang/kubernetes","forks_url":"https://api.github.com/repos/mqliang/kubernetes/forks","keys_url":"https://api.github.com/repos/mqliang/kubernetes/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mqliang/kubernetes/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mqliang/kubernetes/teams","hooks_url":"https://api.github.com/repos/mqliang/kubernetes/hooks","issue_events_url":"https://api.github.com/repos/mqliang/kubernetes/issues/events{/number}","events_url":"https://api.github.com/repos/mqliang/kubernetes/events","assignees_url":"https://api.github.com/repos/mqliang/kubernetes/assignees{/user}","branches_url":"https://api.github.com/repos/mqliang/kubernetes/branches{/branch}","tags_url":"https://api.github.com/repos/mqliang/kubernetes/tags","blobs_url":"https://api.github.com/repos/mqliang/kubernetes/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mqliang/kubernetes/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mqliang/kubernetes/git/refs{/sha}","trees_url":"https://api.github.com/repos/mqliang/kubernetes/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mqliang/kubernetes/statuses/{sha}","languages_url":"https://api.github.com/repos/mqliang/kubernetes/languages","stargazers_url":"https://api.github.com/repos/mqliang/kubernetes/stargazers","contributors_url":"https://api.github.com/repos/mqliang/kubernetes/contributors","subscribers_url":"https://api.github.com/repos/mqliang/kubernetes/subscribers","subscription_url":"https://api.github.com/repos/mqliang/kubernetes/subscription","commits_url":"https://api.github.com/repos/mqliang/kubernetes/commits{/sha}","git_commits_url":"https://api.github.com/repos/mqliang/kubernetes/git/commits{/sha}","comments_url":"https://api.github.com/repos/mqliang/kubernetes/comments{/number}","issue_comment_url":"https://api.github.com/repos/mqliang/kubernetes/issues/comments{/number}","contents_url":"https://api.github.com/repos/mqliang/kubernetes/contents/{+path}","compare_url":"https://api.github.com/repos/mqliang/kubernetes/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mqliang/kubernetes/merges","archive_url":"https://api.github.com/repos/mqliang/kubernetes/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mqliang/kubernetes/downloads","issues_url":"https://api.github.com/repos/mqliang/kubernetes/issues{/number}","pulls_url":"https://api.github.com/repos/mqliang/kubernetes/pulls{/number}","milestones_url":"https://api.github.com/repos/mqliang/kubernetes/milestones{/number}","notifications_url":"https://api.github.com/repos/mqliang/kubernetes/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mqliang/kubernetes/labels{/name}","releases_url":"https://api.github.com/repos/mqliang/kubernetes/releases{/id}","created_at":"2015-09-22T06:44:47Z","updated_at":"2015-09-22T06:45:03Z","pushed_at":"2015-11-25T09:08:26Z","git_url":"git://github.com/mqliang/kubernetes.git","ssh_url":"git@github.com:mqliang/kubernetes.git","clone_url":"https://github.com/mqliang/kubernetes.git","svn_url":"https://github.com/mqliang/kubernetes","homepage":"http://kubernetes.io","size":138537,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"kubernetes:master","ref":"master","sha":"a7425bf070b30f9fa19733200910b9cb0cb98c56","user":{"login":"kubernetes","id":13629408,"avatar_url":"https://avatars.githubusercontent.com/u/13629408?v=3","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://avatars.githubusercontent.com/u/13629408?v=3","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":"Container Cluster Manager from Google","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}","created_at":"2014-06-06T22:56:04Z","updated_at":"2015-11-25T10:38:34Z","pushed_at":"2015-11-25T11:34:47Z","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":290499,"stargazers_count":11449,"watchers_count":11449,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":3052,"mirror_url":null,"open_issues_count":2401,"forks":3052,"open_issues":2401,"watchers":11449,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/kubernetes/kubernetes/pulls/16713"},"html":{"href":"https://github.com/kubernetes/kubernetes/pull/16713"},"issue":{"href":"https://api.github.com/repos/kubernetes/kubernetes/issues/16713"},"comments":{"href":"https://api.github.com/repos/kubernetes/kubernetes/issues/16713/comments"},"review_comments":{"href":"https://api.github.com/repos/kubernetes/kubernetes/pulls/16713/comments"},"review_comment":{"href":"https://api.github.com/repos/kubernetes/kubernetes/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/kubernetes/kubernetes/pulls/16713/commits"},"statuses":{"href":"https://api.github.com/repos/kubernetes/kubernetes/statuses/0ec2586d1d628c0b0b5542ac6cd18eda3d317d62"}}}}