cloudcloud-foundryblue-green-deployment

PCF (blue/green deployment) - How to segment/route users based on their attributes


I am trying to find a solution for user segmentation on PCF for blue/green deployment. I want to deploy two versions of a Java app on PCF, say a BLUE version and a GREEN version. Now, I want to route a specific group of users to GREEN and the rest to BLUE. I need to know if there is a way to have a gateway (such as zuul) to route users based on their attributes. Not all required users attributes are in the header of the request -- they are stored in a database. When the request comes, the user id is in the request. But before segment/route users to BLUE/GREEN, I need to retrieve some of their info from the database.

Any comment/suggestions will be appreciated! Thanks


Solution

  • There isn't anything in CloudFoundry that would provide this capability. The best you can do with CF is to use routes to push traffic to different places, this is what's historically been done with blue/green deployment.

    If you need more custom control, like what you're describing, you'd need to have an additional layer of routing that implements your custom routing requirements.

    Since you mentioned Java, I would suggest looking at Spring Cloud Gateway. It is a very flexible way to route traffic.

    You'd set things up such that all of your traffic is sent through a mapped public route on CF to an SCG app that you've pushed. The SCG app would then route traffic to your actual applications, this could happen over public routes, or what's nicer is to use CloudFoundry container networking and the internal routes. In this way, you can force all traffic to go through your gateway because there is no public access to the other apps.

    https://docs.cloudfoundry.org/devguide/deploy-apps/routes-domains.html#internal-routes