org.springframework.cloud.deployer.spi.kubernetes.KubernetesDeployerProperties Java Examples
The following examples show how to use
org.springframework.cloud.deployer.spi.kubernetes.KubernetesDeployerProperties.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: KubernetesPlatformPropertiesTest.java From spring-cloud-skipper with Apache License 2.0 | 6 votes |
@Test public void deserializationTest() { Map<String, KubernetesDeployerProperties> k8sAccounts = this.kubernetesPlatformProperties.getAccounts(); KubernetesClient devK8sClient = KubernetesClientFactory.getKubernetesClient(k8sAccounts.get("dev")); KubernetesClient qaK8sClient = KubernetesClientFactory.getKubernetesClient(k8sAccounts.get("qa")); assertThat(k8sAccounts).hasSize(2); assertThat(k8sAccounts).containsKeys("dev", "qa"); assertThat(devK8sClient.getNamespace()).isEqualTo("dev1"); assertThat(devK8sClient.getMasterUrl().toString()).isEqualTo("https://192.168.0.1:8443"); assertThat(qaK8sClient.getMasterUrl().toString()).isEqualTo("https://192.168.0.2:8443"); assertThat(qaK8sClient.getNamespace()).isEqualTo("qaNamespace"); assertThat(k8sAccounts.get("dev").getImagePullPolicy()).isEqualTo(ImagePullPolicy.Always); assertThat(k8sAccounts.get("dev").getEntryPointStyle()).isEqualTo(EntryPointStyle.exec); assertThat(k8sAccounts.get("dev").getLimits().getCpu()).isEqualTo("4"); assertThat(k8sAccounts.get("qa").getNamespace()).isEqualTo("qaNamespace"); assertThat(k8sAccounts.get("qa").getImagePullPolicy()).isEqualTo(ImagePullPolicy.IfNotPresent); assertThat(k8sAccounts.get("qa").getEntryPointStyle()).isEqualTo(EntryPointStyle.boot); assertThat(k8sAccounts.get("qa").getLimits().getMemory()).isEqualTo("1024m"); }
Example #2
Source File: KubernetesTaskPlatformFactory.java From spring-cloud-dataflow with Apache License 2.0 | 6 votes |
@Override public Launcher createLauncher(String account) { KubernetesDeployerProperties kubernetesProperties = this.platformProperties.accountProperties(account); ContainerFactory containerFactory = new DefaultContainerFactory( this.platformProperties.accountProperties(account)); KubernetesClient kubernetesClient = KubernetesClientFactory.getKubernetesClient(this.platformProperties.accountProperties(account)); KubernetesTaskLauncher kubernetesTaskLauncher = new KubernetesTaskLauncher( kubernetesProperties, kubernetesClient, containerFactory); Scheduler scheduler = getScheduler(schedulerProperties, kubernetesClient); Launcher launcher = new Launcher(account, KUBERNETES_PLATFORM_TYPE, kubernetesTaskLauncher, scheduler); launcher.setDescription( String.format("master url = [%s], namespace = [%s], api version = [%s]", kubernetesClient.getMasterUrl(), kubernetesClient.getNamespace(), kubernetesClient.getApiVersion())); return launcher; }
Example #3
Source File: KubernetesPlatformPropertiesTests.java From spring-cloud-dataflow with Apache License 2.0 | 6 votes |
@Test public void deserializationTest() { Map<String, KubernetesDeployerProperties> k8sAccounts = this.kubernetesPlatformProperties.getAccounts(); KubernetesClient devK8sClient = KubernetesClientFactory.getKubernetesClient(k8sAccounts.get("dev")); KubernetesClient qaK8sClient = KubernetesClientFactory.getKubernetesClient(k8sAccounts.get("qa")); assertThat(k8sAccounts).hasSize(2); assertThat(k8sAccounts).containsKeys("dev", "qa"); assertThat(devK8sClient.getNamespace()).isEqualTo("dev1"); assertThat(devK8sClient.getMasterUrl().toString()).isEqualTo("https://192.168.0.1:8443"); assertThat(qaK8sClient.getMasterUrl().toString()).isEqualTo("https://192.168.0.2:8443"); assertThat(k8sAccounts.get("dev").getImagePullPolicy()).isEqualTo(ImagePullPolicy.Always); assertThat(k8sAccounts.get("dev").getEntryPointStyle()).isEqualTo(EntryPointStyle.exec); assertThat(k8sAccounts.get("dev").getLimits().getCpu()).isEqualTo("4"); assertThat(k8sAccounts.get("qa").getImagePullPolicy()).isEqualTo(ImagePullPolicy.IfNotPresent); assertThat(k8sAccounts.get("qa").getEntryPointStyle()).isEqualTo(EntryPointStyle.boot); assertThat(k8sAccounts.get("qa").getLimits().getMemory()).isEqualTo("1024m"); }
Example #4
Source File: KubernetesTaskPlatformFactoryTests.java From spring-cloud-dataflow with Apache License 2.0 | 6 votes |
@Test public void kubernetesTaskPlatformNoScheduler() { KubernetesPlatformProperties platformProperties = new KubernetesPlatformProperties(); KubernetesDeployerProperties deployerProperties = new KubernetesDeployerProperties(); platformProperties.setAccounts(Collections.singletonMap("k8s", deployerProperties)); KubernetesTaskPlatformFactory kubernetesTaskPlatformFactory = new KubernetesTaskPlatformFactory( platformProperties, Optional.empty(), false); TaskPlatform taskPlatform = kubernetesTaskPlatformFactory.createTaskPlatform(); assertThat(taskPlatform.getName()).isEqualTo("Kubernetes"); assertThat(taskPlatform.getLaunchers()).hasSize(1); assertThat(taskPlatform.getLaunchers().get(0).getScheduler()).isNull(); assertThat(taskPlatform.getLaunchers().get(0).getTaskLauncher()).isInstanceOf(KubernetesTaskLauncher.class); assertThat(taskPlatform.getLaunchers().get(0).getName()).isEqualTo("k8s"); assertThat(taskPlatform.getLaunchers().get(0).getType()).isEqualTo("Kubernetes"); assertThat(taskPlatform.getLaunchers().get(0).getDescription()).matches("^master url = \\[.+\\], namespace = " + "\\[.+\\], api version = \\[.+\\]$"); }
Example #5
Source File: KubernetesTaskPlatformFactoryTests.java From spring-cloud-dataflow with Apache License 2.0 | 6 votes |
@Test public void kubernetesTaskPlatformWithScheduler() { KubernetesPlatformProperties platformProperties = new KubernetesPlatformProperties(); KubernetesDeployerProperties deployerProperties = new KubernetesDeployerProperties(); platformProperties.setAccounts(Collections.singletonMap("k8s", deployerProperties)); KubernetesTaskPlatformFactory kubernetesTaskPlatformFactory = new KubernetesTaskPlatformFactory( platformProperties, Optional.of(new KubernetesSchedulerProperties()), true); TaskPlatform taskPlatform = kubernetesTaskPlatformFactory.createTaskPlatform(); assertThat(taskPlatform.getName()).isEqualTo("Kubernetes"); assertThat(taskPlatform.getLaunchers()).hasSize(1); assertThat(taskPlatform.getLaunchers().get(0).getScheduler()).isNotNull(); assertThat(taskPlatform.getLaunchers().get(0).getTaskLauncher()).isInstanceOf(KubernetesTaskLauncher.class); assertThat(taskPlatform.getLaunchers().get(0).getName()).isEqualTo("k8s"); assertThat(taskPlatform.getLaunchers().get(0).getType()).isEqualTo("Kubernetes"); assertThat(taskPlatform.getLaunchers().get(0).getDescription()).matches("^master url = \\[.+\\], namespace = " + "\\[.+\\], api version = \\[.+\\]$"); }
Example #6
Source File: KubernetesPlatformAutoConfiguration.java From spring-cloud-skipper with Apache License 2.0 | 5 votes |
@Bean public Platform kubernetesPlatform( KubernetesPlatformProperties kubernetesPlatformProperties) { List<Deployer> deployers = new ArrayList<>(); Map<String, KubernetesDeployerProperties> k8ConnectionProperties = kubernetesPlatformProperties .getAccounts(); k8ConnectionProperties.forEach((key, value) -> { Deployer deployer = createAndSaveKubernetesAppDeployers(key, value); deployers.add(deployer); }); return new Platform("Kubernetes", deployers); }
Example #7
Source File: KubernetesPlatformAutoConfiguration.java From spring-cloud-skipper with Apache License 2.0 | 5 votes |
protected Deployer createAndSaveKubernetesAppDeployers(String account, KubernetesDeployerProperties kubernetesProperties) { KubernetesClient kubernetesClient = KubernetesClientFactory.getKubernetesClient(kubernetesProperties); ContainerFactory containerFactory = new DefaultContainerFactory( kubernetesProperties); KubernetesAppDeployer kubernetesAppDeployer = new KubernetesAppDeployer( kubernetesProperties, kubernetesClient, containerFactory); Deployer deployer = new Deployer(account, "kubernetes", kubernetesAppDeployer); deployer.setDescription( String.format("master url = [%s], namespace = [%s], api version = [%s]", kubernetesClient.getMasterUrl(), kubernetesClient.getNamespace(), kubernetesClient.getApiVersion())); return deployer; }
Example #8
Source File: KubernetesPlatformProperties.java From spring-cloud-skipper with Apache License 2.0 | 4 votes |
public Map<String, KubernetesDeployerProperties> getAccounts() { return accounts; }
Example #9
Source File: KubernetesPlatformProperties.java From spring-cloud-skipper with Apache License 2.0 | 4 votes |
public void setAccounts(Map<String, KubernetesDeployerProperties> accounts) { this.accounts = accounts; }