{"action":"created","comment":{"url":"https://api.github.com/repos/containous/traefik/pulls/comments/60842088","id":60842088,"diff_hunk":"@@ -0,0 +1,175 @@\n+package provider\n+\n+import (\n+\tlog \"github.com/Sirupsen/logrus\"\n+\t\"github.com/cenkalti/backoff\"\n+\t\"github.com/containous/traefik/provider/k8s\"\n+\t\"github.com/containous/traefik/safe\"\n+\t\"github.com/containous/traefik/types\"\n+\t\"io/ioutil\"\n+\t\"os\"\n+\t\"text/template\"\n+\t\"time\"\n+)\n+\n+const (\n+\tserviceAccountToken  = \"/var/run/secrets/kubernetes.io/serviceaccount/token\"\n+\tserviceAccountCACert = \"/var/run/secrets/kubernetes.io/serviceaccount/ca.crt\"\n+)\n+\n+// Kubernetes holds configurations of the Kubernetes provider.\n+type Kubernetes struct {\n+\tBaseProvider `mapstructure:\",squash\"`\n+\tEndpoint     string\n+}\n+\n+func (provider *Kubernetes) createClient() (k8s.Client, error) {\n+\tvar token string\n+\ttokenBytes, err := ioutil.ReadFile(serviceAccountToken)\n+\tif err == nil {\n+\t\ttoken = string(tokenBytes)\n+\t\tlog.Debugf(\"Kubernetes token: %s\", token)\n+\t} else {\n+\t\tlog.Debugf(\"Kubernetes load token error: %s\", err)\n+\t}\n+\tcaCert, err := ioutil.ReadFile(serviceAccountCACert)\n+\tif err == nil {\n+\t\tlog.Debugf(\"Kubernetes CA cert: %s\", serviceAccountCACert)\n+\t} else {\n+\t\tlog.Debugf(\"Kubernetes load token error: %s\", err)","path":"provider/kubernetes.go","position":39,"original_position":39,"commit_id":"cac99273954cd76d5268a63271e1370326ce3b10","original_commit_id":"cac99273954cd76d5268a63271e1370326ce3b10","user":{"login":"vdemeester","id":6508,"avatar_url":"https://avatars.githubusercontent.com/u/6508?v=3","gravatar_id":"","url":"https://api.github.com/users/vdemeester","html_url":"https://github.com/vdemeester","followers_url":"https://api.github.com/users/vdemeester/followers","following_url":"https://api.github.com/users/vdemeester/following{/other_user}","gists_url":"https://api.github.com/users/vdemeester/gists{/gist_id}","starred_url":"https://api.github.com/users/vdemeester/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vdemeester/subscriptions","organizations_url":"https://api.github.com/users/vdemeester/orgs","repos_url":"https://api.github.com/users/vdemeester/repos","events_url":"https://api.github.com/users/vdemeester/events{/privacy}","received_events_url":"https://api.github.com/users/vdemeester/received_events","type":"User","site_admin":false},"body":"Only debug here ? If there is an error reading caCert, it's no big deal ? :sweat_smile: ","created_at":"2016-04-24T10:02:21Z","updated_at":"2016-04-24T10:02:21Z","html_url":"https://github.com/containous/traefik/pull/186#discussion_r60842088","pull_request_url":"https://api.github.com/repos/containous/traefik/pulls/186","_links":{"self":{"href":"https://api.github.com/repos/containous/traefik/pulls/comments/60842088"},"html":{"href":"https://github.com/containous/traefik/pull/186#discussion_r60842088"},"pull_request":{"href":"https://api.github.com/repos/containous/traefik/pulls/186"}}},"pull_request":{"url":"https://api.github.com/repos/containous/traefik/pulls/186","id":58791806,"html_url":"https://github.com/containous/traefik/pull/186","diff_url":"https://github.com/containous/traefik/pull/186.diff","patch_url":"https://github.com/containous/traefik/pull/186.patch","issue_url":"https://api.github.com/repos/containous/traefik/issues/186","number":186,"state":"open","locked":false,"title":"Add kubernetes Ingress backend","user":{"login":"emilevauge","id":6207234,"avatar_url":"https://avatars.githubusercontent.com/u/6207234?v=3","gravatar_id":"","url":"https://api.github.com/users/emilevauge","html_url":"https://github.com/emilevauge","followers_url":"https://api.github.com/users/emilevauge/followers","following_url":"https://api.github.com/users/emilevauge/following{/other_user}","gists_url":"https://api.github.com/users/emilevauge/gists{/gist_id}","starred_url":"https://api.github.com/users/emilevauge/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/emilevauge/subscriptions","organizations_url":"https://api.github.com/users/emilevauge/orgs","repos_url":"https://api.github.com/users/emilevauge/repos","events_url":"https://api.github.com/users/emilevauge/events{/privacy}","received_events_url":"https://api.github.com/users/emilevauge/received_events","type":"User","site_admin":false},"body":"This PR adds Kubernetes Ingress backend.\r\n\r\n> This implementation is working, but there is a major issue, the outrageous dependencies needed by the official k8s client: https://github.com/kubernetes/kubernetes/issues/11606.\r\n> \r\n> Unfortunately, this leads to a binary that weights **43M** (compared to **18M** initially)!\r\n> ```\r\n> -rwxr-xr-x 1 emile emile  43M févr.  9 19:50 traefik*\r\n> ```\r\n> \r\n> You are welcome to propose alternatives ;) I will not merge this one until a decent size is back.\r\n\r\nAs it seems that Kubernetes will not fix this issue soon, I decided to copy the API types into traefik and rewrite a Kubernetes Client. This allows traefik to keep its original size.  \r\n\r\n- [x] initial implementation\r\n- [x] clean code\r\n- [x] find alternative to k8s official API\r\n- [x] create an example k8s resources file\r\n- [x] doc\r\n\r\nFixes #11 \r\nFixes #186","created_at":"2016-02-09T18:54:33Z","updated_at":"2016-04-24T10:02:21Z","closed_at":null,"merged_at":null,"merge_commit_sha":"dbbeeec99905b0856b9ee0fdf84c6cb122c29779","assignee":{"login":"vdemeester","id":6508,"avatar_url":"https://avatars.githubusercontent.com/u/6508?v=3","gravatar_id":"","url":"https://api.github.com/users/vdemeester","html_url":"https://github.com/vdemeester","followers_url":"https://api.github.com/users/vdemeester/followers","following_url":"https://api.github.com/users/vdemeester/following{/other_user}","gists_url":"https://api.github.com/users/vdemeester/gists{/gist_id}","starred_url":"https://api.github.com/users/vdemeester/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vdemeester/subscriptions","organizations_url":"https://api.github.com/users/vdemeester/orgs","repos_url":"https://api.github.com/users/vdemeester/repos","events_url":"https://api.github.com/users/vdemeester/events{/privacy}","received_events_url":"https://api.github.com/users/vdemeester/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/containous/traefik/milestones/1","html_url":"https://github.com/containous/traefik/milestones/1.0","labels_url":"https://api.github.com/repos/containous/traefik/milestones/1/labels","id":1609475,"number":1,"title":"1.0","description":"","creator":{"login":"emilevauge","id":6207234,"avatar_url":"https://avatars.githubusercontent.com/u/6207234?v=3","gravatar_id":"","url":"https://api.github.com/users/emilevauge","html_url":"https://github.com/emilevauge","followers_url":"https://api.github.com/users/emilevauge/followers","following_url":"https://api.github.com/users/emilevauge/following{/other_user}","gists_url":"https://api.github.com/users/emilevauge/gists{/gist_id}","starred_url":"https://api.github.com/users/emilevauge/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/emilevauge/subscriptions","organizations_url":"https://api.github.com/users/emilevauge/orgs","repos_url":"https://api.github.com/users/emilevauge/repos","events_url":"https://api.github.com/users/emilevauge/events{/privacy}","received_events_url":"https://api.github.com/users/emilevauge/received_events","type":"User","site_admin":false},"open_issues":7,"closed_issues":59,"state":"open","created_at":"2016-02-27T14:44:28Z","updated_at":"2016-04-20T11:44:25Z","due_on":"2016-03-30T22:00:00Z","closed_at":null},"commits_url":"https://api.github.com/repos/containous/traefik/pulls/186/commits","review_comments_url":"https://api.github.com/repos/containous/traefik/pulls/186/comments","review_comment_url":"https://api.github.com/repos/containous/traefik/pulls/comments{/number}","comments_url":"https://api.github.com/repos/containous/traefik/issues/186/comments","statuses_url":"https://api.github.com/repos/containous/traefik/statuses/cac99273954cd76d5268a63271e1370326ce3b10","head":{"label":"containous:add-kubernetes-ingress-support","ref":"add-kubernetes-ingress-support","sha":"cac99273954cd76d5268a63271e1370326ce3b10","user":{"login":"containous","id":16349663,"avatar_url":"https://avatars.githubusercontent.com/u/16349663?v=3","gravatar_id":"","url":"https://api.github.com/users/containous","html_url":"https://github.com/containous","followers_url":"https://api.github.com/users/containous/followers","following_url":"https://api.github.com/users/containous/following{/other_user}","gists_url":"https://api.github.com/users/containous/gists{/gist_id}","starred_url":"https://api.github.com/users/containous/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/containous/subscriptions","organizations_url":"https://api.github.com/users/containous/orgs","repos_url":"https://api.github.com/users/containous/repos","events_url":"https://api.github.com/users/containous/events{/privacy}","received_events_url":"https://api.github.com/users/containous/received_events","type":"Organization","site_admin":false},"repo":{"id":42408804,"name":"traefik","full_name":"containous/traefik","owner":{"login":"containous","id":16349663,"avatar_url":"https://avatars.githubusercontent.com/u/16349663?v=3","gravatar_id":"","url":"https://api.github.com/users/containous","html_url":"https://github.com/containous","followers_url":"https://api.github.com/users/containous/followers","following_url":"https://api.github.com/users/containous/following{/other_user}","gists_url":"https://api.github.com/users/containous/gists{/gist_id}","starred_url":"https://api.github.com/users/containous/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/containous/subscriptions","organizations_url":"https://api.github.com/users/containous/orgs","repos_url":"https://api.github.com/users/containous/repos","events_url":"https://api.github.com/users/containous/events{/privacy}","received_events_url":"https://api.github.com/users/containous/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/containous/traefik","description":"Træfɪk, a modern reverse proxy","fork":false,"url":"https://api.github.com/repos/containous/traefik","forks_url":"https://api.github.com/repos/containous/traefik/forks","keys_url":"https://api.github.com/repos/containous/traefik/keys{/key_id}","collaborators_url":"https://api.github.com/repos/containous/traefik/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/containous/traefik/teams","hooks_url":"https://api.github.com/repos/containous/traefik/hooks","issue_events_url":"https://api.github.com/repos/containous/traefik/issues/events{/number}","events_url":"https://api.github.com/repos/containous/traefik/events","assignees_url":"https://api.github.com/repos/containous/traefik/assignees{/user}","branches_url":"https://api.github.com/repos/containous/traefik/branches{/branch}","tags_url":"https://api.github.com/repos/containous/traefik/tags","blobs_url":"https://api.github.com/repos/containous/traefik/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/containous/traefik/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/containous/traefik/git/refs{/sha}","trees_url":"https://api.github.com/repos/containous/traefik/git/trees{/sha}","statuses_url":"https://api.github.com/repos/containous/traefik/statuses/{sha}","languages_url":"https://api.github.com/repos/containous/traefik/languages","stargazers_url":"https://api.github.com/repos/containous/traefik/stargazers","contributors_url":"https://api.github.com/repos/containous/traefik/contributors","subscribers_url":"https://api.github.com/repos/containous/traefik/subscribers","subscription_url":"https://api.github.com/repos/containous/traefik/subscription","commits_url":"https://api.github.com/repos/containous/traefik/commits{/sha}","git_commits_url":"https://api.github.com/repos/containous/traefik/git/commits{/sha}","comments_url":"https://api.github.com/repos/containous/traefik/comments{/number}","issue_comment_url":"https://api.github.com/repos/containous/traefik/issues/comments{/number}","contents_url":"https://api.github.com/repos/containous/traefik/contents/{+path}","compare_url":"https://api.github.com/repos/containous/traefik/compare/{base}...{head}","merges_url":"https://api.github.com/repos/containous/traefik/merges","archive_url":"https://api.github.com/repos/containous/traefik/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/containous/traefik/downloads","issues_url":"https://api.github.com/repos/containous/traefik/issues{/number}","pulls_url":"https://api.github.com/repos/containous/traefik/pulls{/number}","milestones_url":"https://api.github.com/repos/containous/traefik/milestones{/number}","notifications_url":"https://api.github.com/repos/containous/traefik/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/containous/traefik/labels{/name}","releases_url":"https://api.github.com/repos/containous/traefik/releases{/id}","deployments_url":"https://api.github.com/repos/containous/traefik/deployments","created_at":"2015-09-13T19:04:02Z","updated_at":"2016-04-24T09:17:23Z","pushed_at":"2016-04-22T11:57:07Z","git_url":"git://github.com/containous/traefik.git","ssh_url":"git@github.com:containous/traefik.git","clone_url":"https://github.com/containous/traefik.git","svn_url":"https://github.com/containous/traefik","homepage":"https://traefik.io/","size":8488,"stargazers_count":1826,"watchers_count":1826,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":116,"mirror_url":null,"open_issues_count":59,"forks":116,"open_issues":59,"watchers":1826,"default_branch":"master"}},"base":{"label":"containous:master","ref":"master","sha":"6f474348331dc3b105def4bb0a515a6cb3073722","user":{"login":"containous","id":16349663,"avatar_url":"https://avatars.githubusercontent.com/u/16349663?v=3","gravatar_id":"","url":"https://api.github.com/users/containous","html_url":"https://github.com/containous","followers_url":"https://api.github.com/users/containous/followers","following_url":"https://api.github.com/users/containous/following{/other_user}","gists_url":"https://api.github.com/users/containous/gists{/gist_id}","starred_url":"https://api.github.com/users/containous/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/containous/subscriptions","organizations_url":"https://api.github.com/users/containous/orgs","repos_url":"https://api.github.com/users/containous/repos","events_url":"https://api.github.com/users/containous/events{/privacy}","received_events_url":"https://api.github.com/users/containous/received_events","type":"Organization","site_admin":false},"repo":{"id":42408804,"name":"traefik","full_name":"containous/traefik","owner":{"login":"containous","id":16349663,"avatar_url":"https://avatars.githubusercontent.com/u/16349663?v=3","gravatar_id":"","url":"https://api.github.com/users/containous","html_url":"https://github.com/containous","followers_url":"https://api.github.com/users/containous/followers","following_url":"https://api.github.com/users/containous/following{/other_user}","gists_url":"https://api.github.com/users/containous/gists{/gist_id}","starred_url":"https://api.github.com/users/containous/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/containous/subscriptions","organizations_url":"https://api.github.com/users/containous/orgs","repos_url":"https://api.github.com/users/containous/repos","events_url":"https://api.github.com/users/containous/events{/privacy}","received_events_url":"https://api.github.com/users/containous/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/containous/traefik","description":"Træfɪk, a modern reverse proxy","fork":false,"url":"https://api.github.com/repos/containous/traefik","forks_url":"https://api.github.com/repos/containous/traefik/forks","keys_url":"https://api.github.com/repos/containous/traefik/keys{/key_id}","collaborators_url":"https://api.github.com/repos/containous/traefik/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/containous/traefik/teams","hooks_url":"https://api.github.com/repos/containous/traefik/hooks","issue_events_url":"https://api.github.com/repos/containous/traefik/issues/events{/number}","events_url":"https://api.github.com/repos/containous/traefik/events","assignees_url":"https://api.github.com/repos/containous/traefik/assignees{/user}","branches_url":"https://api.github.com/repos/containous/traefik/branches{/branch}","tags_url":"https://api.github.com/repos/containous/traefik/tags","blobs_url":"https://api.github.com/repos/containous/traefik/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/containous/traefik/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/containous/traefik/git/refs{/sha}","trees_url":"https://api.github.com/repos/containous/traefik/git/trees{/sha}","statuses_url":"https://api.github.com/repos/containous/traefik/statuses/{sha}","languages_url":"https://api.github.com/repos/containous/traefik/languages","stargazers_url":"https://api.github.com/repos/containous/traefik/stargazers","contributors_url":"https://api.github.com/repos/containous/traefik/contributors","subscribers_url":"https://api.github.com/repos/containous/traefik/subscribers","subscription_url":"https://api.github.com/repos/containous/traefik/subscription","commits_url":"https://api.github.com/repos/containous/traefik/commits{/sha}","git_commits_url":"https://api.github.com/repos/containous/traefik/git/commits{/sha}","comments_url":"https://api.github.com/repos/containous/traefik/comments{/number}","issue_comment_url":"https://api.github.com/repos/containous/traefik/issues/comments{/number}","contents_url":"https://api.github.com/repos/containous/traefik/contents/{+path}","compare_url":"https://api.github.com/repos/containous/traefik/compare/{base}...{head}","merges_url":"https://api.github.com/repos/containous/traefik/merges","archive_url":"https://api.github.com/repos/containous/traefik/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/containous/traefik/downloads","issues_url":"https://api.github.com/repos/containous/traefik/issues{/number}","pulls_url":"https://api.github.com/repos/containous/traefik/pulls{/number}","milestones_url":"https://api.github.com/repos/containous/traefik/milestones{/number}","notifications_url":"https://api.github.com/repos/containous/traefik/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/containous/traefik/labels{/name}","releases_url":"https://api.github.com/repos/containous/traefik/releases{/id}","deployments_url":"https://api.github.com/repos/containous/traefik/deployments","created_at":"2015-09-13T19:04:02Z","updated_at":"2016-04-24T09:17:23Z","pushed_at":"2016-04-22T11:57:07Z","git_url":"git://github.com/containous/traefik.git","ssh_url":"git@github.com:containous/traefik.git","clone_url":"https://github.com/containous/traefik.git","svn_url":"https://github.com/containous/traefik","homepage":"https://traefik.io/","size":8488,"stargazers_count":1826,"watchers_count":1826,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":116,"mirror_url":null,"open_issues_count":59,"forks":116,"open_issues":59,"watchers":1826,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/containous/traefik/pulls/186"},"html":{"href":"https://github.com/containous/traefik/pull/186"},"issue":{"href":"https://api.github.com/repos/containous/traefik/issues/186"},"comments":{"href":"https://api.github.com/repos/containous/traefik/issues/186/comments"},"review_comments":{"href":"https://api.github.com/repos/containous/traefik/pulls/186/comments"},"review_comment":{"href":"https://api.github.com/repos/containous/traefik/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/containous/traefik/pulls/186/commits"},"statuses":{"href":"https://api.github.com/repos/containous/traefik/statuses/cac99273954cd76d5268a63271e1370326ce3b10"}}}}