@Bean public TaskPlatform cloudFoundryPlatform( CloudFoundryPlatformProperties cloudFoundryPlatformProperties) { List<Launcher> launchers = cloudFoundryPlatformProperties.getAccounts().entrySet().stream().map( e -> createAndSaveCFTaskLauncher(e.getKey(), e.getValue())).collect(Collectors.toList()); return new TaskPlatform("Cloud Foundry", launchers); }
private boolean noTaskLauncherExists() { int taskLauncherCount = 0; for (TaskPlatform platform : this.taskPlatforms) { taskLauncherCount = taskLauncherCount + platform.getLaunchers().size(); } return (taskLauncherCount == 0); } }
@EventListener @Transactional public void initialize(ApplicationReadyEvent event) { if (noTaskLauncherExists()) { LocalDeployerProperties localDeployerProperties = new LocalDeployerProperties(); LocalTaskLauncher localTaskLauncher = new LocalTaskLauncher(localDeployerProperties); Launcher launcher = new Launcher("default", "local", localTaskLauncher); launcher.setDescription(prettyPrintLocalDeployerProperties(localDeployerProperties)); List<Launcher> localLaunchers = new ArrayList<>(); localLaunchers.add(launcher); for (TaskPlatform taskPlatform : taskPlatforms) { if (taskPlatform.getName().equalsIgnoreCase("Local")) { logger.info("Creating Local Task Launcher named 'default' since no Task Launchers configured."); taskPlatform.setLaunchers(localLaunchers); } } } this.taskPlatforms.forEach(platform -> { platform.getLaunchers().forEach(launcher -> { this.launcherRepository.save(launcher); logger.info(String.format( "Added '%s' platform account '%s' into Task Launcher repository.", platform.getName(), launcher.getName())); }); }); }
@Bean public TaskPlatform kubernetesTaskPlatform(KubernetesPlatformProperties kubernetesPlatformProperties) { List<Launcher> launchers = new ArrayList<>(); Map<String, KubernetesDeployerProperties> k8sDeployerPropertiesMap = kubernetesPlatformProperties .getAccounts(); k8sDeployerPropertiesMap.forEach((key, value) -> { Launcher launcher = createAndSaveKubernetesTaskLaunchers(key, value); launchers.add(launcher); }); return new TaskPlatform("Kubernetes", launchers); }
@Bean public TaskPlatform cloudFoundryPlatform( CloudFoundryPlatformProperties cloudFoundryPlatformProperties) { List<Launcher> launchers = cloudFoundryPlatformProperties.getAccounts().entrySet().stream().map( e -> createAndSaveCFTaskLauncher(e.getKey(), e.getValue())).collect(Collectors.toList()); return new TaskPlatform("Cloud Foundry", launchers); }
@Bean @Conditional(OnLocalPlatform.class) public TaskPlatform localTaskPlatform(LocalPlatformProperties localPlatformProperties) { List<Launcher> launchers = new ArrayList<>(); Map<String, LocalDeployerProperties> localDeployerPropertiesMap = localPlatformProperties.getAccounts(); for (Map.Entry<String, LocalDeployerProperties> entry : localDeployerPropertiesMap .entrySet()) { LocalTaskLauncher localTaskLauncher = new LocalTaskLauncher(entry.getValue()); Launcher launcher = new Launcher(entry.getKey(), "local", localTaskLauncher); launcher.setDescription(prettyPrintLocalDeployerProperties(entry.getValue())); launchers.add(launcher); } return new TaskPlatform("Local", launchers); }