{"action":"created","comment":{"url":"https://api.github.com/repos/openshift/origin/pulls/comments/27163906","id":27163906,"diff_hunk":"@@ -0,0 +1,142 @@\n+package origin\n+\n+import (\n+\t\"crypto/tls\"\n+\t\"fmt\"\n+\t\"net/http\"\n+\t\"net/url\"\n+\t\"time\"\n+\n+\t\"github.com/GoogleCloudPlatform/kubernetes/pkg/util\"\n+\t\"github.com/elazarl/go-bindata-assetfs\"\n+\t\"github.com/emicklei/go-restful\"\n+\t\"github.com/golang/glog\"\n+\t\"github.com/openshift/origin/pkg/assets\"\n+\tconfigapi \"github.com/openshift/origin/pkg/cmd/server/api\"\n+\tcmdutil \"github.com/openshift/origin/pkg/cmd/util\"\n+\t\"github.com/openshift/origin/pkg/version\"\n+)\n+\n+// InstallSupport registers endpoints for an OAuth2 server into the provided mux,\n+// then returns an array of strings indicating what endpoints were started\n+// (these are format strings that will expect to be sent a single string value).\n+func (c *AssetConfig) InstallAPI(container *restful.Container) []string {\n+\tassetHandler, err := c.handler()\n+\tif err != nil {\n+\t\tglog.Fatal(err)\n+\t}\n+\n+\tpublicURL, err := url.Parse(c.Options.PublicURL)\n+\tif err != nil {\n+\t\tglog.Fatal(err)\n+\t}\n+\n+\tmux := container.ServeMux\n+\tmux.Handle(publicURL.Path, http.StripPrefix(publicURL.Path, assetHandler))\n+\n+\treturn []string{fmt.Sprintf(\"Started OpenShift UI %%s%s\", publicURL.Path)}\n+}\n+\n+func (c *AssetConfig) Run() {\n+\tassetHandler, err := c.handler()\n+\tif err != nil {\n+\t\tglog.Fatal(err)\n+\t}\n+\n+\tpublicURL, err := url.Parse(c.Options.PublicURL)\n+\tif err != nil {\n+\t\tglog.Fatal(err)\n+\t}\n+\n+\tmux := http.NewServeMux()\n+\tmux.Handle(publicURL.Path, http.StripPrefix(publicURL.Path, assetHandler))\n+\tif publicURL.Path != \"/\" {\n+\t\tmux.HandleFunc(\"/\", func(w http.ResponseWriter, req *http.Request) {\n+\t\t\thttp.Redirect(w, req, publicURL.Path, http.StatusFound)\n+\t\t})\n+\t}\n+\n+\tserver := &http.Server{\n+\t\tAddr:           c.Options.ServingInfo.BindAddress,\n+\t\tHandler:        mux,\n+\t\tReadTimeout:    5 * time.Minute,\n+\t\tWriteTimeout:   5 * time.Minute,\n+\t\tMaxHeaderBytes: 1 << 20,\n+\t}\n+\n+\tisTLS := configapi.UseTLS(c.Options.ServingInfo)\n+\n+\tgo util.Forever(func() {\n+\t\tif isTLS {\n+\t\t\tserver.TLSConfig = &tls.Config{\n+\t\t\t\t// Change default from SSLv3 to TLSv1.0 (because of POODLE vulnerability)\n+\t\t\t\tMinVersion: tls.VersionTLS10,\n+\t\t\t}\n+\t\t\tglog.Infof(\"OpenShift UI listening at https://%s\", c.Options.ServingInfo.BindAddress)\n+\t\t\tglog.Fatal(server.ListenAndServeTLS(c.Options.ServingInfo.ServerCert.CertFile, c.Options.ServingInfo.ServerCert.KeyFile))\n+\t\t} else {\n+\t\t\tglog.Infof(\"OpenShift UI listening at http://%s\", c.Options.ServingInfo.BindAddress)\n+\t\t\tglog.Fatal(server.ListenAndServe())\n+\t\t}\n+\t}, 0)\n+\n+\t// Attempt to verify the server came up for 20 seconds (100 tries * 100ms, 100ms timeout per try)\n+\tcmdutil.WaitForSuccessfulDial(isTLS, \"tcp\", c.Options.ServingInfo.BindAddress, 100*time.Millisecond, 100*time.Millisecond, 100)\n+\n+\tglog.Infof(\"OpenShift UI available at %s\", c.Options.PublicURL)\n+}\n+\n+func (c *AssetConfig) handler() (http.Handler, error) {\n+\tassets.RegisterMimeTypes()\n+\n+\tmasterURL, err := url.Parse(c.Options.MasterPublicURL)\n+\tif err != nil {\n+\t\treturn nil, err\n+\t}\n+\n+\tk8sURL, err := url.Parse(c.Options.KubernetesPublicURL)\n+\tif err != nil {\n+\t\treturn nil, err\n+\t}\n+\n+\tpublicURL, err := url.Parse(c.Options.PublicURL)\n+\tif err != nil {\n+\t\tglog.Fatal(err)\n+\t}\n+\n+\tconfig := assets.WebConsoleConfig{\n+\t\tMasterAddr:        masterURL.Host,\n+\t\tMasterPrefix:      \"/osapi\", // TODO: make configurable\n+\t\tKubernetesAddr:    k8sURL.Host,\n+\t\tKubernetesPrefix:  \"/api\", // TODO: make configurable","path":"pkg/cmd/server/origin/asset.go","position":111,"original_position":111,"commit_id":"03fc31dd7802ac328b1949b74e57fb4564f408a8","original_commit_id":"03fc31dd7802ac328b1949b74e57fb4564f408a8","user":{"login":"liggitt","id":980082,"avatar_url":"https://avatars.githubusercontent.com/u/980082?v=3","gravatar_id":"","url":"https://api.github.com/users/liggitt","html_url":"https://github.com/liggitt","followers_url":"https://api.github.com/users/liggitt/followers","following_url":"https://api.github.com/users/liggitt/following{/other_user}","gists_url":"https://api.github.com/users/liggitt/gists{/gist_id}","starred_url":"https://api.github.com/users/liggitt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/liggitt/subscriptions","organizations_url":"https://api.github.com/users/liggitt/orgs","repos_url":"https://api.github.com/users/liggitt/repos","events_url":"https://api.github.com/users/liggitt/events{/privacy}","received_events_url":"https://api.github.com/users/liggitt/received_events","type":"User","site_admin":false},"body":"add `KubernetesAPIPrefix` constant beside `OpenShiftAPIPrefix`, move TODO there","created_at":"2015-03-25T20:44:21Z","updated_at":"2015-03-25T20:44:21Z","html_url":"https://github.com/openshift/origin/pull/1458#discussion_r27163906","pull_request_url":"https://api.github.com/repos/openshift/origin/pulls/1458","_links":{"self":{"href":"https://api.github.com/repos/openshift/origin/pulls/comments/27163906"},"html":{"href":"https://github.com/openshift/origin/pull/1458#discussion_r27163906"},"pull_request":{"href":"https://api.github.com/repos/openshift/origin/pulls/1458"}}},"pull_request":{"url":"https://api.github.com/repos/openshift/origin/pulls/1458","id":31955269,"html_url":"https://github.com/openshift/origin/pull/1458","diff_url":"https://github.com/openshift/origin/pull/1458.diff","patch_url":"https://github.com/openshift/origin/pull/1458.patch","issue_url":"https://api.github.com/repos/openshift/origin/issues/1458","number":1458,"state":"open","locked":false,"title":"[WIP] Serve web console from same port as API by default and allow configuring console's context root","user":{"login":"jwforres","id":1467629,"avatar_url":"https://avatars.githubusercontent.com/u/1467629?v=3","gravatar_id":"","url":"https://api.github.com/users/jwforres","html_url":"https://github.com/jwforres","followers_url":"https://api.github.com/users/jwforres/followers","following_url":"https://api.github.com/users/jwforres/following{/other_user}","gists_url":"https://api.github.com/users/jwforres/gists{/gist_id}","starred_url":"https://api.github.com/users/jwforres/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jwforres/subscriptions","organizations_url":"https://api.github.com/users/jwforres/orgs","repos_url":"https://api.github.com/users/jwforres/repos","events_url":"https://api.github.com/users/jwforres/events{/privacy}","received_events_url":"https://api.github.com/users/jwforres/received_events","type":"User","site_admin":false},"body":null,"created_at":"2015-03-25T19:04:51Z","updated_at":"2015-03-25T20:44:21Z","closed_at":null,"merged_at":null,"merge_commit_sha":"4a850c0bd641cfa2c1d69dfb18e2e9df469f1317","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/openshift/origin/pulls/1458/commits","review_comments_url":"https://api.github.com/repos/openshift/origin/pulls/1458/comments","review_comment_url":"https://api.github.com/repos/openshift/origin/pulls/comments{/number}","comments_url":"https://api.github.com/repos/openshift/origin/issues/1458/comments","statuses_url":"https://api.github.com/repos/openshift/origin/statuses/03fc31dd7802ac328b1949b74e57fb4564f408a8","head":{"label":"jwforres:unify_assets","ref":"unify_assets","sha":"03fc31dd7802ac328b1949b74e57fb4564f408a8","user":{"login":"jwforres","id":1467629,"avatar_url":"https://avatars.githubusercontent.com/u/1467629?v=3","gravatar_id":"","url":"https://api.github.com/users/jwforres","html_url":"https://github.com/jwforres","followers_url":"https://api.github.com/users/jwforres/followers","following_url":"https://api.github.com/users/jwforres/following{/other_user}","gists_url":"https://api.github.com/users/jwforres/gists{/gist_id}","starred_url":"https://api.github.com/users/jwforres/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jwforres/subscriptions","organizations_url":"https://api.github.com/users/jwforres/orgs","repos_url":"https://api.github.com/users/jwforres/repos","events_url":"https://api.github.com/users/jwforres/events{/privacy}","received_events_url":"https://api.github.com/users/jwforres/received_events","type":"User","site_admin":false},"repo":{"id":22971182,"name":"origin","full_name":"jwforres/origin","owner":{"login":"jwforres","id":1467629,"avatar_url":"https://avatars.githubusercontent.com/u/1467629?v=3","gravatar_id":"","url":"https://api.github.com/users/jwforres","html_url":"https://github.com/jwforres","followers_url":"https://api.github.com/users/jwforres/followers","following_url":"https://api.github.com/users/jwforres/following{/other_user}","gists_url":"https://api.github.com/users/jwforres/gists{/gist_id}","starred_url":"https://api.github.com/users/jwforres/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jwforres/subscriptions","organizations_url":"https://api.github.com/users/jwforres/orgs","repos_url":"https://api.github.com/users/jwforres/repos","events_url":"https://api.github.com/users/jwforres/events{/privacy}","received_events_url":"https://api.github.com/users/jwforres/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jwforres/origin","description":"OpenShift 3 - build, deploy, and manage your applications with Docker and Kubernetes","fork":true,"url":"https://api.github.com/repos/jwforres/origin","forks_url":"https://api.github.com/repos/jwforres/origin/forks","keys_url":"https://api.github.com/repos/jwforres/origin/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jwforres/origin/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jwforres/origin/teams","hooks_url":"https://api.github.com/repos/jwforres/origin/hooks","issue_events_url":"https://api.github.com/repos/jwforres/origin/issues/events{/number}","events_url":"https://api.github.com/repos/jwforres/origin/events","assignees_url":"https://api.github.com/repos/jwforres/origin/assignees{/user}","branches_url":"https://api.github.com/repos/jwforres/origin/branches{/branch}","tags_url":"https://api.github.com/repos/jwforres/origin/tags","blobs_url":"https://api.github.com/repos/jwforres/origin/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jwforres/origin/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jwforres/origin/git/refs{/sha}","trees_url":"https://api.github.com/repos/jwforres/origin/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jwforres/origin/statuses/{sha}","languages_url":"https://api.github.com/repos/jwforres/origin/languages","stargazers_url":"https://api.github.com/repos/jwforres/origin/stargazers","contributors_url":"https://api.github.com/repos/jwforres/origin/contributors","subscribers_url":"https://api.github.com/repos/jwforres/origin/subscribers","subscription_url":"https://api.github.com/repos/jwforres/origin/subscription","commits_url":"https://api.github.com/repos/jwforres/origin/commits{/sha}","git_commits_url":"https://api.github.com/repos/jwforres/origin/git/commits{/sha}","comments_url":"https://api.github.com/repos/jwforres/origin/comments{/number}","issue_comment_url":"https://api.github.com/repos/jwforres/origin/issues/comments{/number}","contents_url":"https://api.github.com/repos/jwforres/origin/contents/{+path}","compare_url":"https://api.github.com/repos/jwforres/origin/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jwforres/origin/merges","archive_url":"https://api.github.com/repos/jwforres/origin/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jwforres/origin/downloads","issues_url":"https://api.github.com/repos/jwforres/origin/issues{/number}","pulls_url":"https://api.github.com/repos/jwforres/origin/pulls{/number}","milestones_url":"https://api.github.com/repos/jwforres/origin/milestones{/number}","notifications_url":"https://api.github.com/repos/jwforres/origin/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jwforres/origin/labels{/name}","releases_url":"https://api.github.com/repos/jwforres/origin/releases{/id}","created_at":"2014-08-14T22:53:50Z","updated_at":"2015-01-15T19:24:31Z","pushed_at":"2015-03-25T19:06:54Z","git_url":"git://github.com/jwforres/origin.git","ssh_url":"git@github.com:jwforres/origin.git","clone_url":"https://github.com/jwforres/origin.git","svn_url":"https://github.com/jwforres/origin","homepage":"https://openshift.github.io","size":57444,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":0,"forks":1,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"openshift:master","ref":"master","sha":"6a1184aeec246f1339e8fb61a9ce8ec359ee9b19","user":{"login":"openshift","id":792337,"avatar_url":"https://avatars.githubusercontent.com/u/792337?v=3","gravatar_id":"","url":"https://api.github.com/users/openshift","html_url":"https://github.com/openshift","followers_url":"https://api.github.com/users/openshift/followers","following_url":"https://api.github.com/users/openshift/following{/other_user}","gists_url":"https://api.github.com/users/openshift/gists{/gist_id}","starred_url":"https://api.github.com/users/openshift/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openshift/subscriptions","organizations_url":"https://api.github.com/users/openshift/orgs","repos_url":"https://api.github.com/users/openshift/repos","events_url":"https://api.github.com/users/openshift/events{/privacy}","received_events_url":"https://api.github.com/users/openshift/received_events","type":"Organization","site_admin":false},"repo":{"id":22442668,"name":"origin","full_name":"openshift/origin","owner":{"login":"openshift","id":792337,"avatar_url":"https://avatars.githubusercontent.com/u/792337?v=3","gravatar_id":"","url":"https://api.github.com/users/openshift","html_url":"https://github.com/openshift","followers_url":"https://api.github.com/users/openshift/followers","following_url":"https://api.github.com/users/openshift/following{/other_user}","gists_url":"https://api.github.com/users/openshift/gists{/gist_id}","starred_url":"https://api.github.com/users/openshift/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openshift/subscriptions","organizations_url":"https://api.github.com/users/openshift/orgs","repos_url":"https://api.github.com/users/openshift/repos","events_url":"https://api.github.com/users/openshift/events{/privacy}","received_events_url":"https://api.github.com/users/openshift/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/openshift/origin","description":"OpenShift 3 - build, deploy, and manage your applications with Docker and Kubernetes","fork":false,"url":"https://api.github.com/repos/openshift/origin","forks_url":"https://api.github.com/repos/openshift/origin/forks","keys_url":"https://api.github.com/repos/openshift/origin/keys{/key_id}","collaborators_url":"https://api.github.com/repos/openshift/origin/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/openshift/origin/teams","hooks_url":"https://api.github.com/repos/openshift/origin/hooks","issue_events_url":"https://api.github.com/repos/openshift/origin/issues/events{/number}","events_url":"https://api.github.com/repos/openshift/origin/events","assignees_url":"https://api.github.com/repos/openshift/origin/assignees{/user}","branches_url":"https://api.github.com/repos/openshift/origin/branches{/branch}","tags_url":"https://api.github.com/repos/openshift/origin/tags","blobs_url":"https://api.github.com/repos/openshift/origin/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/openshift/origin/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/openshift/origin/git/refs{/sha}","trees_url":"https://api.github.com/repos/openshift/origin/git/trees{/sha}","statuses_url":"https://api.github.com/repos/openshift/origin/statuses/{sha}","languages_url":"https://api.github.com/repos/openshift/origin/languages","stargazers_url":"https://api.github.com/repos/openshift/origin/stargazers","contributors_url":"https://api.github.com/repos/openshift/origin/contributors","subscribers_url":"https://api.github.com/repos/openshift/origin/subscribers","subscription_url":"https://api.github.com/repos/openshift/origin/subscription","commits_url":"https://api.github.com/repos/openshift/origin/commits{/sha}","git_commits_url":"https://api.github.com/repos/openshift/origin/git/commits{/sha}","comments_url":"https://api.github.com/repos/openshift/origin/comments{/number}","issue_comment_url":"https://api.github.com/repos/openshift/origin/issues/comments{/number}","contents_url":"https://api.github.com/repos/openshift/origin/contents/{+path}","compare_url":"https://api.github.com/repos/openshift/origin/compare/{base}...{head}","merges_url":"https://api.github.com/repos/openshift/origin/merges","archive_url":"https://api.github.com/repos/openshift/origin/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/openshift/origin/downloads","issues_url":"https://api.github.com/repos/openshift/origin/issues{/number}","pulls_url":"https://api.github.com/repos/openshift/origin/pulls{/number}","milestones_url":"https://api.github.com/repos/openshift/origin/milestones{/number}","notifications_url":"https://api.github.com/repos/openshift/origin/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/openshift/origin/labels{/name}","releases_url":"https://api.github.com/repos/openshift/origin/releases{/id}","created_at":"2014-07-30T20:04:05Z","updated_at":"2015-03-25T19:49:20Z","pushed_at":"2015-03-25T20:43:24Z","git_url":"git://github.com/openshift/origin.git","ssh_url":"git@github.com:openshift/origin.git","clone_url":"https://github.com/openshift/origin.git","svn_url":"https://github.com/openshift/origin","homepage":"http://www.openshift.org","size":80981,"stargazers_count":326,"watchers_count":326,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":173,"mirror_url":null,"open_issues_count":149,"forks":173,"open_issues":149,"watchers":326,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/openshift/origin/pulls/1458"},"html":{"href":"https://github.com/openshift/origin/pull/1458"},"issue":{"href":"https://api.github.com/repos/openshift/origin/issues/1458"},"comments":{"href":"https://api.github.com/repos/openshift/origin/issues/1458/comments"},"review_comments":{"href":"https://api.github.com/repos/openshift/origin/pulls/1458/comments"},"review_comment":{"href":"https://api.github.com/repos/openshift/origin/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/openshift/origin/pulls/1458/commits"},"statuses":{"href":"https://api.github.com/repos/openshift/origin/statuses/03fc31dd7802ac328b1949b74e57fb4564f408a8"}}}}