Search code examples
servicenamespacescloud-foundrypaas

How do we register a PCF Service Broker as reachable from two spaces in the same PCF Org (with org admin permissions)?


How do I register a Pivotal Cloud Foundry Service Broker to make it accessible from multiple spaces within the same Organization, if I have Org-level permissions?

We tried to register a PCF Service broker (cf create-service-broker ...) in one space, then use it as a 'service instance' (cf create-service ...) in another space.

To illustrate the problem, consider the following work flow, from a HashiCorp Vault guide:

$ cf create-space examplespace
$ cf target -s examplespace
$ cf create-service-broker vault-broker "${AUTH_USERNAME}" "${AUTH_PASSWORD}" "https://${BROKER_URL}" --space-scoped
$ cf marketplace
service           plans             description
hashicorp-vault   shared            HashiCorp Vault Service Broker
# ...
$ cf create-service hashicorp-vault shared my-vault

The above works fine. The problem comes up when we have an app in a different space that we want to consume the HashiCorp Vault API:

$ cf target -s myappspace
$ cf bind-service my-app my-vault

This last part fails.

Also, now that I'm in the space myappspace, cf marketplace does **notCC show the new service broker.

Now, we have someone on our team with org-admin permissions.

I figured that we could just register the new service broker at the org level, using enable-service-access subcommand:

https://docs.cloudfoundry.org/services/access-control.html#enable-access-to-service-plans

$ cf enable-service-access my-vault -o WebOrg

This failed as well, because, even though he had Admin permissions for the entire org, he got a permission denied error.

If we then go on to registering the service broker in the second space, myappspace, we get a

All three of these methods failed, but there has to be some way to make a service from one space available to the others, within an Org., if I have administrative permissions for that PCF Org.

How?

A similar (although more specific) type of this issue is documented in the following two github issues for PCF's cloud_controller_ng repository:

https://github.com/cloudfoundry/cloud_controller_ng/issues/935

https://github.com/cloudfoundry/cloud_controller_ng/issues/837

I've done the following research:

https://docs.cloudfoundry.org/services/managing-service-brokers.html#register-broker

https://docs.cloudfoundry.org/services/access-control.html

https://docs.cloudfoundry.org/services/access-control.html#enable-access-to-service-plans

https://starkandwayne.com/blog/register-your-own-service-broker-with-any-cloud-foundry/

(We ran variations of every command on this page.)

The most similar of the existing questions on Stack Overflow were these:

WebSphere Message Broker - how to send a PCF message

Need help on Registering App on PCF with Spring Cloud Data Flow which is also on PCF

They don't seem to have much to do with name spacing issues in the PCF marketplace, or with PCF permissions management.

Note: At first I wanted to post this to serverfault.com, because this has more to do with the infrastructure for an application, rather than just programming. But, while serverfault.com has no tag for Pivotal Cloud Foundry, Stack Overflow has a pivotal-cloud-foundry tag with 588 uses, already.


Solution

  • How do I register a Pivotal Cloud Foundry Service Broker to make it accessible from multiple spaces within the same Organization, if I have Org-level permissions?

    I don't think you can do this. You'd need to be a platform admin/operator. Then you'd need to register the service broker with the platform & mark that broker as accessible to select orgs & spaces. You could then create services instances & if the broker permits share them across spaces.

    If you only have org/space permissions, you can only register the service broker with a specific space. It's then only visible in that space.

    Without platform admin/operator permissions, I think the best you could do would be this:

    1. register the broker in a specific space
    2. create a service instance in that space
    3. bind that to your apps in this space
    4. create a service key for your app in the second space
    5. switch to the second space
    6. create a user provided service in that space and enter the service key info
    7. Repeat steps 4-6 for each app in the second service (this ensure you get unique credentials per app, you could use one service key for all apps if you don't care about this).

    Happy to be corrected, but I think that is the state of things as I write this.