cloudfoundry / cli

The official command line client for Cloud Foundry
https://docs.cloudfoundry.org/cf-cli
Apache License 2.0
1.75k stars 927 forks source link

cf8 create-service improperly fails when service brought by multiple brokers but only one plan is visible #2269

Closed gberche-orange closed 4 weeks ago

gberche-orange commented 2 years ago

Please fill out the issue checklist below and provide ALL the requested information.

Describe the bug and the command you saw an issue with

$ cf create-service o-intranet-proxy-access default o-intranet-proxy-access-service
Creating service instance o-intranet-proxy-access-service in org internal / space osb-reverse-proxy-1 as auser...
Service offering 'o-intranet-proxy-access' is provided by multiple service brokers. Specify a broker name by using the '-b' flag.
FAILED

# However a single service plan has the visibility in the current space
$ cf service-access -e o-intranet-proxy-access
Getting service access for service offering o-intranet-proxy-access as auser...

broker: intranet-sec-broker
   offering                  plan      access   orgs
   o-intranet-proxy-access   default   none     

broker: o-intranet-proxy-access
   offering                  plan      access    orgs
   o-intranet-proxy-access   default   limited   system_domain,orange,internal

when specifying the -b option, cf8 still fails to create the service instance

$ cf create-service o-intranet-proxy-access default o-intranet-proxy-access-service -b o-intranet-proxy-access
Creating service instance o-intranet-proxy-access-service in org internal / space osb-reverse-proxy-1 as auser
The plan 'default' could not be found for service offering 'o-intranet-proxy-access' and broker 'o-intranet-proxy-access-service'.
FAILED

With CF_TRACE=true option, cl8 shows the api request is /v3/service_plans?names=default&page=1&per_page=50&service_broker_names=o-intranet-proxy-access-service&service_offering_names=o-intranet-proxy-access

What happened service creation failed

Expected behavior

just like with with cf v7, the creation request should be accepted since a single service plan has the visibility in the current space

Exact Steps To Reproduce Steps to reproduce the behavior; include the exact CLI commands and verbose output:

  1. Run cf ...
  2. Bind a service cf bind-service
  3. See error

Provide more context

Notes regarding V6 and V7 CLI support:

gberche-orange commented 2 years ago

This problem does not seem systematic, as in the following cases of service access visibility, the multi-broker registration feature properly works and service instance is properly created:

$ cf8 service-access -e mariadb-shared -o osb-cmdb-brokered-services-org-client-1
Getting service access for service offering mariadb-shared and organization osb-cmdb-brokered-services-org-client-1 as user...

broker: mariadb-shared
   offering         plan    access    orgs
   mariadb-shared   100mb   limited   osb-cmdb-brokered-services-org-client-1,osb-cmdb-backend-services-org-client-1
   mariadb-shared   10mb    limited   osb-cmdb-brokered-services-org-client-1,osb-cmdb-backend-services-org-client-1
   mariadb-shared   15gb    limited   osb-cmdb-brokered-services-org-client-1,osb-cmdb-backend-services-org-client-1
   mariadb-shared   1gb     limited   osb-cmdb-brokered-services-org-client-1,osb-cmdb-backend-services-org-client-1
   mariadb-shared   20mb    limited   osb-cmdb-brokered-services-org-client-1,osb-cmdb-backend-services-org-client-1

broker: osb-cmdb-broker-1
   offering         plan    access    orgs
   mariadb-shared   100mb   limited   system_domain,osb-cmdb-brokered-services-org-client-1
   mariadb-shared   10mb    limited   system_domain,osb-cmdb-brokered-services-org-client-1
   mariadb-shared   15gb    limited   system_domain,osb-cmdb-brokered-services-org-client-1
   mariadb-shared   1gb     limited   system_domain,osb-cmdb-brokered-services-org-client-1
   mariadb-shared   20mb    limited   system_domain,osb-cmdb-brokered-services-org-client-1

$ cf8 create-service mariadb-shared 10mb osb-cmdb-broker-gberche -b osb-cmdb-broker-1
Creating service instance osb-cmdb-broker-gberche in org osb-cmdb-brokered-services-org-client-1 / space smoke-tests as user...

Service instance osb-cmdb-broker-gberche created.
OK

$ cf8 service-access -e mariadb-shared -o osb-cmdb-brokered-services-org-client-1
Getting service access for service offering mariadb-shared and organization osb-cmdb-brokered-services-org-client-1 as user...

broker: mariadb-shared
   offering         plan    access   orgs
   mariadb-shared   100mb   all      
   mariadb-shared   10mb    all      
   mariadb-shared   15gb    all      
   mariadb-shared   1gb     all      
   mariadb-shared   20mb    all      

broker: osb-cmdb-broker-1
   offering         plan    access    orgs
   mariadb-shared   100mb   limited   system_domain,osb-cmdb-brokered-services-org-client-1
   mariadb-shared   10mb    limited   system_domain,osb-cmdb-brokered-services-org-client-1
   mariadb-shared   15gb    limited   system_domain,osb-cmdb-brokered-services-org-client-1
   mariadb-shared   1gb     limited   system_domain,osb-cmdb-brokered-services-org-client-1
   mariadb-shared   20mb    limited   system_domain,osb-cmdb-brokered-services-org-client-1

$ cf8 create-service mariadb-shared 10mb osb-cmdb-broker-gberche -b osb-cmdb-broker-1
Creating service instance osb-cmdb-broker-gberche in org osb-cmdb-brokered-services-org-client-1 / space smoke-tests as user...

Service instance osb-cmdb-broker-gberche created.
OK

Did not reproduce either with a service offering published by a broker without service visibility

$ cf8 service-access -e overview-service
Getting service access for service offering overview-service as user...

broker: osb-cmdb-broker-0
   offering           plan                                                        access   orgs
   overview-service   allOf                                                       none     
   overview-service   allOf-with-two-levels-of-nesting                            none     

broker: osb-cmdb-broker-1
   offering           plan                                                        access    orgs
   overview-service   allOf                                                       limited   system_domain,osb-cmdb-brokered-services-org-client-1
   overview-service   allOf-with-two-levels-of-nesting                            limited   system_domain,osb-cmdb-brokered-services-org-client-1

broker: osb-reverse-proxy-1
   offering           plan                                                        access    orgs
   overview-service   allOf                                                       limited   system_domain,service-sandbox,osb-cmdb-backend-services-org-client-1
   overview-service   allOf-with-two-levels-of-nesting                            limited   system_domain,service-sandbox,osb-cmdb-backend-services-org-client-1

$ cf8 create-service overview-service small osb-cmdb-broker-gberche -b osb-cmdb-broker-1
Creating service instance osb-cmdb-broker-gberche in org osb-cmdb-brokered-services-org-client-1 / space smoke-tests as user...

Create in progress. Use 'cf services' or 'cf service osb-cmdb-broker-gberche' to check operation status.
OK
gururajsh commented 4 weeks ago

Thank you @gberche-orange for your submission. Looks like this issue has been addressed here. If you are still seeing this issue with the latest version of CLI (and CAPI > 1.173.0) please open a new GH Issue.