org.springframework.cloud.deployer.spi.kubernetes.KubernetesClientFactory Java Examples
The following examples show how to use
org.springframework.cloud.deployer.spi.kubernetes.KubernetesClientFactory.
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: 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 #5
Source File: KubernetesTestSupport.java From spring-cloud-deployer-kubernetes with Apache License 2.0 | 4 votes |
@Bean public KubernetesClient kubernetesClient() { return KubernetesClientFactory.getKubernetesClient(this.properties); }