{"action":"created","comment":{"url":"https://api.github.com/repos/kubernetes/dashboard/pulls/comments/120086594","pull_request_review_id":42020255,"id":120086594,"diff_hunk":"@@ -735,15 +570,21 @@ func (apiHandler *APIHandler) handleGetRbacRoleBindingList(request *restful.Requ\n \n func (apiHandler *APIHandler) handleGetCsrfToken(request *restful.Request, response *restful.Response) {\n \taction := request.PathParameter(\"action\")\n-\ttoken := xsrftoken.Generate(apiHandler.csrfKey, \"none\", action)\n-\tresponse.WriteHeaderAndEntity(http.StatusOK, CsrfToken{Token: token})\n+\ttoken := xsrftoken.Generate(apiHandler.manager.CSRFKey(), \"none\", action)\n+\tresponse.WriteHeaderAndEntity(http.StatusOK, api.CsrfToken{Token: token})\n }\n \n func (apiHandler *APIHandler) handleGetStatefulSetList(request *restful.Request, response *restful.Response) {\n+\tk8sClient, err := apiHandler.manager.Client(request)\n+\tif err != nil {","path":"src/app/backend/handler/apihandler.go","position":286,"original_position":286,"commit_id":"d8cf99c800de82a600c17f47625db1d2c77dcd77","original_commit_id":"c2e66d41f1545f86400714c0ff6df29b8630ad19","user":{"login":"floreks","id":2285385,"avatar_url":"https://avatars0.githubusercontent.com/u/2285385?v=3","gravatar_id":"","url":"https://api.github.com/users/floreks","html_url":"https://github.com/floreks","followers_url":"https://api.github.com/users/floreks/followers","following_url":"https://api.github.com/users/floreks/following{/other_user}","gists_url":"https://api.github.com/users/floreks/gists{/gist_id}","starred_url":"https://api.github.com/users/floreks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/floreks/subscriptions","organizations_url":"https://api.github.com/users/floreks/orgs","repos_url":"https://api.github.com/users/floreks/repos","events_url":"https://api.github.com/users/floreks/events{/privacy}","received_events_url":"https://api.github.com/users/floreks/received_events","type":"User","site_admin":false},"body":"We can't really handle errors while getting client because it is created from scratch on every request and we could end up in returning nil here without error, and that would lead to panic error. We can't also panic when client is not created. We can however test these methods eventually similar to how I have tested client manager.","created_at":"2017-06-05T11:03:03Z","updated_at":"2017-06-05T11:03:03Z","html_url":"https://github.com/kubernetes/dashboard/pull/2006#discussion_r120086594","pull_request_url":"https://api.github.com/repos/kubernetes/dashboard/pulls/2006","_links":{"self":{"href":"https://api.github.com/repos/kubernetes/dashboard/pulls/comments/120086594"},"html":{"href":"https://github.com/kubernetes/dashboard/pull/2006#discussion_r120086594"},"pull_request":{"href":"https://api.github.com/repos/kubernetes/dashboard/pulls/2006"}}},"pull_request":{"url":"https://api.github.com/repos/kubernetes/dashboard/pulls/2006","id":123691349,"html_url":"https://github.com/kubernetes/dashboard/pull/2006","diff_url":"https://github.com/kubernetes/dashboard/pull/2006.diff","patch_url":"https://github.com/kubernetes/dashboard/pull/2006.patch","issue_url":"https://api.github.com/repos/kubernetes/dashboard/issues/2006","number":2006,"state":"open","locked":false,"title":"Refactor api client creation","user":{"login":"floreks","id":2285385,"avatar_url":"https://avatars0.githubusercontent.com/u/2285385?v=3","gravatar_id":"","url":"https://api.github.com/users/floreks","html_url":"https://github.com/floreks","followers_url":"https://api.github.com/users/floreks/followers","following_url":"https://api.github.com/users/floreks/following{/other_user}","gists_url":"https://api.github.com/users/floreks/gists{/gist_id}","starred_url":"https://api.github.com/users/floreks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/floreks/subscriptions","organizations_url":"https://api.github.com/users/floreks/orgs","repos_url":"https://api.github.com/users/floreks/repos","events_url":"https://api.github.com/users/floreks/events{/privacy}","received_events_url":"https://api.github.com/users/floreks/received_events","type":"User","site_admin":false},"body":"Fixes #1998 \r\n\r\nI have prepared client manager that is responsible for creating client on every request, generating csrfKey, handling auth, etc.\r\n\r\nThere are many files changed as I've had to move some general types to single directory. They are now under `api/types.go`. We could think of moving all our api structures that we have in `backendapi.js` there.\r\n\r\n### Key files changed/moved\r\n`apihandler.go` - moved code to other files\r\n`apiserverclient.go` - removed and some code moved to `client/manager.go`\r\n`heapsterclient.go` moved to `integration/metric/heapster/client.go` as that's where I keep on my branch where I'm working on integrations page.\r\n`filter.go` - contains filter methods that were in `apihandler.go` before\r\n`verber.go` moved to `client/verber.go` as it is also a client and is created by `ClientManager`\r\n\r\nChanges in other files are renaming old packages to new ones. I have tested external config, in-cluster config and auth header and it works.\r\n\r\nTODO\r\n - [x] Add documentation\r\n - [x] Add some tests","created_at":"2017-06-02T10:50:09Z","updated_at":"2017-06-05T11:03:03Z","closed_at":null,"merged_at":null,"merge_commit_sha":"99d6783ace9666b3cf0f2300a515a14cbef8e4f5","assignee":{"login":"floreks","id":2285385,"avatar_url":"https://avatars0.githubusercontent.com/u/2285385?v=3","gravatar_id":"","url":"https://api.github.com/users/floreks","html_url":"https://github.com/floreks","followers_url":"https://api.github.com/users/floreks/followers","following_url":"https://api.github.com/users/floreks/following{/other_user}","gists_url":"https://api.github.com/users/floreks/gists{/gist_id}","starred_url":"https://api.github.com/users/floreks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/floreks/subscriptions","organizations_url":"https://api.github.com/users/floreks/orgs","repos_url":"https://api.github.com/users/floreks/repos","events_url":"https://api.github.com/users/floreks/events{/privacy}","received_events_url":"https://api.github.com/users/floreks/received_events","type":"User","site_admin":false},"assignees":[{"login":"floreks","id":2285385,"avatar_url":"https://avatars0.githubusercontent.com/u/2285385?v=3","gravatar_id":"","url":"https://api.github.com/users/floreks","html_url":"https://github.com/floreks","followers_url":"https://api.github.com/users/floreks/followers","following_url":"https://api.github.com/users/floreks/following{/other_user}","gists_url":"https://api.github.com/users/floreks/gists{/gist_id}","starred_url":"https://api.github.com/users/floreks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/floreks/subscriptions","organizations_url":"https://api.github.com/users/floreks/orgs","repos_url":"https://api.github.com/users/floreks/repos","events_url":"https://api.github.com/users/floreks/events{/privacy}","received_events_url":"https://api.github.com/users/floreks/received_events","type":"User","site_admin":false},{"login":"maciaszczykm","id":2823399,"avatar_url":"https://avatars0.githubusercontent.com/u/2823399?v=3","gravatar_id":"","url":"https://api.github.com/users/maciaszczykm","html_url":"https://github.com/maciaszczykm","followers_url":"https://api.github.com/users/maciaszczykm/followers","following_url":"https://api.github.com/users/maciaszczykm/following{/other_user}","gists_url":"https://api.github.com/users/maciaszczykm/gists{/gist_id}","starred_url":"https://api.github.com/users/maciaszczykm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/maciaszczykm/subscriptions","organizations_url":"https://api.github.com/users/maciaszczykm/orgs","repos_url":"https://api.github.com/users/maciaszczykm/repos","events_url":"https://api.github.com/users/maciaszczykm/events{/privacy}","received_events_url":"https://api.github.com/users/maciaszczykm/received_events","type":"User","site_admin":false}],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/kubernetes/dashboard/pulls/2006/commits","review_comments_url":"https://api.github.com/repos/kubernetes/dashboard/pulls/2006/comments","review_comment_url":"https://api.github.com/repos/kubernetes/dashboard/pulls/comments{/number}","comments_url":"https://api.github.com/repos/kubernetes/dashboard/issues/2006/comments","statuses_url":"https://api.github.com/repos/kubernetes/dashboard/statuses/d8cf99c800de82a600c17f47625db1d2c77dcd77","head":{"label":"floreks:dynamic-client-creator","ref":"dynamic-client-creator","sha":"d8cf99c800de82a600c17f47625db1d2c77dcd77","user":{"login":"floreks","id":2285385,"avatar_url":"https://avatars0.githubusercontent.com/u/2285385?v=3","gravatar_id":"","url":"https://api.github.com/users/floreks","html_url":"https://github.com/floreks","followers_url":"https://api.github.com/users/floreks/followers","following_url":"https://api.github.com/users/floreks/following{/other_user}","gists_url":"https://api.github.com/users/floreks/gists{/gist_id}","starred_url":"https://api.github.com/users/floreks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/floreks/subscriptions","organizations_url":"https://api.github.com/users/floreks/orgs","repos_url":"https://api.github.com/users/floreks/repos","events_url":"https://api.github.com/users/floreks/events{/privacy}","received_events_url":"https://api.github.com/users/floreks/received_events","type":"User","site_admin":false},"repo":{"id":45398177,"name":"dashboard","full_name":"floreks/dashboard","owner":{"login":"floreks","id":2285385,"avatar_url":"https://avatars0.githubusercontent.com/u/2285385?v=3","gravatar_id":"","url":"https://api.github.com/users/floreks","html_url":"https://github.com/floreks","followers_url":"https://api.github.com/users/floreks/followers","following_url":"https://api.github.com/users/floreks/following{/other_user}","gists_url":"https://api.github.com/users/floreks/gists{/gist_id}","starred_url":"https://api.github.com/users/floreks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/floreks/subscriptions","organizations_url":"https://api.github.com/users/floreks/orgs","repos_url":"https://api.github.com/users/floreks/repos","events_url":"https://api.github.com/users/floreks/events{/privacy}","received_events_url":"https://api.github.com/users/floreks/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/floreks/dashboard","description":null,"fork":true,"url":"https://api.github.com/repos/floreks/dashboard","forks_url":"https://api.github.com/repos/floreks/dashboard/forks","keys_url":"https://api.github.com/repos/floreks/dashboard/keys{/key_id}","collaborators_url":"https://api.github.com/repos/floreks/dashboard/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/floreks/dashboard/teams","hooks_url":"https://api.github.com/repos/floreks/dashboard/hooks","issue_events_url":"https://api.github.com/repos/floreks/dashboard/issues/events{/number}","events_url":"https://api.github.com/repos/floreks/dashboard/events","assignees_url":"https://api.github.com/repos/floreks/dashboard/assignees{/user}","branches_url":"https://api.github.com/repos/floreks/dashboard/branches{/branch}","tags_url":"https://api.github.com/repos/floreks/dashboard/tags","blobs_url":"https://api.github.com/repos/floreks/dashboard/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/floreks/dashboard/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/floreks/dashboard/git/refs{/sha}","trees_url":"https://api.github.com/repos/floreks/dashboard/git/trees{/sha}","statuses_url":"https://api.github.com/repos/floreks/dashboard/statuses/{sha}","languages_url":"https://api.github.com/repos/floreks/dashboard/languages","stargazers_url":"https://api.github.com/repos/floreks/dashboard/stargazers","contributors_url":"https://api.github.com/repos/floreks/dashboard/contributors","subscribers_url":"https://api.github.com/repos/floreks/dashboard/subscribers","subscription_url":"https://api.github.com/repos/floreks/dashboard/subscription","commits_url":"https://api.github.com/repos/floreks/dashboard/commits{/sha}","git_commits_url":"https://api.github.com/repos/floreks/dashboard/git/commits{/sha}","comments_url":"https://api.github.com/repos/floreks/dashboard/comments{/number}","issue_comment_url":"https://api.github.com/repos/floreks/dashboard/issues/comments{/number}","contents_url":"https://api.github.com/repos/floreks/dashboard/contents/{+path}","compare_url":"https://api.github.com/repos/floreks/dashboard/compare/{base}...{head}","merges_url":"https://api.github.com/repos/floreks/dashboard/merges","archive_url":"https://api.github.com/repos/floreks/dashboard/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/floreks/dashboard/downloads","issues_url":"https://api.github.com/repos/floreks/dashboard/issues{/number}","pulls_url":"https://api.github.com/repos/floreks/dashboard/pulls{/number}","milestones_url":"https://api.github.com/repos/floreks/dashboard/milestones{/number}","notifications_url":"https://api.github.com/repos/floreks/dashboard/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/floreks/dashboard/labels{/name}","releases_url":"https://api.github.com/repos/floreks/dashboard/releases{/id}","deployments_url":"https://api.github.com/repos/floreks/dashboard/deployments","created_at":"2015-11-02T14:06:15Z","updated_at":"2016-01-11T08:41:41Z","pushed_at":"2017-06-05T10:41:24Z","git_url":"git://github.com/floreks/dashboard.git","ssh_url":"git@github.com:floreks/dashboard.git","clone_url":"https://github.com/floreks/dashboard.git","svn_url":"https://github.com/floreks/dashboard","homepage":"","size":91155,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_projects":true,"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":"d92e51dd542a3b3bdcc7d955a9b5ed0620c9c2c5","user":{"login":"kubernetes","id":13629408,"avatar_url":"https://avatars1.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":44350607,"name":"dashboard","full_name":"kubernetes/dashboard","owner":{"login":"kubernetes","id":13629408,"avatar_url":"https://avatars1.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/dashboard","description":"General-purpose web UI for Kubernetes clusters","fork":false,"url":"https://api.github.com/repos/kubernetes/dashboard","forks_url":"https://api.github.com/repos/kubernetes/dashboard/forks","keys_url":"https://api.github.com/repos/kubernetes/dashboard/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kubernetes/dashboard/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kubernetes/dashboard/teams","hooks_url":"https://api.github.com/repos/kubernetes/dashboard/hooks","issue_events_url":"https://api.github.com/repos/kubernetes/dashboard/issues/events{/number}","events_url":"https://api.github.com/repos/kubernetes/dashboard/events","assignees_url":"https://api.github.com/repos/kubernetes/dashboard/assignees{/user}","branches_url":"https://api.github.com/repos/kubernetes/dashboard/branches{/branch}","tags_url":"https://api.github.com/repos/kubernetes/dashboard/tags","blobs_url":"https://api.github.com/repos/kubernetes/dashboard/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kubernetes/dashboard/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kubernetes/dashboard/git/refs{/sha}","trees_url":"https://api.github.com/repos/kubernetes/dashboard/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kubernetes/dashboard/statuses/{sha}","languages_url":"https://api.github.com/repos/kubernetes/dashboard/languages","stargazers_url":"https://api.github.com/repos/kubernetes/dashboard/stargazers","contributors_url":"https://api.github.com/repos/kubernetes/dashboard/contributors","subscribers_url":"https://api.github.com/repos/kubernetes/dashboard/subscribers","subscription_url":"https://api.github.com/repos/kubernetes/dashboard/subscription","commits_url":"https://api.github.com/repos/kubernetes/dashboard/commits{/sha}","git_commits_url":"https://api.github.com/repos/kubernetes/dashboard/git/commits{/sha}","comments_url":"https://api.github.com/repos/kubernetes/dashboard/comments{/number}","issue_comment_url":"https://api.github.com/repos/kubernetes/dashboard/issues/comments{/number}","contents_url":"https://api.github.com/repos/kubernetes/dashboard/contents/{+path}","compare_url":"https://api.github.com/repos/kubernetes/dashboard/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kubernetes/dashboard/merges","archive_url":"https://api.github.com/repos/kubernetes/dashboard/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kubernetes/dashboard/downloads","issues_url":"https://api.github.com/repos/kubernetes/dashboard/issues{/number}","pulls_url":"https://api.github.com/repos/kubernetes/dashboard/pulls{/number}","milestones_url":"https://api.github.com/repos/kubernetes/dashboard/milestones{/number}","notifications_url":"https://api.github.com/repos/kubernetes/dashboard/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kubernetes/dashboard/labels{/name}","releases_url":"https://api.github.com/repos/kubernetes/dashboard/releases{/id}","deployments_url":"https://api.github.com/repos/kubernetes/dashboard/deployments","created_at":"2015-10-15T23:09:14Z","updated_at":"2017-06-05T08:51:39Z","pushed_at":"2017-06-05T10:41:26Z","git_url":"git://github.com/kubernetes/dashboard.git","ssh_url":"git@github.com:kubernetes/dashboard.git","clone_url":"https://github.com/kubernetes/dashboard.git","svn_url":"https://github.com/kubernetes/dashboard","homepage":"","size":94558,"stargazers_count":1110,"watchers_count":1110,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":348,"mirror_url":null,"open_issues_count":133,"forks":348,"open_issues":133,"watchers":1110,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/kubernetes/dashboard/pulls/2006"},"html":{"href":"https://github.com/kubernetes/dashboard/pull/2006"},"issue":{"href":"https://api.github.com/repos/kubernetes/dashboard/issues/2006"},"comments":{"href":"https://api.github.com/repos/kubernetes/dashboard/issues/2006/comments"},"review_comments":{"href":"https://api.github.com/repos/kubernetes/dashboard/pulls/2006/comments"},"review_comment":{"href":"https://api.github.com/repos/kubernetes/dashboard/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/kubernetes/dashboard/pulls/2006/commits"},"statuses":{"href":"https://api.github.com/repos/kubernetes/dashboard/statuses/d8cf99c800de82a600c17f47625db1d2c77dcd77"}}}}
{"actor":{"display_login":"floreks"}}