SAP-samples / cf-mta-examples

The repository contains multitarget application (MTA) examples for SAP BTP, Cloud Foundry environment. Examples demonstrate how to achieve different goals using MTAs and show the capabilities of MTA deployment service in the Cloud Foundry environment.
Apache License 2.0
112 stars 44 forks source link

blue-green strategy does not keep existing service bindings #74

Open calle2010 opened 1 year ago

calle2010 commented 1 year ago

Hello,

I tried blue-green deployment strategy with

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

but service bindings were not transferred to the new "-idle" instance of the app.

When I try the same without "blue-green" strategy the existing, manually created service bindings are unbound and rebound as expected.

boyan-velinov commented 1 year ago

Hello,

It is expected that keep-existing service-bindings to not work in blue-green deployment. It is because that blue-green creates new app versions with new bindings to each service instance.

Keep-exisitng bings makes sense and it is designed for standard deployment where one app has bindings to services inside and outside of the MTA, and these bindings are not touched at all.

Best Regards, Boyan

calle2010 commented 1 year ago

Hello Boyan, thanks for your reply. I have to say that I'm not convinced about this design decision:

a) The purpose of blue-green deployment with idle start is to be able to test a complete environment. Without the manually bound services the environment is not complete; hence testing is not possible.

b) When I do blue-green deployment with --skip-idle-start my expectation is a zero-downtime deployment. But with manually bound services I find myself in a situation with a broken system. This goes against the principle of least surprise.

c) During standard deployment, the manually created service bindings are also removed and added again to the application, so the deployer is technically aware of them. This means there can't be a technical problem.

d) Existing documentation doesn't mention such a limitation. In fact it warns "Live and idle applications are bound to the same service instances."

calle2010 commented 1 year ago

According to "whats new" for "Multitarget Applications for Cloud Foundry" September 7, 2023:

"You can now preserve app environment after blue-green deployment with MTA Module parameter keep-existing and its option env. For more information see CF-MTA-ExamplesInformation published on non-SAP site."

This means environment variables are now preserved, but service bindings aren't. I think that is inconsistent and should be extended to manual service bindings, too.