Bug 1569220

Summary: Dashboard URL cannot be set from APB during provision
Product: OpenShift Container Platform Reporter: Dylan Murray <dymurray>
Component: Service BrokerAssignee: Dylan Murray <dymurray>
Status: CLOSED CURRENTRELEASE QA Contact: Jian Zhang <jiazha>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 3.10.0CC: aos-bugs, chezhang, dymurray, jiazha, zhsun, zitang
Target Milestone: ---   
Target Release: 3.10.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: No Doc Update
Doc Text:
undefined
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-12-20 21:11:58 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1572449    
Bug Blocks:    
Attachments:
Description Flags
oc edit dc/asb none

Description Dylan Murray 2018-04-18 20:02:10 UTC
Description of problem:
There currently exists no mechanism to support setting dashboard_url during the provision task since it is an async call. 

Version-Release number of selected component (if applicable):
3.10

How reproducible:
100%

Steps to Reproduce:
1. Try to use dashboard_url ansible module

Actual results:
Dashboard URL not set

Expected results:
Dashboard URL is populated in the web console and points to third party URL that is set in the APB

Additional info:

Comment 1 Zhang Cheng 2018-04-19 01:42:14 UTC
Attach relate trello card: https://trello.com/c/nKETILel
And, set target release to 3.11, please correct me if I'm wrong.

Comment 3 Dylan Murray 2018-04-19 17:02:30 UTC
Zhang,

We are targeting this feature as an alpha feature for 3.10.

Comment 6 openshift-github-bot 2018-04-25 09:22:45 UTC
Commits pushed to master at https://github.com/openshift/openshift-ansible

https://github.com/openshift/openshift-ansible/commit/cc01a701e817ea7db6ea2888e65d870948c17296
Bug 1569220 - Add dashboard redirector feature

https://github.com/openshift/openshift-ansible/commit/4f51bcb493766fa84b1bacb951da4382f34f32de
Merge pull request #8086 from dymurray/dr

Bug 1569220 - Add dashboard redirector feature

Comment 7 David Zager 2018-04-26 12:25:45 UTC
https://errata.devel.redhat.com/advisory/33505 Moved to ON_QE with the following builds.

openshift-enterprise-apb-base-docker-v3.10.0-0.29.0.1
openshift-enterprise-apb-tools-v3.10.0-0.16.0.3
openshift-enterprise-asb-docker-v3.10.0-0.29.0.1
openshift-enterprise-mariadb-apb-v3.10.0-0.29.0.1
openshift-enterprise-mediawiki-apb-v3.10.0-0.29.0.1
openshift-enterprise-mysql-apb-v3.10.0-0.29.0.1
openshift-enterprise-postgresql-apb-v3.10.0-0.29.0.1

Not covered, in this case, are the openshift-ansible changes.

Comment 8 Jian Zhang 2018-05-02 07:14:09 UTC
David & Dylan,

One question about the above images, as John mentioned in card: https://trello.com/c/nKETILel, we don't have a plan to use the "dashboard_url" feature in 3.10, so I want to know the above images if have enable the "dashboard_url" feature, and if yes, just for testing this bug? If no, so should I use the https://github.com/eriknelson/dashboard-url-apb for verifying this bug?

Comment 9 Dylan Murray 2018-05-02 12:39:00 UTC
Jian,

The above images do *not* have the dashboard_url feature enabled. You are correct that you should use https://github.com/eriknelson/dashboard-url-apb for testing this feature.

Comment 10 Jian Zhang 2018-05-04 03:32:01 UTC
Dylan,

Thanks, the dashboard url set successful during provision, but the URL cannot be accessed, is that OK? Maybe the demo APB did not implement this.

Access the URL, display info:

Application is not available

The application is currently not serving requests at this endpoint. It may not have been started or is still starting.

Test step:
1, Build the demo APB image. Like:
1)#git clone https://github.com/eriknelson/dashboard-url-apb.git
#docker build --tag docker.io/zjianbjz/dashboard-url-apb .
#docker push

2, Config the registry and dashboard_url of ASB in configmap, like below:
#oc edit cm
...
    registry:
      - type: dockerhub
        name: dh
        url:  https://registry.hub.docker.com
        org: zjianbjz
        tag:  latest
        white_list: [.*-apb$]

   broker:
   ...
      cluster_url: ansible-service-broker
      dashboard_redirector: http://dashboard-redirector-1337-ansible-service-broker.apps.0503-e5l.qe.rhcloud.com

#oc rollout latest dc/asb

3, Refresh the web console, provision the "demo" APB.

4, And then, we can see the "Dashboard" link in the Web console, access it, but got errors: "Application is not available", I think it's OK for me, what do you think?

Comment 11 Jian Zhang 2018-05-04 04:14:06 UTC
paste the serviceinstance info:

