How to Make a Shareable Service Instance - cloudfoundry/cloud_controller_ng GitHub Wiki
Setup
- Create org org, spaces space1 and space2
- Log in as admin on space space1
- cf enable-feature-flag service_instance_sharing
- In cats/assets/service_broker, modify the
data.json file as follows:
"requires": [
"route_forwarding" <----- REMOVE
],
...
"metadata": {
"shareable": true <----- ADD
}
Deploy Broker and Create Service
z cf-acceptance-tests && cd assets/service_broker
ruby setup_new_broker.rb async-broker TARGET.capi.land
- cf marketplace to get service name FSNAME
- cf cs FSNAME fake-plan fs1
Verify Unshared Behavior
- cf create-user joe joe
- cf set-space-role joe org space2 SpaceDeveloper
- cf auth joe joe
- cf target -o org -s space2
- cf service fs1 should not find service
fs1
Share the Service Instance
- cf auth admin ADMINPASSWORD # or target_cf
- cf target -o org -s space1
- service="$(cf service fs1 --guid)"
- space2="$(cf space space2 --guid)"
cf curl -X POST /v3/service_instances/$service/relationships/shared_spaces -d '{"data": [ { "guid": "'$space2'" } ] }'
Verify Shared Behavior
- cf auth joe joe
- cf target -o org -s space2
- cf service fs1 should give details on service
fs1
Unshare a Service Instance
- cf curl -X DELETE /v3/service_instances/$service/relationships/shared_spaces/$(cf space TARGET_SPACE --guid)