将服务绑定到 cloudfoundry 中的两个不同的应用程序空间

Bind a service to two different app spaces in cloudfoundry

是否可以将服务(即MariaDB)绑定到不同空间的应用程序?如果我想为两个不同的空间使用同一个数据库,我该如何实现?

目前我们不支持 service instance sharing。我们已经进行了必要的代码更改并对其进行了测试 (Service Broker),但不要在 prd 上推出它,因为该功能目前处于测试阶段。

Sharing a service instance between spaces allows apps in different spaces to share databases, messaging queues, and other types of services. This eliminates the need for development teams to use service keys and user-provided services to bind their apps to the same service instance that was provisioned using the cf create-service command. Sharing service instances improves security, auditing, and provides a more intuitive user experience.

请参阅此 discussion 了解更多信息,此功能何时可从上游普遍使用。

我尝试了 https://docs-cloudfoundry-staging.cfapps.io/devguide/services/sharing-instances.html 中的解决方案。 如果我 运行 第一个命令我得到以下错误:

$ cf enable-feature-flag service_instance_sharing
    Server error, status code: 403, error code: 10003, message: You are not authorized to perform the requested action

第二个命令有效,现在我可以在仪表板上的space B 中看到该服务。

$ cf share-service SERVICE-INSTANCE -s OTHER-SPACE [-o OTHER-ORG] 

注意:如果我单击仪表板上的服务,它会显示:这是一项共享服务。它只能在共享它的 space 中访问。该服务也显示为灰色。

您可以在两个不同的 spaces/orgs 中使用相同的服务实例 关注:

1) https://docs.pivotal.io/pivotalcf/2-3/services/enable-sharing.html

2) https://docs.pivotal.io/pivotalcf/2-3/devguide/services/sharing-instances.html