SAP / cloud-mta-build-tool

Multi-Target Application (MTA) build tool for Cloud Applications https://sap.github.io/cloud-mta-build-tool
Apache License 2.0
139 stars 61 forks source link

Routes defined with `_` converted to `-` (Routes replacing underscore with minus / dash) #1114

Open tsteckenborn opened 6 months ago

tsteckenborn commented 6 months ago

Steps to Reproduce:

  1. Define an application with a route, such as:
    ---
    applications:
    - name: test
    routes:
    - route: test_host_something.cfapps.eu10.hana.ondemand.com
    [...]
  2. Check the deployed applications route
  3. You'll notice that instead of the expected test_host_something.cfapps.eu10.hana.ondemand.com it created the route test-host-something.cfapps.eu10.hana.ondemand.com

Via the Cloud Foundry CLI creation of the route test-host-something.cfapps.eu10.hana.ondemand.com works without issues.

yutaoj commented 5 months ago

is it a issue on MTA Deploy Service ? could you provide more content of a mta.yaml and more reproduce steps ?

tsteckenborn commented 4 months ago

Given a mta that defines a route, such as for example https://github.com/SAP-samples/cf-mta-examples/blob/main/app-routes/http2-routes/mta.yaml if your routes include an underscore, such as my_app_route_http1.${default-domain} when deployed you'll notice that your routes don't include the _ but all instances are replaced with -. Creating a route with _ using the cloud foundry cli works without an issue. So something during the process of build to deployment seems to modify this.

With regards to reproducability - simply deploy any application with such a route to cloud foundry and check the created routes.

boyan-velinov commented 4 months ago

Hey @tsteckenborn

The correction of CF app routes happens during MTA deployment in BTP CF. In general, there are the following legacy policies for auto-correction of hosts

The situation with autocorrection of routes and hosts is not the best one, but it is important to know that it exists since the introduction of MTA deployment in SAP CF. Back than the MTA deployments inherits these resitrcitions from the platform. Now the CF does not restrict the routes in that manner and it is worth to consider how to improve the behavior of MTA deployment. However, a simple removal of autocorrection might lead to breaking change for part of the customers because their productive routes will be changed.

My suggestion is to use short hostnames without dashes which will not be autocorrected.