public class CloudFoundryTaskLauncher extends Object
TaskLauncher implementation for CloudFoundry. When a task is launched, if it has not previously been
deployed, the app is created, the package is uploaded, and the droplet is created before launching the actual
task. If the app has been deployed previously, the app/package/droplet is reused and a new task is created.| Modifier and Type | Field and Description |
|---|---|
protected static com.fasterxml.jackson.databind.ObjectMapper |
OBJECT_MAPPER |
protected org.springframework.cloud.deployer.spi.core.RuntimeEnvironmentInfo |
runtimeEnvironmentInfo |
| Constructor and Description |
|---|
CloudFoundryTaskLauncher(org.cloudfoundry.client.CloudFoundryClient client,
CloudFoundryDeploymentProperties deploymentProperties,
org.cloudfoundry.operations.CloudFoundryOperations operations,
org.springframework.cloud.deployer.spi.core.RuntimeEnvironmentInfo runtimeEnvironmentInfo) |
| Modifier and Type | Method and Description |
|---|---|
void |
cancel(String id)
Setup a reactor flow to cancel a running task.
|
void |
cleanup(String id) |
protected void |
deleteLocalApplicationResourceFile(org.springframework.cloud.deployer.spi.core.AppDeploymentRequest appDeploymentRequest)
Always delete downloaded files for static http resources.
|
void |
destroy(String appName) |
org.springframework.cloud.deployer.spi.core.RuntimeEnvironmentInfo |
environmentInfo() |
String |
getCommand(org.cloudfoundry.client.v2.applications.SummaryApplicationResponse application,
org.springframework.cloud.deployer.spi.core.AppDeploymentRequest request)
Creates the command string required to launch a task by a service on Cloud Foundry.
|
protected Map<String,String> |
getEnvironmentVariables(String deploymentId,
org.springframework.cloud.deployer.spi.core.AppDeploymentRequest request) |
String |
getLog(String taskAppName) |
int |
getMaximumConcurrentTasks() |
int |
getRunningTaskExecutionCount() |
protected boolean |
hasCfEnv(org.springframework.core.io.Resource resource) |
String |
launch(org.springframework.cloud.deployer.spi.core.AppDeploymentRequest appDeploymentRequest)
Set up a reactor flow to launch a task.
|
protected Consumer<Throwable> |
logError(String msg)
Return a function usable in doOnError constructs that will unwrap unrecognized Cloud Foundry Exceptions
and log the text payload.
|
protected boolean |
maxConcurrentExecutionsReached() |
org.cloudfoundry.client.v2.applications.SummaryApplicationResponse |
stage(org.springframework.cloud.deployer.spi.core.AppDeploymentRequest request)
Set up a reactor flow to stage a task.
|
org.springframework.cloud.deployer.spi.task.TaskStatus |
status(String id)
Lookup the current status based on task id.
|
protected org.springframework.cloud.deployer.spi.task.TaskStatus |
toTaskStatus(org.cloudfoundry.client.v3.tasks.GetTaskResponse response) |
protected static final com.fasterxml.jackson.databind.ObjectMapper OBJECT_MAPPER
protected final org.springframework.cloud.deployer.spi.core.RuntimeEnvironmentInfo runtimeEnvironmentInfo
public CloudFoundryTaskLauncher(org.cloudfoundry.client.CloudFoundryClient client,
CloudFoundryDeploymentProperties deploymentProperties,
org.cloudfoundry.operations.CloudFoundryOperations operations,
org.springframework.cloud.deployer.spi.core.RuntimeEnvironmentInfo runtimeEnvironmentInfo)
public String launch(org.springframework.cloud.deployer.spi.core.AppDeploymentRequest appDeploymentRequest)
appDeploymentRequest - description of the application to be launchedpublic void destroy(String appName)
destroy in interface org.springframework.cloud.deployer.spi.task.TaskLauncherpublic org.cloudfoundry.client.v2.applications.SummaryApplicationResponse stage(org.springframework.cloud.deployer.spi.core.AppDeploymentRequest request)
request - description of the application to be staged.public String getCommand(org.cloudfoundry.client.v2.applications.SummaryApplicationResponse application, org.springframework.cloud.deployer.spi.core.AppDeploymentRequest request)
application - the SummaryApplicationResponse containing the result of the requested staging.request - The AppDeploymentRequest associated with the task staging.public void cancel(String id)
cancel in interface org.springframework.cloud.deployer.spi.task.TaskLauncherid - the task's id to be canceled as returned from the
TaskLauncher.launch(AppDeploymentRequest)public org.springframework.cloud.deployer.spi.task.TaskStatus status(String id)
status in interface org.springframework.cloud.deployer.spi.task.TaskLauncherid - taskId as returned from the TaskLauncher.launch(AppDeploymentRequest)public int getRunningTaskExecutionCount()
getRunningTaskExecutionCount in interface org.springframework.cloud.deployer.spi.task.TaskLauncherpublic int getMaximumConcurrentTasks()
getMaximumConcurrentTasks in interface org.springframework.cloud.deployer.spi.task.TaskLauncherprotected boolean maxConcurrentExecutionsReached()
protected org.springframework.cloud.deployer.spi.task.TaskStatus toTaskStatus(org.cloudfoundry.client.v3.tasks.GetTaskResponse response)
public void cleanup(String id)
cleanup in interface org.springframework.cloud.deployer.spi.task.TaskLauncherprotected Consumer<Throwable> logError(String msg)
protected void deleteLocalApplicationResourceFile(org.springframework.cloud.deployer.spi.core.AppDeploymentRequest appDeploymentRequest)
appDeploymentRequest - protected Map<String,String> getEnvironmentVariables(String deploymentId, org.springframework.cloud.deployer.spi.core.AppDeploymentRequest request)
protected boolean hasCfEnv(org.springframework.core.io.Resource resource)
public org.springframework.cloud.deployer.spi.core.RuntimeEnvironmentInfo environmentInfo()
Copyright © 2020 Pivotal Software, Inc.. All rights reserved.