incubator-brooklyn icon indicating copy to clipboard operation
incubator-brooklyn copied to clipboard

Adding CloudFoundry support.

Open kiuby88 opened this issue 9 years ago • 6 comments

For adding PaaS support, a CloudFoundryLocation is added which is based on PaasLocation. This new location contains a API client for CloudFoundry Paas Services, (CloudFoundry Java Client), that allows to use the services of this provider.

Extracting ssh behaviour from SoftwareProcessImpl: provisioning flags

For adding paas support, SoftwareProcess entities should to be agnostics in order to allows to be deployed on SSH and PaaS locations. So, the machine behaviour and management should be decoupled of the entities and it should be moved to an isolate class.

SoftwareProcessImpl contained a pair of method for obtaining the needed flags to create and configure a VM. However as it was mentioned previously, this entity shouldn't contain any ssh (machine) behaviour. Then, this code is moved to an external class, MachineProvisioningLocationFlagsSupplier that is managed in SoftwareProcessImpl as a LocationFlagSupplier interface. Moreover, an equivalent class is added to represent this behaviour (obtain flags location) for PaaS.

SoftwareProcessImpl will select a behaviour for obtaining the flags depending on the selected location for deploying the entity.

Adding BehaviourFactory for selecting PaaS or SSH behaviour in run time.

Following the previous commits, SoftwareProcessImpl entities should select PaaS or SSH behaviour in run time, depending on the target location. An entity know the target location when it is started (calling to start effector), then just when this effector is called the entity will able to know the selected location, so in this moment the entity will able to find the required behaviour, SSH or PaaS.

The whole behaviour is composed by several classes, then SoftwareProcessImpl uses a factory (BehaviourFactory) which is selected according to the target location. This factory allows to select in run time all behaviour focus in a location.

Adding PaaS support to TomcatServer entity.

The drivers for CloudFoundry are added to SoftwareProcess entity and JavaWebAppSoftwareProcess implementation entity. The final PaaS support is added to TomcatServer entity using a new driver which is focused on CloudFoundryPaaSLocation.

A new hierarchy of drivers is added to Brooklyn, these new drivers is oriented to PaaS but they follow the hierarchy defined for SSH. For example, AbstractSoftwareProcessDriver, 'AbstractSoftwareProcessSshDriverallow to 'SoftwareProcess' entities use drivers for location based on machines. Then, to enable the PaaS support forSoftwareProcessentities a set of drivers is added such asAbstractSoftwareProcessCloudFoundryDriverandAbstractApplicationCloudFoundryDriver`. Fixing dependency convergence.

TODO:

  • It should be necessary to define the start effector body in SoftwareProcessImpl because currently the first target location fixes the behavior of the entity.
  • The restart effector should be defined.
  • Some methods could be renamed.

Tested Providers

This approach has been tested using:

kiuby88 avatar Sep 22 '15 13:09 kiuby88

incubator-brooklyn-pull-requests #1847 FAILURE Looks like there's a problem with this pull request

asfbot avatar Sep 22 '15 14:09 asfbot

incubator-brooklyn-pull-requests #1848 SUCCESS This pull request looks good

asfbot avatar Sep 22 '15 14:09 asfbot

incubator-brooklyn-pull-requests #1861 FAILURE Looks like there's a problem with this pull request

asfbot avatar Sep 25 '15 10:09 asfbot

incubator-brooklyn-pull-requests #1862 FAILURE Looks like there's a problem with this pull request

asfbot avatar Sep 25 '15 11:09 asfbot

@kiuby88 Thanks for this, would you mind rebasing and I'll dive into this shortly?

robertgmoss avatar Nov 24 '15 13:11 robertgmoss

Thanks for your reply. @robertgmoss, I will rebase asap.

kiuby88 avatar Nov 24 '15 13:11 kiuby88