{"action":"created","comment":{"url":"https://api.github.com/repos/kubernetes/kubernetes/pulls/comments/57597470","id":57597470,"diff_hunk":"@@ -0,0 +1,471 @@\n+/*\n+Copyright 2015 The Kubernetes Authors 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 dockertools\n+\n+import (\n+\t\"bytes\"\n+\t\"encoding/base64\"\n+\t\"encoding/json\"\n+\t\"io\"\n+\t\"io/ioutil\"\n+\t\"strconv\"\n+\t\"time\"\n+\n+\t\"github.com/docker/docker/pkg/stdcopy\"\n+\tdockerapi \"github.com/docker/engine-api/client\"\n+\tdockertypes \"github.com/docker/engine-api/types\"\n+\tdockercontainer \"github.com/docker/engine-api/types/container\"\n+\tdockerfilters \"github.com/docker/engine-api/types/filters\"\n+\tdocker \"github.com/fsouza/go-dockerclient\"\n+\t\"golang.org/x/net/context\"\n+\t\"k8s.io/kubernetes/pkg/kubelet/metrics\"\n+)\n+\n+// KubeDockerClient is a wrapped layer of docker client for kubelet internal use. This layer is added to:\n+//\t1) Record operation metrics in each function.\n+//\t2) Redirect stream for exec and attach operations.\n+//\t3) Wrap the context in this layer to make the DockerInterface cleaner.\n+//\t3) Stabilize the DockerInterface. The engine-api is still under active development, the interface\n+//\tis not stabilized yet. However, the DockerInterface is used in many files in Kubernetes, we may\n+//\tnot want to change the interface frequently. With this layer, we can port the engine api to the\n+//\tDockerInterface to avoid changing DockerInterface as far as possible.","path":"pkg/kubelet/dockertools/kube_docker_client.go","position":null,"original_position":45,"commit_id":"c8fa0ab13d8f15fc843dcc0f80a02aa86b05f7c7","original_commit_id":"5099798863792c442d41c17927410fa960b9aced","user":{"login":"yujuhong","id":10524058,"avatar_url":"https://avatars.githubusercontent.com/u/10524058?v=3","gravatar_id":"","url":"https://api.github.com/users/yujuhong","html_url":"https://github.com/yujuhong","followers_url":"https://api.github.com/users/yujuhong/followers","following_url":"https://api.github.com/users/yujuhong/following{/other_user}","gists_url":"https://api.github.com/users/yujuhong/gists{/gist_id}","starred_url":"https://api.github.com/users/yujuhong/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yujuhong/subscriptions","organizations_url":"https://api.github.com/users/yujuhong/orgs","repos_url":"https://api.github.com/users/yujuhong/repos","events_url":"https://api.github.com/users/yujuhong/events{/privacy}","received_events_url":"https://api.github.com/users/yujuhong/received_events","type":"User","site_admin":false},"body":"s/as far as/as much as\r\n\r\nBTW, we *want* a better interface. I assume this is just the first step to swap the client, and we'll get to fixing the DockerInterface soon? :-)","created_at":"2016-03-28T17:06:49Z","updated_at":"2016-03-28T17:06:49Z","html_url":"https://github.com/kubernetes/kubernetes/pull/23506#discussion_r57597470","pull_request_url":"https://api.github.com/repos/kubernetes/kubernetes/pulls/23506","_links":{"self":{"href":"https://api.github.com/repos/kubernetes/kubernetes/pulls/comments/57597470"},"html":{"href":"https://github.com/kubernetes/kubernetes/pull/23506#discussion_r57597470"},"pull_request":{"href":"https://api.github.com/repos/kubernetes/kubernetes/pulls/23506"}}},"pull_request":{"url":"https://api.github.com/repos/kubernetes/kubernetes/pulls/23506","id":64214987,"html_url":"https://github.com/kubernetes/kubernetes/pull/23506","diff_url":"https://github.com/kubernetes/kubernetes/pull/23506.diff","patch_url":"https://github.com/kubernetes/kubernetes/pull/23506.patch","issue_url":"https://api.github.com/repos/kubernetes/kubernetes/issues/23506","number":23506,"state":"open","locked":false,"title":"Kubelet: Start using the official docker engine-api","user":{"login":"Random-Liu","id":5821883,"avatar_url":"https://avatars.githubusercontent.com/u/5821883?v=3","gravatar_id":"","url":"https://api.github.com/users/Random-Liu","html_url":"https://github.com/Random-Liu","followers_url":"https://api.github.com/users/Random-Liu/followers","following_url":"https://api.github.com/users/Random-Liu/following{/other_user}","gists_url":"https://api.github.com/users/Random-Liu/gists{/gist_id}","starred_url":"https://api.github.com/users/Random-Liu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Random-Liu/subscriptions","organizations_url":"https://api.github.com/users/Random-Liu/orgs","repos_url":"https://api.github.com/users/Random-Liu/repos","events_url":"https://api.github.com/users/Random-Liu/events{/privacy}","received_events_url":"https://api.github.com/users/Random-Liu/received_events","type":"User","site_admin":false},"body":"For #20895.\r\n\r\nThis is the **first step** in the roadmap of switching to docker [engine-api](https://github.com/docker/engine-api).\r\nIn this PR, I keep the old `DockerInterface` and implement it with the new engine-api.\r\nWith this approach, we could switch to engine-api with minimum change, so that we could:\r\n* Test the engine-api without huge refactoring.\r\n* Send following PRs to refactor functions in `DockerInterface` separately so as to avoid a huge change in one PR.\r\n\r\nI've tested this PR locally, it passed all the node conformance test:\r\n```\r\nmake test_e2e_node\r\n\r\nRan 19 of 19 Specs in 823.395 seconds\r\nSUCCESS! -- 19 Passed | 0 Failed | 0 Pending | 0 Skipped PASS\r\n\r\nGinkgo ran 1 suite in 13m49.429979585s\r\nTest Suite Passed\r\n```\r\nAnd it also passed the jenkins gce e2e test:\r\n```\r\ngo run hack/e2e.go -test -v --test_args=\"--ginkgo.skip=\\[Slow\\]|\\[Serial\\]|\\[Disruptive\\]|\\[Flaky\\]|\\[Feature:.+\\]\"\r\n\r\nRan 161 of 268 Specs in 4570.214 seconds\r\nSUCCESS! -- 161 Passed | 0 Failed | 0 Pending | 107 Skipped PASS\r\n\r\nGinkgo ran 1 suite in 1h16m16.325934558s\r\nTest Suite Passed\r\n2016/03/25 15:12:42 e2e.go:196: Step 'Ginkgo tests' finished in 1h16m18.918754301s\r\n```\r\n\r\nI'm writing the design document, and will post the switching roadmap in an umbrella issue soon.\r\n\r\n@kubernetes/sig-node ","created_at":"2016-03-25T22:29:43Z","updated_at":"2016-03-28T17:06:49Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a9f9c02f560200af7b3eeb3dbf5f02029c5499d7","assignee":{"login":"yujuhong","id":10524058,"avatar_url":"https://avatars.githubusercontent.com/u/10524058?v=3","gravatar_id":"","url":"https://api.github.com/users/yujuhong","html_url":"https://github.com/yujuhong","followers_url":"https://api.github.com/users/yujuhong/followers","following_url":"https://api.github.com/users/yujuhong/following{/other_user}","gists_url":"https://api.github.com/users/yujuhong/gists{/gist_id}","starred_url":"https://api.github.com/users/yujuhong/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yujuhong/subscriptions","organizations_url":"https://api.github.com/users/yujuhong/orgs","repos_url":"https://api.github.com/users/yujuhong/repos","events_url":"https://api.github.com/users/yujuhong/events{/privacy}","received_events_url":"https://api.github.com/users/yujuhong/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/kubernetes/kubernetes/pulls/23506/commits","review_comments_url":"https://api.github.com/repos/kubernetes/kubernetes/pulls/23506/comments","review_comment_url":"https://api.github.com/repos/kubernetes/kubernetes/pulls/comments{/number}","comments_url":"https://api.github.com/repos/kubernetes/kubernetes/issues/23506/comments","statuses_url":"https://api.github.com/repos/kubernetes/kubernetes/statuses/c8fa0ab13d8f15fc843dcc0f80a02aa86b05f7c7","head":{"label":"Random-Liu:new-docker-client","ref":"new-docker-client","sha":"c8fa0ab13d8f15fc843dcc0f80a02aa86b05f7c7","user":{"login":"Random-Liu","id":5821883,"avatar_url":"https://avatars.githubusercontent.com/u/5821883?v=3","gravatar_id":"","url":"https://api.github.com/users/Random-Liu","html_url":"https://github.com/Random-Liu","followers_url":"https://api.github.com/users/Random-Liu/followers","following_url":"https://api.github.com/users/Random-Liu/following{/other_user}","gists_url":"https://api.github.com/users/Random-Liu/gists{/gist_id}","starred_url":"https://api.github.com/users/Random-Liu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Random-Liu/subscriptions","organizations_url":"https://api.github.com/users/Random-Liu/orgs","repos_url":"https://api.github.com/users/Random-Liu/repos","events_url":"https://api.github.com/users/Random-Liu/events{/privacy}","received_events_url":"https://api.github.com/users/Random-Liu/received_events","type":"User","site_admin":false},"repo":{"id":44042241,"name":"kubernetes","full_name":"Random-Liu/kubernetes","owner":{"login":"Random-Liu","id":5821883,"avatar_url":"https://avatars.githubusercontent.com/u/5821883?v=3","gravatar_id":"","url":"https://api.github.com/users/Random-Liu","html_url":"https://github.com/Random-Liu","followers_url":"https://api.github.com/users/Random-Liu/followers","following_url":"https://api.github.com/users/Random-Liu/following{/other_user}","gists_url":"https://api.github.com/users/Random-Liu/gists{/gist_id}","starred_url":"https://api.github.com/users/Random-Liu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Random-Liu/subscriptions","organizations_url":"https://api.github.com/users/Random-Liu/orgs","repos_url":"https://api.github.com/users/Random-Liu/repos","events_url":"https://api.github.com/users/Random-Liu/events{/privacy}","received_events_url":"https://api.github.com/users/Random-Liu/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Random-Liu/kubernetes","description":"Container Cluster Manager from Google","fork":true,"url":"https://api.github.com/repos/Random-Liu/kubernetes","forks_url":"https://api.github.com/repos/Random-Liu/kubernetes/forks","keys_url":"https://api.github.com/repos/Random-Liu/kubernetes/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Random-Liu/kubernetes/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Random-Liu/kubernetes/teams","hooks_url":"https://api.github.com/repos/Random-Liu/kubernetes/hooks","issue_events_url":"https://api.github.com/repos/Random-Liu/kubernetes/issues/events{/number}","events_url":"https://api.github.com/repos/Random-Liu/kubernetes/events","assignees_url":"https://api.github.com/repos/Random-Liu/kubernetes/assignees{/user}","branches_url":"https://api.github.com/repos/Random-Liu/kubernetes/branches{/branch}","tags_url":"https://api.github.com/repos/Random-Liu/kubernetes/tags","blobs_url":"https://api.github.com/repos/Random-Liu/kubernetes/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Random-Liu/kubernetes/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Random-Liu/kubernetes/git/refs{/sha}","trees_url":"https://api.github.com/repos/Random-Liu/kubernetes/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Random-Liu/kubernetes/statuses/{sha}","languages_url":"https://api.github.com/repos/Random-Liu/kubernetes/languages","stargazers_url":"https://api.github.com/repos/Random-Liu/kubernetes/stargazers","contributors_url":"https://api.github.com/repos/Random-Liu/kubernetes/contributors","subscribers_url":"https://api.github.com/repos/Random-Liu/kubernetes/subscribers","subscription_url":"https://api.github.com/repos/Random-Liu/kubernetes/subscription","commits_url":"https://api.github.com/repos/Random-Liu/kubernetes/commits{/sha}","git_commits_url":"https://api.github.com/repos/Random-Liu/kubernetes/git/commits{/sha}","comments_url":"https://api.github.com/repos/Random-Liu/kubernetes/comments{/number}","issue_comment_url":"https://api.github.com/repos/Random-Liu/kubernetes/issues/comments{/number}","contents_url":"https://api.github.com/repos/Random-Liu/kubernetes/contents/{+path}","compare_url":"https://api.github.com/repos/Random-Liu/kubernetes/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Random-Liu/kubernetes/merges","archive_url":"https://api.github.com/repos/Random-Liu/kubernetes/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Random-Liu/kubernetes/downloads","issues_url":"https://api.github.com/repos/Random-Liu/kubernetes/issues{/number}","pulls_url":"https://api.github.com/repos/Random-Liu/kubernetes/pulls{/number}","milestones_url":"https://api.github.com/repos/Random-Liu/kubernetes/milestones{/number}","notifications_url":"https://api.github.com/repos/Random-Liu/kubernetes/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Random-Liu/kubernetes/labels{/name}","releases_url":"https://api.github.com/repos/Random-Liu/kubernetes/releases{/id}","deployments_url":"https://api.github.com/repos/Random-Liu/kubernetes/deployments","created_at":"2015-10-11T06:51:00Z","updated_at":"2016-02-04T00:52:34Z","pushed_at":"2016-03-25T23:11:30Z","git_url":"git://github.com/Random-Liu/kubernetes.git","ssh_url":"git@github.com:Random-Liu/kubernetes.git","clone_url":"https://github.com/Random-Liu/kubernetes.git","svn_url":"https://github.com/Random-Liu/kubernetes","homepage":"http://kubernetes.io","size":181983,"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":"kubernetes:master","ref":"master","sha":"08e9ef0ef9f8c2feb138197d15a898be5892a315","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}","deployments_url":"https://api.github.com/repos/kubernetes/kubernetes/deployments","created_at":"2014-06-06T22:56:04Z","updated_at":"2016-03-28T15:10:07Z","pushed_at":"2016-03-28T16:57:29Z","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":346889,"stargazers_count":13554,"watchers_count":13554,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":3932,"mirror_url":null,"open_issues_count":3123,"forks":3932,"open_issues":3123,"watchers":13554,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/kubernetes/kubernetes/pulls/23506"},"html":{"href":"https://github.com/kubernetes/kubernetes/pull/23506"},"issue":{"href":"https://api.github.com/repos/kubernetes/kubernetes/issues/23506"},"comments":{"href":"https://api.github.com/repos/kubernetes/kubernetes/issues/23506/comments"},"review_comments":{"href":"https://api.github.com/repos/kubernetes/kubernetes/pulls/23506/comments"},"review_comment":{"href":"https://api.github.com/repos/kubernetes/kubernetes/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/kubernetes/kubernetes/pulls/23506/commits"},"statuses":{"href":"https://api.github.com/repos/kubernetes/kubernetes/statuses/c8fa0ab13d8f15fc843dcc0f80a02aa86b05f7c7"}}}}