以下是 cf Push
上的错误:
org.cloudfoundry.client.v2.ClientV2Exception: CF-InvalidRelation(1002): The app cannot be mapped to this route because the route is not in this space. Apps must be mapped to routes in the same space.
下面是 list 文件:
applications:
- name: xyz-api
instances: 1
memory: 1G
buildpack: java_buildpack_offline
path: target/xyz-api-0.1-SNAPSHOT.jar
cf login x.y.z.w.org.cloud ....
cf push xyz-api -p target/xyz-api-0.1-SNAPSHOT.jar
我们有两个 API 端点:
a.b.c.d.org.cloud
x.y.z.w.org.cloud
根据调查,我们意识到 a.b.c.d.org.cloud
上已经存在该路由名称,因为我们的源代码在任何 API 端点上都硬编码了相同的路由名称。
多个 API 端点不能使用相同的路由名称吗?为什么?
最佳答案
By default, cf push assigns a route to every app
我不知道省略路由
的功能是什么,也许默认的/
被分配给空间中的应用程序,该空间可能已经被另一个应用程序占用空间。
The Cloud Foundry Gorouter routes requests to apps by associating an app with an address, known as a route. We call this association a mapping. Use the cf CLI cf map-route command to associate an app and route.
您可以运行cf paths
命令来查看正在使用哪些路由,
https://cli.cloudfoundry.org/en-US/cf/routes.html
您可以运行没有路由、随机路由或提供路由的应用程序
https://docs.cloudfoundry.org/devguide/deploy-apps/manifest.html#no-route
---
...
no-route: true
随机路线,
---
...
random-route: true
定义路线,
---
...
routes:
- route: example.com
- route: www.example.com/foo
- route: tcp-example.com:1234
https://docs.cloudfoundry.org/devguide/deploy-apps/manifest.html#routes
您可能需要查看路由文档以获取有关路由含义的更详细说明。
https://docs.cloudfoundry.org/devguide/deploy-apps/routes-domains.html
关于cloud-foundry - 应用程序必须映射到同一空间中的路线,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54580831/