应用必须映射到同一空间中的路由 [英] Apps must be mapped to routes in the same space

查看:57
本文介绍了应用必须映射到同一空间中的路由的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下是 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.






以下是清单文件:


Below is the manifest file:

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端点:


We have two API end points:

abcdorg.cloud

xyzworg.cloud

根据调查,我们意识到路径名称已经存在于 abcdorg.cloud ,因为我们的源代码对任何API端点上的相同路由名称进行硬编码。

As per investigation, we realised that the route name already exist on a.b.c.d.org.cloud because our source code is hardcoding the same route name for on any API end point.

不能使用相同的路由名称用于多个API端点?为什么?

Can't same route name be used for multiple API end points? why?

推荐答案


默认情况下,cf push为每个应用分配路由

By default, cf push assigns a route to every app

我不知道什么功能会省略路线,也许是默认的 / 已分配给该空间中的应用程序,该空间中的另一个应用程序可能已经将其分配给该应用程序。

I have no idea what the functionality is omitting a route, maybe a default / is assigned to the application in the space which might already be taken by another application in the space.


Cloud Foundry Gorouter通过将应用程序与地址(称为路由)相关联将请求路由到应用程序。我们将此关联称为映射。使用cf CLI cf map-route命令来关联应用程序和路由。

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路由命令以查看正在使用的路由,

You can run the cf routes command to see what routes are in use,

https://cli.cloudfoundry.org/en-US/cf/routes.html

您可以运行没有路由,随机路由或提供路由的应用程序

You can run an application without a route, a random route, or provide a route

> 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

您可能想查看路线文档以获取有关路线是什么的详细说明。

You may want to check the routes documentation for a more detailed explanation of what a route is.

https://docs.cloudfoundry.org/devguide/deploy-apps/routes-domains .html

这篇关于应用必须映射到同一空间中的路由的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