Bug 1537367

Summary: missing last operation for bindings
Product: OpenShift Container Platform Reporter: Jesus M. Rodriguez <jesusr>
Component: Service BrokerAssignee: Jesus M. Rodriguez <jesusr>
Status: CLOSED ERRATA QA Contact: Jian Zhang <jiazha>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 3.9.0CC: aos-bugs, chezhang
Target Milestone: ---   
Target Release: 3.9.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-03-28 14:21:18 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:

Description Jesus M. Rodriguez 2018-01-23 02:59:49 UTC
The last_operation for async service bindings is missing.

Comment 1 Jesus M. Rodriguez 2018-01-23 03:04:42 UTC
https://github.com/openshift/ansible-service-broker/pull/677

Comment 3 Jian Zhang 2018-01-25 10:10:14 UTC
The above PR(#677) haven't been merged yet. Change status to MODIFIED, waiting for it's ready.

Comment 6 Jian Zhang 2018-01-29 07:51:30 UTC
The above PR(#677) merged in the version 1.1.8. The current version is 1.1.7, as below:
[root@host-172-16-120-40 ~]# docker run --rm --entrypoint=asbd registry.access.stage.redhat.com/openshift3/ose-ansible-service-broker:v3.9.0-0.23.0.1 --version
1.1.7

I will verify this bug once the image is ready.

Comment 7 Zhang Cheng 2018-01-29 08:04:51 UTC
I'm changing status to "Modified" since no downstream image ready for test.

Comment 8 Zhang Cheng 2018-02-07 08:32:58 UTC
Changing status to ON_QA since asb downstream image ready for test.

Comment 9 Jian Zhang 2018-02-08 07:22:12 UTC
Blocked by this issue: https://bugzilla.redhat.com/show_bug.cgi?id=1542387.
And, I used the APB(PostgreSQL) stored in the dockerhub to have a try. But, got the below errors when creating a binding.
[2018-02-08T06:57:14.05Z] [INFO] - Watch pod [ apb-6bca9c47-9145-4a64-9fb7-2d7fd345d9f1 ] tick 2
[2018-02-08T06:57:14.056Z] [ERROR] - Pod [ apb-6bca9c47-9145-4a64-9fb7-2d7fd345d9f1 ] failed - action's playbook not found.
[2018-02-08T06:57:14.056Z] [ERROR] - Bind action failed - action not found
[2018-02-08T06:57:14.056Z] [INFO] - Destroying APB sandbox...

So, waiting for the bug 1542387 to fix. I will verify this bug once it fixed.

Comment 10 Jian Zhang 2018-02-09 06:30:02 UTC
Jesus,

I used the stage APB image for this test but got below errors when creating a binding.
[2018-02-09T05:52:27.7Z] [ERROR] - Pod [ apb-f169a924-8a29-4c22-a3bf-64ee253cbc70 ] failed - action's playbook not found.
[2018-02-09T05:52:27.7Z] [ERROR] - Bind action failed - action not found

So, I used the example APB which support ASYNC bind according to the comment 9 of the https://bugzilla.redhat.com/show_bug.cgi?id=1536659

The ASB version: 1.1.9

Steps:
1, Enable the async of the ASB and config the example registry. Like below:
broker:
  ...
  launch_apb_on_bind: true
...
registry:
- type: dockerhub
    name: dh
    url:  https://registry.hub.docker.com 
    org:  mhrivnak
    tag:  latest
    white_list:
      - ".*-apb$"

2, Provision the APB(PostgreSQL) which support async bind.
3, Create a binding.
[root@localhost jzhang]# ./bind.sh 
binding ID: 6ac7bd64-54e7-4689-abff-f8d576481832
HTTP/1.1 202 Accepted
Content-Type: application/json
Date: Fri, 09 Feb 2018 06:05:33 GMT
Content-Length: 58
Set-Cookie: 89a6d633054ded194d4e1360cdc1fbef=45b7fdf950d87e8c3a786f6dc8075bc5; path=/; HttpOnly; Secure

{
  "operation": "579f663e-a1b4-4dc7-899b-c6191e85aa32"
}

4, Check the binding status by query the last_operation action.
[root@localhost jzhang]# cat last_operation.sh 
OPERATION_ID=$1
INSTANCE_ID="0a0b861b-3045-4d98-b137-71d1db572d2e"
PLAN_UUID="7f4a5e35e4af2beb70076e72fab0b7ff"
SERVICE_UUID="dh-postgresql-apb-hgmcm"
IDENTITY=$(echo -n '{"groups":["system:authenticated:oauth","system:authenticated"],"scopes.authorization.openshift.io":["user:full"],"uid":"","username":"jiazha"}'|base64 -w 0)

curl \
    -k \
    -X GET \
    -H "Authorization: bearer $(oc whoami -t)" \
    -H "Content-type: application/json" \
    -H "Accept: application/json" \
    -H "X-Broker-API-Originating-Identity: kubernetes $IDENTITY" \
    "https://asb-1338-openshift-ansible-service-broker.apps.0207-nvc.qe.rhcloud.com/ansible-service-broker/v2/service_instances/$INSTANCE_ID/last_operation?operation=$OPERATION_ID&service_id=$SERVICE_UUID&plan_id=$PLAN_UUID"

[root@localhost jzhang]# ./last_operation.sh 579f663e-a1b4-4dc7-899b-c6191e85aa32
{
  "state": "in progress"
}
[root@localhost jzhang]# ./last_operation.sh 579f663e-a1b4-4dc7-899b-c6191e85aa32
{
  "state": "succeeded"
}


The related ASB logs:

[2018-02-09T06:05:40.528Z] [DEBUG] - service_id: dh-postgresql-apb-hgmcm
[2018-02-09T06:05:40.528Z] [DEBUG] - plan_id: 7f4a5e35e4af2beb70076e72fab0b7ff
[2018-02-09T06:05:40.528Z] [DEBUG] - operation:  579f663e-a1b4-4dc7-899b-c6191e85aa32
[2018-02-09T06:05:40.529Z] [DEBUG] - state: in progress
10.128.0.1 - - [09/Feb/2018:06:05:40 +0000] "GET /ansible-service-broker/v2/service_instances/0a0b861b-3045-4d98-b137-71d1db572d2e/last_operation?operation=579f663e-a1b4-4dc7-899b-c6191e85aa32&service_id=dh-postgresql-apb-hgmcm&plan_id=7f4a5e35e4af2beb70076e72fab0b7ff HTTP/1.1" 200 29
...

[2018-02-09T06:06:13.004Z] [DEBUG] - service_id: dh-postgresql-apb-hgmcm
[2018-02-09T06:06:13.004Z] [DEBUG] - plan_id: 7f4a5e35e4af2beb70076e72fab0b7ff
[2018-02-09T06:06:13.004Z] [DEBUG] - operation:  579f663e-a1b4-4dc7-899b-c6191e85aa32
[2018-02-09T06:06:13.007Z] [DEBUG] - state: succeeded
10.128.0.1 - - [09/Feb/2018:06:06:13 +0000] "GET /ansible-service-broker/v2/service_instances/0a0b861b-3045-4d98-b137-71d1db572d2e/last_operation?operation=579f663e-a1b4-4dc7-899b-c6191e85aa32&service_id=dh-postgresql-apb-hgmcm&plan_id=7f4a5e35e4af2beb70076e72fab0b7ff HTTP/1.1" 200 27

So, for this bug fixed, it looks good to me.

Comment 13 errata-xmlrpc 2018-03-28 14:21:18 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2018:0489