Skip to content

Latest commit

 

History

History

keep-existing-bindings

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

Keeping existing CF app service bindings during update

Overview

This example shows how to preserve manually created service bindings, during an MTA deployment, that are created outside of the MTA. A real use case for that is a multi-tenant scenario where bindings are created during tenant onboarding of a multitenant application, and those bindings are not maintained by MTA deployment.

Modelled via a module level parameter keep-existing and parameter option service-bindings:

modules:
  - name:...
    parameters:
      keep-existing:
        service-bindings: true

Official Documentation

Note
See mta.yaml or mtad.yaml in the current directory.

Try it out

Initial deployment

In this part the MTA will initially be deployed with two applications and one service instance. However, there is no binding between them.

You can deploy it directly from an mtad.yaml file:

$ cf deploy ./ -f ;

Alternatively, you can build an MTAR archive from the 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 ;

Manually bind service instance

Run the following commands:

$ cf bind-service cf-app-keeping-bindings dummy-service
$ cf bind-service cf-app-resetting-bindings dummy-service

Examine the result

To examine the result, run the following command:

$ cf services
Getting services in org ...
name           service       ... bound apps                                         ...
dummy-service  user-provided     cf-app-keeping-bindings, cf-app-resetting-bindings

Re-deply to simulate update

$ cf deploy -f ;

or

$ cf deploy a.cf.app_0.0.0.mtar -f ;

Examine the result

Verify that app cf-app-keeping-bindings has the binding preserved and app cf-app-keeping-bindings has lost the binding.

$ cf services
Getting services in org ...
name           service       ... bound apps                                         ...
dummy-service  user-provided     cf-app-keeping-bindings

Clean up resources

It is recommended to stop or undeploy your MTAs when they are no longer needed. In order to do so, run the following command:

$ cf undeploy <mta-id> -f --delete-services