This example shows how to preserve manual mappings of app routes during MTA deployment. This feature tends to be useful, for instance, when tenant onboarding for multitenant apps generates a separate route for each tenant and that route is not maintained in an *.mtaext extension descriptor given to the MTA deployer.
It can be activated in 3 ways:
-
global parameter
keep-existing-routes: true
-
module level parameter
keep-existing-routes: true
-
module level parameter
keep-existing:…
...
parameters:
keep-existing:
routes:true
You can deploy it directly from an mtad.yaml
file:
$ cf deploy ./ -f ;
Alternatively, you can build an MTAR archive from an mta.yaml
file:
$ mbt build -p cf -t . ;
And then deploy the built MTAR archive:
$ cf deploy a.cf.app_0.0.0.mtar -f ;
$ cf map-route cf-app-unmapping-routes apps.internal --hostname "custom-host"
$ cf map-route cf-app-keeping-complex-param apps.internal --hostname "custom-host"
$ cf map-route cf-app-keeping-simple-param apps.internal --hostname "custom-host"
$ cf apps
Getting apps in org ...
name requested state instances memory disk urls
cf-app-keeping-complex-param started 1/1 1G 1G custom-host.apps.internal, <org>-<space>-cf-app-keeping-complex-param.<default-domain>,
cf-app-keeping-simple-param started 1/1 1G 1G custom-host.apps.internal, <org>-<space>-cf-app-keeping-simple-param.<default-domain>
cf-app-unmapping-routes started 1/1 1G 1G custom-host.apps.internal, <org>-<space>-cf-app-unmapping-routes.<default-domain>
$ cf apps
Getting apps in org ...
name requested state instances memory disk urls
cf-app-keeping-complex-param started 1/1 1G 1G custom-host.apps.internal, <org>-<space>-cf-app-keeping-complex-param.<default-domain>,
cf-app-keeping-simple-param started 1/1 1G 1G custom-host.apps.internal, <org>-<space>-cf-app-keeping-simple-param.<default-domain>
cf-app-unmapping-routes started 1/1 1G 1G <org>-<space>-cf-app-unmapping-routes.<default-domain>
Note that apps that have their 'keep-existing..' parameters activated have the url custom-host.apps.internal
. However, in the app cf-app-unmapping-routes
has the url unmapped.