Route name across api end points

空扰寡人 提交于 2020-01-25 10:16:08

问题


We have below two end points, having their respective Organization and Space

1) Dev environment: a.b.c.org.cloud

2) Proof of Concept environment(POC): a.b.c.poc.io


There is an app(my-cool-app) with route name my-cool-app.a.b.c.poc.io running in POC environment.

Due to code smell issue in this app, route name is decided by app source code(hard coded) but not through manifest.yml of cf push. This lead to same route name my-cool-app.a.b.c.poc.io for my-cool-app in Dev environment.


1) Can app have same route name my-cool-app.a.b.c.poc.io in dev environment(a.b.c.org.cloud)? Because we see this error 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. after cf push

2) Does Dev and POC environment have same cloud controller database(CCDB)? Because CCDB maintains binding of app name with routename


回答1:


1) Can app have same route name my-cool-app.a.b.c.poc.io in dev environment(a.b.c.org.cloud)?

It depends on what you mean by "dev" and "poc" environments. If they are totally separate foundations, then yes. It should work. You just use DNS to control where actual traffic is routed.

If they are sharing the same cloud controller, like you have a "dev" and "poc" org, then it works but with restrictions. You can map the same route to two different apps, but they have to be in the same space. That's what this error is saying.

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.

If you map the same route to two different apps, what you're effectively doing is splitting traffic across the two apps 50/50. If Cloud Controller were to allow this across orgs & spaces then you could have someone in a different org & space that is able to divert traffic from your app to another app, potentially malicious app, which would be a big security problem. Given this, Cloud Controller prevents that from being allowed.

2) Does Dev and POC environment have same cloud controller database(CCDB)? Because CCDB maintains binding of app name with routename

It sounds like your environments do, but that's not a strict requirement. You could have two totally separate foundations, one for Dev and one for POC, which do not share anything.



来源:https://stackoverflow.com/questions/54617290/route-name-across-api-end-points

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!