[root@host-172-16-120-31 ~]# oc get serviceinstance.servicecatalog.k8s.io -n jian
NAME                AGE
dh-demo-apb-s2l9q   3m

[root@host-172-16-120-31 ~]# oc get serviceinstance.servicecatalog.k8s.io dh-demo-apb-s2l9q -o yaml -n jian | grep -i dashboard
  dashboardURL: http://dashboard-redirector-1337-ansible-service-broker.apps.0503-e5l.qe.rhcloud.com/?id=c6aee613-4f48-11e8-99e9-0a580a800003

Comment 12 Dylan Murray 2018-05-14 14:53:55 UTC
Jian,

Yes the test that you described I would expect to see the 503. This is because you are still using an older template which is either not deploying the second dashboard redirect container or it is using a version of the broker without the binary in it. The fact that you saw the Dashbooard icon in the web console tells me that the broker performed properly.

If you deployed openshift using the openshift-ansible PR that I linked above then these template changes should have taken effect. For your test to work you would have to add the second container with the dashboard-redirector command as specified above.

Please confirm for me that you only see one container (oc get pods will tell you if you have 1 or 2 containers as well) in the broker namespace.

Comment 13 Jian Zhang 2018-05-18 08:26:33 UTC
Dylan,

Thanks very much for your explanation. I new a bug 1579723 for this installation.
I fixed that issue and continue testing for this bug.

I can see two containers in the ASB pod, one is the "asb" container, and the other one is "dashboard-redirector", like below:

[root@ip-172-18-2-253 ~]# oc get pods
NAME          READY     STATUS    RESTARTS   AGE
asb-2-f2r8v   2/2       Running   0          13m

The dashboard url route:
[root@ip-172-18-2-253 ~]# oc get route
NAME       HOST/PORT                                                                PATH      SERVICES   PORT      TERMINATION   WILDCARD
asb-1338   asb-1338-openshift-ansible-service-broker.apps.0517-46o.qe.rhcloud.com             asb        1338      reencrypt     None
dr-1337    dr-1337-openshift-ansible-service-broker.apps.0517-46o.qe.rhcloud.com              asb        1337                    None

seems it works well, but I got error "Requested service instance with id 773eea0f-5a6c-11e8-a0da-0a580a80000e not found." when click the DEMO APB's dashboard URL. Related logs as below:

[root@ip-172-18-2-253 ~]# oc logs -f asb-2-f2r8v -c dashboard-redirector
time="2018-05-18T07:20:33Z" level=info msg="Trying to load batch specs as a sanity check..."
2018/05/18 07:20:33 Dao::BatchGetSpecs
time="2018-05-18T07:20:33Z" level=info msg="Sanity check passed! Loaded specs: %v[]"
time="2018-05-18T07:20:33Z" level=info msg="Dashboard redirector listening on port [:1337]"
time="2018-05-18T07:32:32Z" level=info msg="Checking for form"
time="2018-05-18T07:32:33Z" level=info msg="Got request for service instance 773eea0f-5a6c-11e8-a0da-0a580a80000e, looking up dashboard_url"
2018/05/18 07:32:33 get service instance: 773eea0f-5a6c-11e8-a0da-0a580a80000e
time="2018-05-18T07:32:33Z" level=info msg="Requested service instance with id 773eea0f-5a6c-11e8-a0da-0a580a80000e not found.%!(EXTRA string=773eea0f-5a6c-11e8-a0da-0a580a80000e, string=bundleinstances.automationbroker.io \"773eea0f-5a6c-11e8-a0da-0a580a80000e\" not found)"
time="2018-05-18T07:32:33Z" level=info msg="Checking for form"
time="2018-05-18T07:32:33Z" level=error msg="Did not find service instance id as a query param!"


I further look into it and found the service instance "773eea0f-5a6c-11e8-a0da-0a580a80000e" was existed.

[root@ip-172-18-2-253 ~]# oc describe serviceinstance dh-demo-apb-gqdzk -n jian | grep "773eea0f-5a6c-11e8-a0da-0a580a80000e"
  External ID:      773eea0f-5a6c-11e8-a0da-0a580a80000e
  Dashboard URL:           http://dr-1337-openshift-ansible-service-broker.apps.0517-46o.qe.rhcloud.com/?id=773eea0f-5a6c-11e8-a0da-0a580a80000e

[root@ip-172-18-2-253 ~]# oc get bundleinstance -n openshift-ansible-service-broker
NAME                                   AGE
773eea0f-5a6c-11e8-a0da-0a580a80000e   26m

[root@ip-172-18-2-253 ~]# oc get serviceinstance -n openshift-ansible-service-broker
No resources found.

Maybe something went wrong in there: https://github.com/openshift/ansible-service-broker/blob/ansible-service-broker-1.2.11-1/pkg/dao/crd/dao.go#L150

Comment 14 Dylan Murray 2018-05-18 12:09:09 UTC
Jian,

