{"action":"created","comment":{"url":"https://api.github.com/repos/openshift/ansible-service-broker/pulls/comments/183478781","pull_request_review_id":114484819,"id":183478781,"diff_hunk":"@@ -0,0 +1,121 @@\n+//\n+// Copyright (c) 2018 Red Hat, Inc.\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 main\n+\n+import (\n+\t\"flag\"\n+\t\"fmt\"\n+\t\"net/http\"\n+\t\"net/url\"\n+\n+\tcrd \"github.com/openshift/ansible-service-broker/pkg/dao/crd\"\n+\n+\t\"github.com/sirupsen/logrus\"\n+)\n+\n+var options struct {\n+\tBrokerNamespace string\n+\tPort            int\n+}\n+\n+func init() {\n+\tflag.IntVar(&options.Port, \"port\", 1337, \"port that the dashboard-redirector should listen on\")\n+\tflag.StringVar(&options.BrokerNamespace, \"namespace\", \"ansible-service-broker\", \"namespace that the broker resides in\")\n+\tflag.Parse()\n+}\n+\n+var crdDao *crd.Dao\n+\n+func main() {\n+\tvar err error\n+\n+\tcrdDao, err = crd.NewDao(options.BrokerNamespace)\n+\tif err != nil {\n+\t\tpanic(fmt.Sprintf(\"Unable to create crd client - %v\", err))\n+\t}\n+\n+\tlogrus.Info(\"Trying to load batch specs as a sanity check...\")\n+\tspecs, err := crdDao.BatchGetSpecs(\"\")\n+\tif err != nil {\n+\t\tpanic(fmt.Sprintf(\"Sanity check failed! -> %v\", err))\n+\t} else {\n+\t\tlogrus.Info(\"Sanity check passed! Loaded specs: %v\", specs)\n+\t}\n+\n+\thttp.HandleFunc(\"/\", redirect)\n+\tportStr := fmt.Sprintf(\":%d\", options.Port)\n+\n+\tlogrus.Infof(\"Dashboard redirector listening on port [%s]\", portStr)\n+\terr = http.ListenAndServe(portStr, nil)\n+\tif err != nil {\n+\t\tlogrus.Fatal(\"ListenAndServe: \", err)\n+\t}\n+}\n+\n+func redirect(w http.ResponseWriter, r *http.Request) {\n+\tvar errMsg string\n+\tlogrus.Info(\"Checking for form\")\n+\n+\tid := r.FormValue(\"id\")\n+\tif id == \"\" {\n+\t\terrMsg := \"Did not find service instance id as a query param!\"\n+\t\tlogrus.Error(errMsg)\n+\t\thttp.Error(w, errMsg, http.StatusBadRequest)\n+\t\treturn\n+\t}\n+\n+\tlogrus.Infof(\"Got request for service instance %s, looking up dashboard_url\", id)\n+\n+\tsi, err := crdDao.GetServiceInstance(id)\n+\tif err != nil {\n+\t\tvar errMsg string\n+\t\tif crdDao.IsNotFoundError(err) {\n+\t\t\terrMsg = fmt.Sprintf(\"Requested service instance with id %s not found.\", id)\n+\t\t\thttp.Error(w, errMsg, http.StatusNotFound)\n+\t\t} else {\n+\t\t\terrMsg = fmt.Sprintf(\"Something went wrong trying to load service instance [%s] -> %s\", id, err)\n+\t\t\thttp.Error(w, errMsg, http.StatusInternalServerError)\n+\t\t}\n+\t\tlogrus.Errorf(errMsg, id, err.Error())","path":"cmd/dashboard-redirector/main.go","position":null,"original_position":93,"commit_id":"f054515af9aba8397945eaca43ed609a85fa1d9d","original_commit_id":"6a74ee8ff18132301916926da836c8b6a8557b55","user":{"login":"eriknelson","id":410933,"avatar_url":"https://avatars3.githubusercontent.com/u/410933?v=4","gravatar_id":"","url":"https://api.github.com/users/eriknelson","html_url":"https://github.com/eriknelson","followers_url":"https://api.github.com/users/eriknelson/followers","following_url":"https://api.github.com/users/eriknelson/following{/other_user}","gists_url":"https://api.github.com/users/eriknelson/gists{/gist_id}","starred_url":"https://api.github.com/users/eriknelson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eriknelson/subscriptions","organizations_url":"https://api.github.com/users/eriknelson/orgs","repos_url":"https://api.github.com/users/eriknelson/repos","events_url":"https://api.github.com/users/eriknelson/events{/privacy}","received_events_url":"https://api.github.com/users/eriknelson/received_events","type":"User","site_admin":false},"body":"Updated!","created_at":"2018-04-23T17:38:19Z","updated_at":"2018-04-23T17:38:19Z","html_url":"https://github.com/openshift/ansible-service-broker/pull/897#discussion_r183478781","pull_request_url":"https://api.github.com/repos/openshift/ansible-service-broker/pulls/897","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/openshift/ansible-service-broker/pulls/comments/183478781"},"html":{"href":"https://github.com/openshift/ansible-service-broker/pull/897#discussion_r183478781"},"pull_request":{"href":"https://api.github.com/repos/openshift/ansible-service-broker/pulls/897"}},"in_reply_to_id":183473001},"pull_request":{"url":"https://api.github.com/repos/openshift/ansible-service-broker/pulls/897","id":182836770,"html_url":"https://github.com/openshift/ansible-service-broker/pull/897","diff_url":"https://github.com/openshift/ansible-service-broker/pull/897.diff","patch_url":"https://github.com/openshift/ansible-service-broker/pull/897.patch","issue_url":"https://api.github.com/repos/openshift/ansible-service-broker/issues/897","number":897,"state":"open","locked":false,"title":"Bug 1569220 - Add dashboard redirector feature","user":{"login":"eriknelson","id":410933,"avatar_url":"https://avatars3.githubusercontent.com/u/410933?v=4","gravatar_id":"","url":"https://api.github.com/users/eriknelson","html_url":"https://github.com/eriknelson","followers_url":"https://api.github.com/users/eriknelson/followers","following_url":"https://api.github.com/users/eriknelson/following{/other_user}","gists_url":"https://api.github.com/users/eriknelson/gists{/gist_id}","starred_url":"https://api.github.com/users/eriknelson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eriknelson/subscriptions","organizations_url":"https://api.github.com/users/eriknelson/orgs","repos_url":"https://api.github.com/users/eriknelson/repos","events_url":"https://api.github.com/users/eriknelson/events{/privacy}","received_events_url":"https://api.github.com/users/eriknelson/received_events","type":"User","site_admin":false},"body":"#### Describe what this PR does and why we need it:\r\nThis PR adds support for async provisioned dashboard urls. This is [currently not possible with the OSB spec](https://github.com/openservicebrokerapi/servicebroker/issues/4980), so our solution is to add a redirect service that runs alongside the broker. The broker immediately returns a URL to the redirector service as a sort of \"future\" url, that will ultimately redirect to an APB's specified `dashboard_url` location at the conclusion of its provision run.\r\n\r\nA few notes:\r\n* This feature requires an APB to be built on top of an `apb-base` that carries the dashboard redirector ansible module.\r\n* The broker author must specify in an `alpha` section of their APB spec that they would like to enable this feature. [Example APB](https://github.com/eriknelson/dashboard-url-apb/blob/master/apb.yml#L14).\r\n* The deployment of the broker must have the route to the dashboard redirector service specified in the broker's configmap. [We have a sensible default configured in the template for this](https://github.com/openshift/ansible-service-broker/blob/feature-add-dashboard-url/templates/deploy-ansible-service-broker.template.yaml#L287).\r\n* This is entirely opt in; there should be no change to existing behavior unless the feature is explicitly opted into by an APB author.\r\n\r\n#### Changes proposed in this pull request\r\n* Update bundle-lib and broker-client-go dependencies to bring in `DashboardURL` and `Alpha` feature gate support.\r\n* Update broker to check if conditions are right to use the feature.\r\n* Returns a `DashboardURL` on initial async provision response that points to the dashboard redirector service if the feature is enabled.\r\n* Adds dashboard-redirector binary and modifies the build files to bake it into the broker image.\r\n* Updates template to deploy the dashboard-redirector alongside the broker.\r\n","created_at":"2018-04-19T16:48:20Z","updated_at":"2018-04-23T17:38:19Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0647159a965da59eec3e790e89f52b26d818b849","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":693604972,"url":"https://api.github.com/repos/openshift/ansible-service-broker/labels/needs-review","name":"needs-review","color":"d93f0b","default":false},{"id":711739419,"url":"https://api.github.com/repos/openshift/ansible-service-broker/labels/size/XL","name":"size/XL","color":"ee5500","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/openshift/ansible-service-broker/pulls/897/commits","review_comments_url":"https://api.github.com/repos/openshift/ansible-service-broker/pulls/897/comments","review_comment_url":"https://api.github.com/repos/openshift/ansible-service-broker/pulls/comments{/number}","comments_url":"https://api.github.com/repos/openshift/ansible-service-broker/issues/897/comments","statuses_url":"https://api.github.com/repos/openshift/ansible-service-broker/statuses/f054515af9aba8397945eaca43ed609a85fa1d9d","head":{"label":"openshift:feature-add-dashboard-url","ref":"feature-add-dashboard-url","sha":"f054515af9aba8397945eaca43ed609a85fa1d9d","user":{"login":"openshift","id":792337,"avatar_url":"https://avatars3.githubusercontent.com/u/792337?v=4","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":79371528,"name":"ansible-service-broker","full_name":"openshift/ansible-service-broker","owner":{"login":"openshift","id":792337,"avatar_url":"https://avatars3.githubusercontent.com/u/792337?v=4","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/ansible-service-broker","description":"Ansible Service Broker","fork":false,"url":"https://api.github.com/repos/openshift/ansible-service-broker","forks_url":"https://api.github.com/repos/openshift/ansible-service-broker/forks","keys_url":"https://api.github.com/repos/openshift/ansible-service-broker/keys{/key_id}","collaborators_url":"https://api.github.com/repos/openshift/ansible-service-broker/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/openshift/ansible-service-broker/teams","hooks_url":"https://api.github.com/repos/openshift/ansible-service-broker/hooks","issue_events_url":"https://api.github.com/repos/openshift/ansible-service-broker/issues/events{/number}","events_url":"https://api.github.com/repos/openshift/ansible-service-broker/events","assignees_url":"https://api.github.com/repos/openshift/ansible-service-broker/assignees{/user}","branches_url":"https://api.github.com/repos/openshift/ansible-service-broker/branches{/branch}","tags_url":"https://api.github.com/repos/openshift/ansible-service-broker/tags","blobs_url":"https://api.github.com/repos/openshift/ansible-service-broker/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/openshift/ansible-service-broker/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/openshift/ansible-service-broker/git/refs{/sha}","trees_url":"https://api.github.com/repos/openshift/ansible-service-broker/git/trees{/sha}","statuses_url":"https://api.github.com/repos/openshift/ansible-service-broker/statuses/{sha}","languages_url":"https://api.github.com/repos/openshift/ansible-service-broker/languages","stargazers_url":"https://api.github.com/repos/openshift/ansible-service-broker/stargazers","contributors_url":"https://api.github.com/repos/openshift/ansible-service-broker/contributors","subscribers_url":"https://api.github.com/repos/openshift/ansible-service-broker/subscribers","subscription_url":"https://api.github.com/repos/openshift/ansible-service-broker/subscription","commits_url":"https://api.github.com/repos/openshift/ansible-service-broker/commits{/sha}","git_commits_url":"https://api.github.com/repos/openshift/ansible-service-broker/git/commits{/sha}","comments_url":"https://api.github.com/repos/openshift/ansible-service-broker/comments{/number}","issue_comment_url":"https://api.github.com/repos/openshift/ansible-service-broker/issues/comments{/number}","contents_url":"https://api.github.com/repos/openshift/ansible-service-broker/contents/{+path}","compare_url":"https://api.github.com/repos/openshift/ansible-service-broker/compare/{base}...{head}","merges_url":"https://api.github.com/repos/openshift/ansible-service-broker/merges","archive_url":"https://api.github.com/repos/openshift/ansible-service-broker/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/openshift/ansible-service-broker/downloads","issues_url":"https://api.github.com/repos/openshift/ansible-service-broker/issues{/number}","pulls_url":"https://api.github.com/repos/openshift/ansible-service-broker/pulls{/number}","milestones_url":"https://api.github.com/repos/openshift/ansible-service-broker/milestones{/number}","notifications_url":"https://api.github.com/repos/openshift/ansible-service-broker/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/openshift/ansible-service-broker/labels{/name}","releases_url":"https://api.github.com/repos/openshift/ansible-service-broker/releases{/id}","deployments_url":"https://api.github.com/repos/openshift/ansible-service-broker/deployments","created_at":"2017-01-18T18:40:49Z","updated_at":"2018-04-20T18:41:34Z","pushed_at":"2018-04-23T17:37:25Z","git_url":"git://github.com/openshift/ansible-service-broker.git","ssh_url":"git@github.com:openshift/ansible-service-broker.git","clone_url":"https://github.com/openshift/ansible-service-broker.git","svn_url":"https://github.com/openshift/ansible-service-broker","homepage":null,"size":93560,"stargazers_count":109,"watchers_count":109,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":54,"mirror_url":null,"archived":false,"open_issues_count":53,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":54,"open_issues":53,"watchers":109,"default_branch":"master"}},"base":{"label":"openshift:master","ref":"master","sha":"45ad68261c61fa2f92eea547779956b424e9906d","user":{"login":"openshift","id":792337,"avatar_url":"https://avatars3.githubusercontent.com/u/792337?v=4","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":79371528,"name":"ansible-service-broker","full_name":"openshift/ansible-service-broker","owner":{"login":"openshift","id":792337,"avatar_url":"https://avatars3.githubusercontent.com/u/792337?v=4","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/ansible-service-broker","description":"Ansible Service Broker","fork":false,"url":"https://api.github.com/repos/openshift/ansible-service-broker","forks_url":"https://api.github.com/repos/openshift/ansible-service-broker/forks","keys_url":"https://api.github.com/repos/openshift/ansible-service-broker/keys{/key_id}","collaborators_url":"https://api.github.com/repos/openshift/ansible-service-broker/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/openshift/ansible-service-broker/teams","hooks_url":"https://api.github.com/repos/openshift/ansible-service-broker/hooks","issue_events_url":"https://api.github.com/repos/openshift/ansible-service-broker/issues/events{/number}","events_url":"https://api.github.com/repos/openshift/ansible-service-broker/events","assignees_url":"https://api.github.com/repos/openshift/ansible-service-broker/assignees{/user}","branches_url":"https://api.github.com/repos/openshift/ansible-service-broker/branches{/branch}","tags_url":"https://api.github.com/repos/openshift/ansible-service-broker/tags","blobs_url":"https://api.github.com/repos/openshift/ansible-service-broker/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/openshift/ansible-service-broker/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/openshift/ansible-service-broker/git/refs{/sha}","trees_url":"https://api.github.com/repos/openshift/ansible-service-broker/git/trees{/sha}","statuses_url":"https://api.github.com/repos/openshift/ansible-service-broker/statuses/{sha}","languages_url":"https://api.github.com/repos/openshift/ansible-service-broker/languages","stargazers_url":"https://api.github.com/repos/openshift/ansible-service-broker/stargazers","contributors_url":"https://api.github.com/repos/openshift/ansible-service-broker/contributors","subscribers_url":"https://api.github.com/repos/openshift/ansible-service-broker/subscribers","subscription_url":"https://api.github.com/repos/openshift/ansible-service-broker/subscription","commits_url":"https://api.github.com/repos/openshift/ansible-service-broker/commits{/sha}","git_commits_url":"https://api.github.com/repos/openshift/ansible-service-broker/git/commits{/sha}","comments_url":"https://api.github.com/repos/openshift/ansible-service-broker/comments{/number}","issue_comment_url":"https://api.github.com/repos/openshift/ansible-service-broker/issues/comments{/number}","contents_url":"https://api.github.com/repos/openshift/ansible-service-broker/contents/{+path}","compare_url":"https://api.github.com/repos/openshift/ansible-service-broker/compare/{base}...{head}","merges_url":"https://api.github.com/repos/openshift/ansible-service-broker/merges","archive_url":"https://api.github.com/repos/openshift/ansible-service-broker/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/openshift/ansible-service-broker/downloads","issues_url":"https://api.github.com/repos/openshift/ansible-service-broker/issues{/number}","pulls_url":"https://api.github.com/repos/openshift/ansible-service-broker/pulls{/number}","milestones_url":"https://api.github.com/repos/openshift/ansible-service-broker/milestones{/number}","notifications_url":"https://api.github.com/repos/openshift/ansible-service-broker/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/openshift/ansible-service-broker/labels{/name}","releases_url":"https://api.github.com/repos/openshift/ansible-service-broker/releases{/id}","deployments_url":"https://api.github.com/repos/openshift/ansible-service-broker/deployments","created_at":"2017-01-18T18:40:49Z","updated_at":"2018-04-20T18:41:34Z","pushed_at":"2018-04-23T17:37:25Z","git_url":"git://github.com/openshift/ansible-service-broker.git","ssh_url":"git@github.com:openshift/ansible-service-broker.git","clone_url":"https://github.com/openshift/ansible-service-broker.git","svn_url":"https://github.com/openshift/ansible-service-broker","homepage":null,"size":93560,"stargazers_count":109,"watchers_count":109,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":54,"mirror_url":null,"archived":false,"open_issues_count":53,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":54,"open_issues":53,"watchers":109,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/openshift/ansible-service-broker/pulls/897"},"html":{"href":"https://github.com/openshift/ansible-service-broker/pull/897"},"issue":{"href":"https://api.github.com/repos/openshift/ansible-service-broker/issues/897"},"comments":{"href":"https://api.github.com/repos/openshift/ansible-service-broker/issues/897/comments"},"review_comments":{"href":"https://api.github.com/repos/openshift/ansible-service-broker/pulls/897/comments"},"review_comment":{"href":"https://api.github.com/repos/openshift/ansible-service-broker/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/openshift/ansible-service-broker/pulls/897/commits"},"statuses":{"href":"https://api.github.com/repos/openshift/ansible-service-broker/statuses/f054515af9aba8397945eaca43ed609a85fa1d9d"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"eriknelson"}}