{"action":"created","comment":{"url":"https://api.github.com/repos/coreos/kubernetes/pulls/comments/25810768","id":25810768,"diff_hunk":"@@ -0,0 +1,160 @@\n+/*\n+Copyright 2014 Google Inc. All rights reserved.\n+\n+Licensed under the Apache License, Version 2.0 (the \"License\");\n+you may not use this file except in compliance with the License.\n+You may obtain a copy of the License at\n+\n+    http://www.apache.org/licenses/LICENSE-2.0\n+\n+Unless required by applicable law or agreed to in writing, software\n+distributed under the License is distributed on an \"AS IS\" BASIS,\n+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+See the License for the specific language governing permissions and\n+limitations under the License.\n+*/\n+\n+package kubelet\n+\n+import (\n+\t\"hash/adler32\"\n+\n+\t\"github.com/GoogleCloudPlatform/kubernetes/pkg/api\"\n+\t\"github.com/GoogleCloudPlatform/kubernetes/pkg/kubelet/rocket\"\n+\t\"github.com/GoogleCloudPlatform/kubernetes/pkg/types\"\n+\t\"github.com/GoogleCloudPlatform/kubernetes/pkg/util\"\n+\t\"github.com/golang/glog\"\n+)\n+\n+const defaultEndpoint = \"/home/yifan/gopher/src/github.com/coreos/rocket/bin/rkt\"\n+\n+var rkt *rocket.RocketRuntime\n+\n+func init() {\n+\tvar err error\n+\trkt, err = rocket.NewRocketRuntime(defaultEndpoint)\n+\tif err != nil {\n+\t\tpanic(err)\n+\t}\n+}\n+\n+// FindContainerInPod finds the container in the pod.\n+func FindContainerInPod(container *api.Container, pod *api.Pod) (*api.Container, bool) {\n+\tfor _, c := range pod.Spec.Containers {\n+\t\tif c.Name == container.Name {\n+\t\t\treturn &c, true\n+\t\t}\n+\t}\n+\treturn nil, false\n+}\n+\n+// RunContainerInPod starts a container in the given pod.\n+func RunContainerInPod(container *api.Container, pod *api.Pod) error {\n+\t// Kill the pod and restart.\n+\tif err := rkt.KillPod(pod); err != nil {\n+\t\treturn err\n+\t}\n+\n+\t// Update the pod and start it.\n+\tpod.Spec.Containers = append(pod.Spec.Containers, *container)\n+\tboundPod := &api.BoundPod{pod.TypeMeta, pod.ObjectMeta, pod.Spec}\n+\tif err := rkt.RunPod(boundPod); err != nil {\n+\t\treturn err\n+\t}\n+\treturn nil\n+}\n+\n+// Help function, remove the container in the given pod.","path":"pkg/kubelet/container.go","position":67,"original_position":67,"commit_id":"bca3d38b5e0522de1b81bcd6b996c1f071057189","original_commit_id":"bca3d38b5e0522de1b81bcd6b996c1f071057189","user":{"login":"bcwaldon","id":548759,"avatar_url":"https://avatars.githubusercontent.com/u/548759?v=3","gravatar_id":"","url":"https://api.github.com/users/bcwaldon","html_url":"https://github.com/bcwaldon","followers_url":"https://api.github.com/users/bcwaldon/followers","following_url":"https://api.github.com/users/bcwaldon/following{/other_user}","gists_url":"https://api.github.com/users/bcwaldon/gists{/gist_id}","starred_url":"https://api.github.com/users/bcwaldon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bcwaldon/subscriptions","organizations_url":"https://api.github.com/users/bcwaldon/orgs","repos_url":"https://api.github.com/users/bcwaldon/repos","events_url":"https://api.github.com/users/bcwaldon/events{/privacy}","received_events_url":"https://api.github.com/users/bcwaldon/received_events","type":"User","site_admin":false},"body":"The dosctring convention of starting with the method name applies to unexported functions, too. ","created_at":"2015-03-04T20:30:04Z","updated_at":"2015-03-04T20:30:04Z","html_url":"https://github.com/coreos/kubernetes/pull/2#discussion_r25810768","pull_request_url":"https://api.github.com/repos/coreos/kubernetes/pulls/2","_links":{"self":{"href":"https://api.github.com/repos/coreos/kubernetes/pulls/comments/25810768"},"html":{"href":"https://github.com/coreos/kubernetes/pull/2#discussion_r25810768"},"pull_request":{"href":"https://api.github.com/repos/coreos/kubernetes/pulls/2"}}},"pull_request":{"url":"https://api.github.com/repos/coreos/kubernetes/pulls/2","id":30500818,"html_url":"https://github.com/coreos/kubernetes/pull/2","diff_url":"https://github.com/coreos/kubernetes/pull/2.diff","patch_url":"https://github.com/coreos/kubernetes/pull/2.patch","issue_url":"https://api.github.com/repos/coreos/kubernetes/issues/2","number":2,"state":"open","locked":false,"title":"rkt support","user":{"login":"bcwaldon","id":548759,"avatar_url":"https://avatars.githubusercontent.com/u/548759?v=3","gravatar_id":"","url":"https://api.github.com/users/bcwaldon","html_url":"https://github.com/bcwaldon","followers_url":"https://api.github.com/users/bcwaldon/followers","following_url":"https://api.github.com/users/bcwaldon/following{/other_user}","gists_url":"https://api.github.com/users/bcwaldon/gists{/gist_id}","starred_url":"https://api.github.com/users/bcwaldon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bcwaldon/subscriptions","organizations_url":"https://api.github.com/users/bcwaldon/orgs","repos_url":"https://api.github.com/users/bcwaldon/repos","events_url":"https://api.github.com/users/bcwaldon/events{/privacy}","received_events_url":"https://api.github.com/users/bcwaldon/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-03-04T20:22:56Z","updated_at":"2015-03-04T20:30:04Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b0c7e6dfcae147211eeeee07553b655f222bd720","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/coreos/kubernetes/pulls/2/commits","review_comments_url":"https://api.github.com/repos/coreos/kubernetes/pulls/2/comments","review_comment_url":"https://api.github.com/repos/coreos/kubernetes/pulls/comments{/number}","comments_url":"https://api.github.com/repos/coreos/kubernetes/issues/2/comments","statuses_url":"https://api.github.com/repos/coreos/kubernetes/statuses/bca3d38b5e0522de1b81bcd6b996c1f071057189","head":{"label":"yifan-gu:no_docker","ref":"no_docker","sha":"bca3d38b5e0522de1b81bcd6b996c1f071057189","user":{"login":"yifan-gu","id":3278588,"avatar_url":"https://avatars.githubusercontent.com/u/3278588?v=3","gravatar_id":"","url":"https://api.github.com/users/yifan-gu","html_url":"https://github.com/yifan-gu","followers_url":"https://api.github.com/users/yifan-gu/followers","following_url":"https://api.github.com/users/yifan-gu/following{/other_user}","gists_url":"https://api.github.com/users/yifan-gu/gists{/gist_id}","starred_url":"https://api.github.com/users/yifan-gu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yifan-gu/subscriptions","organizations_url":"https://api.github.com/users/yifan-gu/orgs","repos_url":"https://api.github.com/users/yifan-gu/repos","events_url":"https://api.github.com/users/yifan-gu/events{/privacy}","received_events_url":"https://api.github.com/users/yifan-gu/received_events","type":"User","site_admin":false},"repo":{"id":21830645,"name":"kubernetes","full_name":"yifan-gu/kubernetes","owner":{"login":"yifan-gu","id":3278588,"avatar_url":"https://avatars.githubusercontent.com/u/3278588?v=3","gravatar_id":"","url":"https://api.github.com/users/yifan-gu","html_url":"https://github.com/yifan-gu","followers_url":"https://api.github.com/users/yifan-gu/followers","following_url":"https://api.github.com/users/yifan-gu/following{/other_user}","gists_url":"https://api.github.com/users/yifan-gu/gists{/gist_id}","starred_url":"https://api.github.com/users/yifan-gu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yifan-gu/subscriptions","organizations_url":"https://api.github.com/users/yifan-gu/orgs","repos_url":"https://api.github.com/users/yifan-gu/repos","events_url":"https://api.github.com/users/yifan-gu/events{/privacy}","received_events_url":"https://api.github.com/users/yifan-gu/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/yifan-gu/kubernetes","description":"Container Cluster Manager","fork":true,"url":"https://api.github.com/repos/yifan-gu/kubernetes","forks_url":"https://api.github.com/repos/yifan-gu/kubernetes/forks","keys_url":"https://api.github.com/repos/yifan-gu/kubernetes/keys{/key_id}","collaborators_url":"https://api.github.com/repos/yifan-gu/kubernetes/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/yifan-gu/kubernetes/teams","hooks_url":"https://api.github.com/repos/yifan-gu/kubernetes/hooks","issue_events_url":"https://api.github.com/repos/yifan-gu/kubernetes/issues/events{/number}","events_url":"https://api.github.com/repos/yifan-gu/kubernetes/events","assignees_url":"https://api.github.com/repos/yifan-gu/kubernetes/assignees{/user}","branches_url":"https://api.github.com/repos/yifan-gu/kubernetes/branches{/branch}","tags_url":"https://api.github.com/repos/yifan-gu/kubernetes/tags","blobs_url":"https://api.github.com/repos/yifan-gu/kubernetes/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/yifan-gu/kubernetes/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/yifan-gu/kubernetes/git/refs{/sha}","trees_url":"https://api.github.com/repos/yifan-gu/kubernetes/git/trees{/sha}","statuses_url":"https://api.github.com/repos/yifan-gu/kubernetes/statuses/{sha}","languages_url":"https://api.github.com/repos/yifan-gu/kubernetes/languages","stargazers_url":"https://api.github.com/repos/yifan-gu/kubernetes/stargazers","contributors_url":"https://api.github.com/repos/yifan-gu/kubernetes/contributors","subscribers_url":"https://api.github.com/repos/yifan-gu/kubernetes/subscribers","subscription_url":"https://api.github.com/repos/yifan-gu/kubernetes/subscription","commits_url":"https://api.github.com/repos/yifan-gu/kubernetes/commits{/sha}","git_commits_url":"https://api.github.com/repos/yifan-gu/kubernetes/git/commits{/sha}","comments_url":"https://api.github.com/repos/yifan-gu/kubernetes/comments{/number}","issue_comment_url":"https://api.github.com/repos/yifan-gu/kubernetes/issues/comments{/number}","contents_url":"https://api.github.com/repos/yifan-gu/kubernetes/contents/{+path}","compare_url":"https://api.github.com/repos/yifan-gu/kubernetes/compare/{base}...{head}","merges_url":"https://api.github.com/repos/yifan-gu/kubernetes/merges","archive_url":"https://api.github.com/repos/yifan-gu/kubernetes/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/yifan-gu/kubernetes/downloads","issues_url":"https://api.github.com/repos/yifan-gu/kubernetes/issues{/number}","pulls_url":"https://api.github.com/repos/yifan-gu/kubernetes/pulls{/number}","milestones_url":"https://api.github.com/repos/yifan-gu/kubernetes/milestones{/number}","notifications_url":"https://api.github.com/repos/yifan-gu/kubernetes/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/yifan-gu/kubernetes/labels{/name}","releases_url":"https://api.github.com/repos/yifan-gu/kubernetes/releases{/id}","created_at":"2014-07-14T18:29:14Z","updated_at":"2015-02-12T18:54:51Z","pushed_at":"2015-03-04T18:31:47Z","git_url":"git://github.com/yifan-gu/kubernetes.git","ssh_url":"git@github.com:yifan-gu/kubernetes.git","clone_url":"https://github.com/yifan-gu/kubernetes.git","svn_url":"https://github.com/yifan-gu/kubernetes","homepage":null,"size":31760,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"coreos:rkt","ref":"rkt","sha":"e41d0bd5443da3dfb57a0ef7dfd549d10ec5e99b","user":{"login":"coreos","id":3730757,"avatar_url":"https://avatars.githubusercontent.com/u/3730757?v=3","gravatar_id":"","url":"https://api.github.com/users/coreos","html_url":"https://github.com/coreos","followers_url":"https://api.github.com/users/coreos/followers","following_url":"https://api.github.com/users/coreos/following{/other_user}","gists_url":"https://api.github.com/users/coreos/gists{/gist_id}","starred_url":"https://api.github.com/users/coreos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/coreos/subscriptions","organizations_url":"https://api.github.com/users/coreos/orgs","repos_url":"https://api.github.com/users/coreos/repos","events_url":"https://api.github.com/users/coreos/events{/privacy}","received_events_url":"https://api.github.com/users/coreos/received_events","type":"Organization","site_admin":false},"repo":{"id":30550971,"name":"kubernetes","full_name":"coreos/kubernetes","owner":{"login":"coreos","id":3730757,"avatar_url":"https://avatars.githubusercontent.com/u/3730757?v=3","gravatar_id":"","url":"https://api.github.com/users/coreos","html_url":"https://github.com/coreos","followers_url":"https://api.github.com/users/coreos/followers","following_url":"https://api.github.com/users/coreos/following{/other_user}","gists_url":"https://api.github.com/users/coreos/gists{/gist_id}","starred_url":"https://api.github.com/users/coreos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/coreos/subscriptions","organizations_url":"https://api.github.com/users/coreos/orgs","repos_url":"https://api.github.com/users/coreos/repos","events_url":"https://api.github.com/users/coreos/events{/privacy}","received_events_url":"https://api.github.com/users/coreos/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/coreos/kubernetes","description":"Container Cluster Manager","fork":true,"url":"https://api.github.com/repos/coreos/kubernetes","forks_url":"https://api.github.com/repos/coreos/kubernetes/forks","keys_url":"https://api.github.com/repos/coreos/kubernetes/keys{/key_id}","collaborators_url":"https://api.github.com/repos/coreos/kubernetes/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/coreos/kubernetes/teams","hooks_url":"https://api.github.com/repos/coreos/kubernetes/hooks","issue_events_url":"https://api.github.com/repos/coreos/kubernetes/issues/events{/number}","events_url":"https://api.github.com/repos/coreos/kubernetes/events","assignees_url":"https://api.github.com/repos/coreos/kubernetes/assignees{/user}","branches_url":"https://api.github.com/repos/coreos/kubernetes/branches{/branch}","tags_url":"https://api.github.com/repos/coreos/kubernetes/tags","blobs_url":"https://api.github.com/repos/coreos/kubernetes/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/coreos/kubernetes/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/coreos/kubernetes/git/refs{/sha}","trees_url":"https://api.github.com/repos/coreos/kubernetes/git/trees{/sha}","statuses_url":"https://api.github.com/repos/coreos/kubernetes/statuses/{sha}","languages_url":"https://api.github.com/repos/coreos/kubernetes/languages","stargazers_url":"https://api.github.com/repos/coreos/kubernetes/stargazers","contributors_url":"https://api.github.com/repos/coreos/kubernetes/contributors","subscribers_url":"https://api.github.com/repos/coreos/kubernetes/subscribers","subscription_url":"https://api.github.com/repos/coreos/kubernetes/subscription","commits_url":"https://api.github.com/repos/coreos/kubernetes/commits{/sha}","git_commits_url":"https://api.github.com/repos/coreos/kubernetes/git/commits{/sha}","comments_url":"https://api.github.com/repos/coreos/kubernetes/comments{/number}","issue_comment_url":"https://api.github.com/repos/coreos/kubernetes/issues/comments{/number}","contents_url":"https://api.github.com/repos/coreos/kubernetes/contents/{+path}","compare_url":"https://api.github.com/repos/coreos/kubernetes/compare/{base}...{head}","merges_url":"https://api.github.com/repos/coreos/kubernetes/merges","archive_url":"https://api.github.com/repos/coreos/kubernetes/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/coreos/kubernetes/downloads","issues_url":"https://api.github.com/repos/coreos/kubernetes/issues{/number}","pulls_url":"https://api.github.com/repos/coreos/kubernetes/pulls{/number}","milestones_url":"https://api.github.com/repos/coreos/kubernetes/milestones{/number}","notifications_url":"https://api.github.com/repos/coreos/kubernetes/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/coreos/kubernetes/labels{/name}","releases_url":"https://api.github.com/repos/coreos/kubernetes/releases{/id}","created_at":"2015-02-09T18:25:19Z","updated_at":"2015-03-04T20:08:13Z","pushed_at":"2015-03-04T20:22:17Z","git_url":"git://github.com/coreos/kubernetes.git","ssh_url":"git@github.com:coreos/kubernetes.git","clone_url":"https://github.com/coreos/kubernetes.git","svn_url":"https://github.com/coreos/kubernetes","homepage":"http://kubernetes.io","size":29613,"stargazers_count":4,"watchers_count":4,"language":"Go","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":2,"forks":0,"open_issues":2,"watchers":4,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/coreos/kubernetes/pulls/2"},"html":{"href":"https://github.com/coreos/kubernetes/pull/2"},"issue":{"href":"https://api.github.com/repos/coreos/kubernetes/issues/2"},"comments":{"href":"https://api.github.com/repos/coreos/kubernetes/issues/2/comments"},"review_comments":{"href":"https://api.github.com/repos/coreos/kubernetes/pulls/2/comments"},"review_comment":{"href":"https://api.github.com/repos/coreos/kubernetes/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/coreos/kubernetes/pulls/2/commits"},"statuses":{"href":"https://api.github.com/repos/coreos/kubernetes/statuses/bca3d38b5e0522de1b81bcd6b996c1f071057189"}}}}