I'm unable to reproduce your error... please tell me if I'm doing something wrong.

I set my configmap to use images from your organization (zjianbjz) and deployed demo-apb which set the dashboard URL:
```
TASK [provision-demo-apb : asb_dashboard_url] **********************************
changed: [localhost]
PLAY RECAP *********************************************************************
```

I clicked the dashboard icon in the webUI and it brought me to automationbroker.io as expected.

I then check the dashboard-redirector logs:

time="2018-05-18T11:54:51Z" level=info msg="Got request for service instance f6a121f7-5a91-11e8-8e22-0242ac110006, looking up dashboard_url"
2018/05/18 11:54:51 get service instance: f6a121f7-5a91-11e8-8e22-0242ac110006
2018/05/18 11:54:51 get spec: 0797445261af942a93b7b27a8b04df4f
time="2018-05-18T11:54:51Z" level=info msg="Successfully loaded SI: %+v&{f6a121f7-5a91-11e8-8e22-0242ac110006 0xc42029c000 0xc4200fba00 0xc42000e410 map[] automationbroker.io}"
time="2018-05-18T11:54:51Z" level=info msg="DashboardURL found: automationbroker.io, 301 redirecting"


And everything looks okay. Would you mind retesting? If the `asb_dashboard_url` task succeeded I wouldn't expect for you to get a "service instance not found".

Comment 15 Jian Zhang 2018-05-21 10:14:23 UTC
Created attachment 1439547 [details]
oc edit dc/asb

Comment 16 Jian Zhang 2018-05-21 10:15:48 UTC
Dylan,

I retested it but still got the same error when clicked the dashboard icon on Web. It's strange. And, What's your ASB version? I used version 1.2.11 for this testing.

[root@ip-172-18-4-147 ~]# docker run --rm --entrypoint=asbd registry.reg-aws.openshift.com:443/openshift3/ose-ansible-service-broker:v3.10 --version
1.2.11


[root@ip-172-18-4-147 ~]# oc logs -f asb-2-nr5hz -c dashboard-redirector
time="2018-05-21T09:49:00Z" level=info msg="Trying to load batch specs as a sanity check..."
2018/05/21 09:49:00 Dao::BatchGetSpecs
time="2018-05-21T09:49:00Z" level=info msg="Sanity check passed! Loaded specs: %v[]"
time="2018-05-21T09:49:00Z" level=info msg="Dashboard redirector listening on port [:1337]"


time="2018-05-21T09:57:07Z" level=info msg="Checking for form"
time="2018-05-21T09:57:07Z" level=info msg="Got request for service instance e1e406a7-5cdc-11e8-937d-0a580a80000d, looking up dashboard_url"
2018/05/21 09:57:07 get service instance: e1e406a7-5cdc-11e8-937d-0a580a80000d
time="2018-05-21T09:57:07Z" level=info msg="Requested service instance with id e1e406a7-5cdc-11e8-937d-0a580a80000d not found.%!(EXTRA string=e1e406a7-5cdc-11e8-937d-0a580a80000d, string=bundleinstances.automationbroker.io \"e1e406a7-5cdc-11e8-937d-0a580a80000d\" not found)"
time="2018-05-21T09:57:08Z" level=info msg="Checking for form"
time="2018-05-21T09:57:08Z" level=error msg="Did not find service instance id as a query param!"


The deployment pod logs:
...
TASK [provision-demo-apb : wait] ***********************************************
ok: [localhost -> localhost]

TASK [provision-demo-apb : asb_dashboard_url] **********************************
changed: [localhost]

PLAY RECAP *********************************************************************
localhost                  : ok=3    changed=1    unreachable=0    failed=0 


I patched the dc/asb for your reference.

Comment 17 Dylan Murray 2018-05-21 15:33:58 UTC
Jian,

Hmm thanks for retesting. I'm still unable to reproduce this even when I use the same version of ASB as you. The only thing I can think of is that the CRD is taking some time to be created and doesn't exist at the time of you clicking the dashboard link.

Can you confirm that `oc get bundleinstance -n openshift-ansible-service-broker` returns the service instance ID *before* you click the dashboard link? I've sometimes seen the CRD take some time to be created and so when you click the link immediately after provision the service instance might not be created yet.

If you confirm for me that you see the service instance ID in that call and then click the link and still no success then we have a problem that I cannot reproduce. Please let me know what the above test returns.

Comment 18 Jian Zhang 2018-05-22 05:36:00 UTC
Dylan,

I confirm the `bundleinstance` has been created before I clicked the dashboard link.

Aha, I found the root cause. The default namespace for the "dashboard-redirector" is "ansible-service-broker", but for OCP it should be "openshift-ansible-service-broker".
So, I added an option as below, it works well now! That's an amazing feature. Verify it.

        - --namespace
        - openshift-ansible-service-broker


I new bug 1581052 for this namespace installation issue.