{"action":"created","comment":{"url":"https://api.github.com/repos/kubernetes/kubernetes/pulls/comments/40014025","id":40014025,"diff_hunk":"@@ -0,0 +1,232 @@\n+/*\n+Copyright 2014 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 cni\n+\n+import (\n+\t\"fmt\"\n+\t\"github.com/appc/cni/libcni\"\n+\tcniTypes \"github.com/appc/cni/pkg/types\"\n+\t\"github.com/golang/glog\"\n+\t\"k8s.io/kubernetes/pkg/api\"\n+\t\"k8s.io/kubernetes/pkg/kubelet/network\"\n+\tkubeletTypes \"k8s.io/kubernetes/pkg/kubelet/types\"\n+\t\"net\"\n+\t\"sort\"\n+)\n+\n+const (\n+\tCNIPluginName        = \"cni\"\n+\tDefaultPluginName    = \"kubernetes-bridge\"\n+\tDefaultNetDir        = \"/etc/cni/net.d\"\n+\tDefaultCNIDir        = \"/opt/cni/bin\"\n+\tVendorCNIDirTemplate = \"/opt/%s/bin\"\n+)\n+\n+type cniNetworkPlugin struct {\n+\tcniNetworkMap map[string]*cniNetwork\n+\thost          network.Host\n+}\n+\n+type cniNetwork struct {\n+\tname          string\n+\tNetworkConfig *libcni.NetworkConfig\n+\tCNIConfig     *libcni.CNIConfig\n+}\n+\n+func ProbeNetworkPlugins() []network.NetworkPlugin {\n+\tconfigList := make([]network.NetworkPlugin, 0)\n+\treturn append(configList, &cniNetworkPlugin{cniNetworkMap: getAllCNINetworks()})\n+}\n+\n+func getAllCNINetworks() map[string]*cniNetwork {\n+\tnetworkMap := make(map[string]*cniNetwork)\n+\tfiles, err := libcni.ConfFiles(DefaultNetDir)\n+\tswitch {\n+\tcase err != nil:\n+\t\treturn networkMap\n+\tcase files == nil || len(files) == 0:\n+\t\treturn networkMap\n+\t}\n+\n+\tsort.Strings(files)\n+\tfor _, confFile := range files {\n+\t\tconf, err := libcni.ConfFromFile(confFile)\n+\t\tif err != nil {\n+\t\t\tglog.Warningf(\"Error loading CNI config file %s: %v\", confFile, err)\n+\t\t\tcontinue\n+\t\t}\n+\t\t// Search for vendor-specific plugins as well as default plugins in the CNI codebase.","path":"pkg/kubelet/network/cni/cni.go","position":77,"original_position":72,"commit_id":"f22759c8335a6b6504acbdcbd137235c1c432e1d","original_commit_id":"53c59b4859232e59a744abe5c794fdfc9fcf97f4","user":{"login":"thockin","id":5595220,"avatar_url":"https://avatars.githubusercontent.com/u/5595220?v=3","gravatar_id":"","url":"https://api.github.com/users/thockin","html_url":"https://github.com/thockin","followers_url":"https://api.github.com/users/thockin/followers","following_url":"https://api.github.com/users/thockin/following{/other_user}","gists_url":"https://api.github.com/users/thockin/gists{/gist_id}","starred_url":"https://api.github.com/users/thockin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thockin/subscriptions","organizations_url":"https://api.github.com/users/thockin/orgs","repos_url":"https://api.github.com/users/thockin/repos","events_url":"https://api.github.com/users/thockin/events{/privacy}","received_events_url":"https://api.github.com/users/thockin/received_events","type":"User","site_admin":false},"body":"But should the dir be named after the plugin or after the network?  I could see `/opt/cni/FooBar/FooBar` being considered a peer of `/opt/cni/TopLevel`, but naming by network name feels weird to me.\r\n\r\nAnd I am sort of against hypotheticals.  Having a dir to group files resonates, but does that need to be reflected here, or can this just be a symlink to a bin in another dir?","created_at":"2015-09-21T19:26:08Z","updated_at":"2015-09-21T19:26:08Z","html_url":"https://github.com/kubernetes/kubernetes/pull/13766#discussion_r40014025","pull_request_url":"https://api.github.com/repos/kubernetes/kubernetes/pulls/13766","_links":{"self":{"href":"https://api.github.com/repos/kubernetes/kubernetes/pulls/comments/40014025"},"html":{"href":"https://github.com/kubernetes/kubernetes/pull/13766#discussion_r40014025"},"pull_request":{"href":"https://api.github.com/repos/kubernetes/kubernetes/pulls/13766"}}},"pull_request":{"url":"https://api.github.com/repos/kubernetes/kubernetes/pulls/13766","id":44605868,"html_url":"https://github.com/kubernetes/kubernetes/pull/13766","diff_url":"https://github.com/kubernetes/kubernetes/pull/13766.diff","patch_url":"https://github.com/kubernetes/kubernetes/pull/13766.patch","issue_url":"https://api.github.com/repos/kubernetes/kubernetes/issues/13766","number":13766,"state":"open","locked":false,"title":"[WIP] cni network plugin","user":{"login":"rajatchopra","id":982221,"avatar_url":"https://avatars.githubusercontent.com/u/982221?v=3","gravatar_id":"","url":"https://api.github.com/users/rajatchopra","html_url":"https://github.com/rajatchopra","followers_url":"https://api.github.com/users/rajatchopra/followers","following_url":"https://api.github.com/users/rajatchopra/following{/other_user}","gists_url":"https://api.github.com/users/rajatchopra/gists{/gist_id}","starred_url":"https://api.github.com/users/rajatchopra/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rajatchopra/subscriptions","organizations_url":"https://api.github.com/users/rajatchopra/orgs","repos_url":"https://api.github.com/users/rajatchopra/repos","events_url":"https://api.github.com/users/rajatchopra/events{/privacy}","received_events_url":"https://api.github.com/users/rajatchopra/received_events","type":"User","site_admin":false},"body":"This is a proposal only. DO NOT MERGE.\r\nAlternate implementation to https://github.com/kubernetes/kubernetes/pull/13692\r\n\r\nImplements CNI as a network plugin (and not replace the network plugin infrastructure). This allows compiled in plugins to work too. Two advantages to compile-in plugins stay then: speed gains of in-band execution, flexibility with parameters (cni/exec hardcodes only three - name/namespace/id).\r\n\r\n@Symmetric @squaremo @kubernetes/rh-networking @thockin ","created_at":"2015-09-09T21:58:51Z","updated_at":"2015-09-21T19:26:08Z","closed_at":null,"merged_at":null,"merge_commit_sha":"3898580a638130704c30bce0d7359b302170ba49","assignee":{"login":"thockin","id":5595220,"avatar_url":"https://avatars.githubusercontent.com/u/5595220?v=3","gravatar_id":"","url":"https://api.github.com/users/thockin","html_url":"https://github.com/thockin","followers_url":"https://api.github.com/users/thockin/followers","following_url":"https://api.github.com/users/thockin/following{/other_user}","gists_url":"https://api.github.com/users/thockin/gists{/gist_id}","starred_url":"https://api.github.com/users/thockin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thockin/subscriptions","organizations_url":"https://api.github.com/users/thockin/orgs","repos_url":"https://api.github.com/users/thockin/repos","events_url":"https://api.github.com/users/thockin/events{/privacy}","received_events_url":"https://api.github.com/users/thockin/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/kubernetes/kubernetes/pulls/13766/commits","review_comments_url":"https://api.github.com/repos/kubernetes/kubernetes/pulls/13766/comments","review_comment_url":"https://api.github.com/repos/kubernetes/kubernetes/pulls/comments{/number}","comments_url":"https://api.github.com/repos/kubernetes/kubernetes/issues/13766/comments","statuses_url":"https://api.github.com/repos/kubernetes/kubernetes/statuses/f22759c8335a6b6504acbdcbd137235c1c432e1d","head":{"label":"rajatchopra:cni","ref":"cni","sha":"f22759c8335a6b6504acbdcbd137235c1c432e1d","user":{"login":"rajatchopra","id":982221,"avatar_url":"https://avatars.githubusercontent.com/u/982221?v=3","gravatar_id":"","url":"https://api.github.com/users/rajatchopra","html_url":"https://github.com/rajatchopra","followers_url":"https://api.github.com/users/rajatchopra/followers","following_url":"https://api.github.com/users/rajatchopra/following{/other_user}","gists_url":"https://api.github.com/users/rajatchopra/gists{/gist_id}","starred_url":"https://api.github.com/users/rajatchopra/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rajatchopra/subscriptions","organizations_url":"https://api.github.com/users/rajatchopra/orgs","repos_url":"https://api.github.com/users/rajatchopra/repos","events_url":"https://api.github.com/users/rajatchopra/events{/privacy}","received_events_url":"https://api.github.com/users/rajatchopra/received_events","type":"User","site_admin":false},"repo":{"id":22663851,"name":"kubernetes","full_name":"rajatchopra/kubernetes","owner":{"login":"rajatchopra","id":982221,"avatar_url":"https://avatars.githubusercontent.com/u/982221?v=3","gravatar_id":"","url":"https://api.github.com/users/rajatchopra","html_url":"https://github.com/rajatchopra","followers_url":"https://api.github.com/users/rajatchopra/followers","following_url":"https://api.github.com/users/rajatchopra/following{/other_user}","gists_url":"https://api.github.com/users/rajatchopra/gists{/gist_id}","starred_url":"https://api.github.com/users/rajatchopra/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rajatchopra/subscriptions","organizations_url":"https://api.github.com/users/rajatchopra/orgs","repos_url":"https://api.github.com/users/rajatchopra/repos","events_url":"https://api.github.com/users/rajatchopra/events{/privacy}","received_events_url":"https://api.github.com/users/rajatchopra/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/rajatchopra/kubernetes","description":"Container Cluster Manager","fork":true,"url":"https://api.github.com/repos/rajatchopra/kubernetes","forks_url":"https://api.github.com/repos/rajatchopra/kubernetes/forks","keys_url":"https://api.github.com/repos/rajatchopra/kubernetes/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rajatchopra/kubernetes/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rajatchopra/kubernetes/teams","hooks_url":"https://api.github.com/repos/rajatchopra/kubernetes/hooks","issue_events_url":"https://api.github.com/repos/rajatchopra/kubernetes/issues/events{/number}","events_url":"https://api.github.com/repos/rajatchopra/kubernetes/events","assignees_url":"https://api.github.com/repos/rajatchopra/kubernetes/assignees{/user}","branches_url":"https://api.github.com/repos/rajatchopra/kubernetes/branches{/branch}","tags_url":"https://api.github.com/repos/rajatchopra/kubernetes/tags","blobs_url":"https://api.github.com/repos/rajatchopra/kubernetes/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rajatchopra/kubernetes/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rajatchopra/kubernetes/git/refs{/sha}","trees_url":"https://api.github.com/repos/rajatchopra/kubernetes/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rajatchopra/kubernetes/statuses/{sha}","languages_url":"https://api.github.com/repos/rajatchopra/kubernetes/languages","stargazers_url":"https://api.github.com/repos/rajatchopra/kubernetes/stargazers","contributors_url":"https://api.github.com/repos/rajatchopra/kubernetes/contributors","subscribers_url":"https://api.github.com/repos/rajatchopra/kubernetes/subscribers","subscription_url":"https://api.github.com/repos/rajatchopra/kubernetes/subscription","commits_url":"https://api.github.com/repos/rajatchopra/kubernetes/commits{/sha}","git_commits_url":"https://api.github.com/repos/rajatchopra/kubernetes/git/commits{/sha}","comments_url":"https://api.github.com/repos/rajatchopra/kubernetes/comments{/number}","issue_comment_url":"https://api.github.com/repos/rajatchopra/kubernetes/issues/comments{/number}","contents_url":"https://api.github.com/repos/rajatchopra/kubernetes/contents/{+path}","compare_url":"https://api.github.com/repos/rajatchopra/kubernetes/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rajatchopra/kubernetes/merges","archive_url":"https://api.github.com/repos/rajatchopra/kubernetes/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rajatchopra/kubernetes/downloads","issues_url":"https://api.github.com/repos/rajatchopra/kubernetes/issues{/number}","pulls_url":"https://api.github.com/repos/rajatchopra/kubernetes/pulls{/number}","milestones_url":"https://api.github.com/repos/rajatchopra/kubernetes/milestones{/number}","notifications_url":"https://api.github.com/repos/rajatchopra/kubernetes/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rajatchopra/kubernetes/labels{/name}","releases_url":"https://api.github.com/repos/rajatchopra/kubernetes/releases{/id}","created_at":"2014-08-06T00:14:36Z","updated_at":"2015-02-11T21:45:21Z","pushed_at":"2015-09-19T02:15:11Z","git_url":"git://github.com/rajatchopra/kubernetes.git","ssh_url":"git@github.com:rajatchopra/kubernetes.git","clone_url":"https://github.com/rajatchopra/kubernetes.git","svn_url":"https://github.com/rajatchopra/kubernetes","homepage":null,"size":108032,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":0,"forks":2,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"kubernetes:master","ref":"master","sha":"8a95a82c88925bc5b596db54384fe2516f4018a1","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-09-21T18:43:04Z","pushed_at":"2015-09-21T19:24: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":421952,"stargazers_count":10352,"watchers_count":10352,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":2568,"mirror_url":null,"open_issues_count":1818,"forks":2568,"open_issues":1818,"watchers":10352,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/kubernetes/kubernetes/pulls/13766"},"html":{"href":"https://github.com/kubernetes/kubernetes/pull/13766"},"issue":{"href":"https://api.github.com/repos/kubernetes/kubernetes/issues/13766"},"comments":{"href":"https://api.github.com/repos/kubernetes/kubernetes/issues/13766/comments"},"review_comments":{"href":"https://api.github.com/repos/kubernetes/kubernetes/pulls/13766/comments"},"review_comment":{"href":"https://api.github.com/repos/kubernetes/kubernetes/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/kubernetes/kubernetes/pulls/13766/commits"},"statuses":{"href":"https://api.github.com/repos/kubernetes/kubernetes/statuses/f22759c8335a6b6504acbdcbd137235c1c432e1d"}}}}