io.fabric8.kubernetes.api.model.apps.DeploymentList Java Examples
The following examples show how to use
io.fabric8.kubernetes.api.model.apps.DeploymentList.
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: KubernetesAppDeployer.java From spring-cloud-deployer-kubernetes with Apache License 2.0 | 5 votes |
private void deleteDeployment(Map<String, String> labels) { FilterWatchListDeletable<Deployment, DeploymentList, Boolean, Watch, Watcher<Deployment>> deploymentsToDelete = client.apps().deployments().withLabels(labels); if (deploymentsToDelete != null && deploymentsToDelete.list().getItems() != null) { boolean deploymentsDeleted = deploymentsToDelete.delete(); logger.debug(String.format("Deployment deleted for: %s - %b", labels, deploymentsDeleted)); } }
Example #2
Source File: DeploymentTest.java From kubernetes-client with Apache License 2.0 | 5 votes |
@Test public void testList() { server.expect().withPath("/apis/apps/v1/namespaces/test/deployments").andReturn(200, new DeploymentListBuilder().build()).once(); server.expect().withPath("/apis/apps/v1/namespaces/ns1/deployments").andReturn(200, new DeploymentListBuilder() .addNewItem().and() .addNewItem().and().build()).once(); server.expect().withPath("/apis/apps/v1/deployments").andReturn(200, new DeploymentListBuilder() .addNewItem().and() .addNewItem().and() .addNewItem() .and().build()).once(); KubernetesClient client = server.getClient(); DeploymentList deploymentList = client.apps().deployments().list(); assertNotNull(deploymentList); assertEquals(0, deploymentList.getItems().size()); deploymentList = client.apps().deployments().inNamespace("ns1").list(); assertNotNull(deploymentList); assertEquals(2, deploymentList.getItems().size()); deploymentList = client.apps().deployments().inAnyNamespace().list(); assertNotNull(deploymentList); assertEquals(3, deploymentList.getItems().size()); }
Example #3
Source File: DeploymentTest.java From kubernetes-client with Apache License 2.0 | 5 votes |
@Test public void testListWithLabels() { server.expect().withPath("/apis/apps/v1/namespaces/test/deployments?labelSelector=" + Utils.toUrlEncoded("key1=value1,key2=value2,key3=value3")).andReturn(200, new DeploymentListBuilder().build()).always(); server.expect().withPath("/apis/apps/v1/namespaces/test/deployments?labelSelector=" + Utils.toUrlEncoded("key1=value1,key2=value2")).andReturn(200, new DeploymentListBuilder() .addNewItem().and() .addNewItem().and() .addNewItem().and() .build()).once(); KubernetesClient client = server.getClient(); DeploymentList deploymentList = client.apps().deployments() .withLabel("key1", "value1") .withLabel("key2", "value2") .withLabel("key3", "value3") .list(); assertNotNull(deploymentList); assertEquals(0, deploymentList.getItems().size()); deploymentList = client.apps().deployments() .withLabel("key1", "value1") .withLabel("key2", "value2") .list(); assertNotNull(deploymentList); assertEquals(3, deploymentList.getItems().size()); }
Example #4
Source File: DeploymentOperationsImpl.java From kubernetes-client with Apache License 2.0 | 5 votes |
public DeploymentOperationsImpl(RollingOperationContext context) { super(context.withApiGroupName("apps") .withApiGroupVersion("v1") .withPlural("deployments")); this.type = Deployment .class; this.listType = DeploymentList.class; this.doneableType = DoneableDeployment.class; }
Example #5
Source File: ListLoadTest.java From kubernetes-client with Apache License 2.0 | 5 votes |
@Test public void test() { client.load(getClass().getResourceAsStream("/test-list.json")).createOrReplace(); DeploymentList aDeploymentList = client.apps().deployments().inNamespace(currentNamespace).list(); assertThat(aDeploymentList).isNotNull(); assertEquals(1, aDeploymentList.getItems().size()); }
Example #6
Source File: DeploymentOperator.java From strimzi-kafka-operator with Apache License 2.0 | 4 votes |
@Override protected MixedOperation<Deployment, DeploymentList, DoneableDeployment, RollableScalableResource<Deployment, DoneableDeployment>> operation() { return client.apps().deployments(); }
Example #7
Source File: DeploymentMockBuilder.java From strimzi-kafka-operator with Apache License 2.0 | 4 votes |
public DeploymentMockBuilder(Map<String, Deployment> depDb, MixedOperation<Pod, PodList, DoneablePod, PodResource<Pod, DoneablePod>> mockPods) { super(Deployment.class, DeploymentList.class, DoneableDeployment.class, castClass(RollableScalableResource.class), depDb); this.mockPods = mockPods; }
Example #8
Source File: DeploymentCrudTest.java From kubernetes-client with Apache License 2.0 | 4 votes |
@Test public void testCrud() { KubernetesClient client = server.getClient(); Deployment deployment1 = new DeploymentBuilder().withNewMetadata() .withName("deployment1") .withNamespace("ns1") .addToLabels("testKey", "testValue") .endMetadata() .withNewSpec() .endSpec() .build(); Deployment deployment2 = new DeploymentBuilder().withNewMetadata() .withName("deployment2") .withNamespace("ns1") .addToLabels("testKey", "testValue") .endMetadata() .withNewSpec() .endSpec() .build(); Deployment deployment3 = new DeploymentBuilder().withNewMetadata() .withName("deployment3") .addToLabels("testKey", "testValue") .withNamespace("ns2") .endMetadata() .withNewSpec() .endSpec() .build(); client.apps().deployments().inNamespace("ns1").create(deployment1); client.apps().deployments().inNamespace("ns1").create(deployment2); client.apps().deployments().inNamespace("ns2").create(deployment3); DeploymentList aDeploymentList = client.apps().deployments().inAnyNamespace().list(); assertNotNull(aDeploymentList); assertEquals(3, aDeploymentList.getItems().size()); aDeploymentList = client.apps().deployments().inNamespace("ns1").list(); assertNotNull(aDeploymentList); assertEquals(2, aDeploymentList.getItems().size()); aDeploymentList = client.apps() .deployments() .inAnyNamespace() .withLabels(Collections.singletonMap("testKey", "testValue")) .list(); assertNotNull(aDeploymentList); assertEquals(3, aDeploymentList.getItems().size()); boolean bDeleted = client.apps().deployments().inNamespace("ns2").withName("deployment3").delete(); assertTrue(bDeleted); deployment2 = client.apps().deployments() .inNamespace("ns1").withName("deployment2").edit() .editMetadata().addToLabels("key1", "value1").endMetadata().done(); assertNotNull(deployment2); assertEquals("value1", deployment2.getMetadata().getLabels().get("key1")); }
Example #9
Source File: ExtensionsAPIGroupDSL.java From kubernetes-client with Apache License 2.0 | 4 votes |
@Deprecated MixedOperation<Deployment, DeploymentList, DoneableDeployment, RollableScalableResource<Deployment, DoneableDeployment>> deployments();
Example #10
Source File: DeploymentOperationsImpl.java From kubernetes-client with Apache License 2.0 | 4 votes |
@Override public RollingUpdater<Deployment, DeploymentList, DoneableDeployment> getRollingUpdater(long rollingTimeout, TimeUnit rollingTimeUnit) { return new DeploymentRollingUpdater(client, config, getNamespace(), rollingTimeUnit.toMillis(rollingTimeout), config.getLoggingInterval()); }
Example #11
Source File: DeploymentRollingUpdater.java From kubernetes-client with Apache License 2.0 | 4 votes |
@Override protected Operation<Deployment, DeploymentList, DoneableDeployment, RollableScalableResource<Deployment, DoneableDeployment>> resources() { return new DeploymentOperationsImpl(client, config); }
Example #12
Source File: ExtensionsAPIGroupClient.java From kubernetes-client with Apache License 2.0 | 4 votes |
@Override @Deprecated public MixedOperation<Deployment, DeploymentList, DoneableDeployment, RollableScalableResource<Deployment, DoneableDeployment>> deployments() { return new DeploymentOperationsImpl(httpClient, getConfiguration()); }
Example #13
Source File: AppsAPIGroupClient.java From kubernetes-client with Apache License 2.0 | 4 votes |
@Override public MixedOperation<Deployment, DeploymentList, DoneableDeployment, RollableScalableResource<Deployment, DoneableDeployment>> deployments() { return new DeploymentOperationsImpl(httpClient, getConfiguration()); }
Example #14
Source File: DeploymentIT.java From kubernetes-client with Apache License 2.0 | 4 votes |
@Test public void list() { DeploymentList aDeploymentList = client.apps().deployments().inNamespace(currentNamespace).list(); assertThat(aDeploymentList).isNotNull(); assertEquals(1, aDeploymentList.getItems().size()); }
Example #15
Source File: AppsAPIGroupDSL.java From kubernetes-client with Apache License 2.0 | votes |
MixedOperation<Deployment, DeploymentList, DoneableDeployment, RollableScalableResource<Deployment, DoneableDeployment>> deployments();