io.fabric8.kubernetes.api.model.policy.PodDisruptionBudgetList Java Examples
The following examples show how to use
io.fabric8.kubernetes.api.model.policy.PodDisruptionBudgetList.
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: PodDisruptionBudgetTest.java From kubernetes-client with Apache License 2.0 | 6 votes |
@Test public void list() { server.expect().withPath("/apis/policy/v1beta1/namespaces/test/poddisruptionbudgets").andReturn(200, new PodDisruptionBudgetListBuilder().build()).once(); server.expect().withPath("/apis/policy/v1beta1/namespaces/ns1/poddisruptionbudgets").andReturn(200, new PodDisruptionBudgetListBuilder() .addNewItem().and() .addNewItem().and().build()).once(); server.expect().withPath("/apis/policy/v1beta1/poddisruptionbudgets").andReturn(200, new PodDisruptionBudgetListBuilder() .addNewItem().and() .addNewItem().and() .addNewItem() .and().build()).once(); KubernetesClient client = server.getClient(); PodDisruptionBudgetList podDisruptionBudgetList = client.policy().podDisruptionBudget().list(); assertNotNull(podDisruptionBudgetList); assertEquals(0, podDisruptionBudgetList.getItems().size()); podDisruptionBudgetList = client.policy().podDisruptionBudget().inNamespace("ns1").list(); assertNotNull(podDisruptionBudgetList); assertEquals(2, podDisruptionBudgetList.getItems().size()); podDisruptionBudgetList = client.policy().podDisruptionBudget().inAnyNamespace().list(); assertNotNull(podDisruptionBudgetList); assertEquals(3, podDisruptionBudgetList.getItems().size()); }
Example #2
Source File: PodDisruptionBudgetOperatorTest.java From strimzi-kafka-operator with Apache License 2.0 | 5 votes |
@Override public void createWhenExistsIsAPatch(VertxTestContext context, boolean cascade) { PodDisruptionBudget resource = resource(); Resource mockResource = mock(resourceType()); when(mockResource.get()).thenReturn(resource); when(mockResource.create(any())).thenReturn(resource); Deletable mockDeletable = mock(Deletable.class); EditReplacePatchDeletable mockERPD = mock(EditReplacePatchDeletable.class); when(mockERPD.withGracePeriod(anyLong())).thenReturn(mockDeletable); when(mockResource.cascading(cascade)).thenReturn(mockERPD); NonNamespaceOperation mockNameable = mock(NonNamespaceOperation.class); when(mockNameable.withName(matches(resource.getMetadata().getName()))).thenReturn(mockResource); MixedOperation mockCms = mock(MixedOperation.class); when(mockCms.inNamespace(matches(resource.getMetadata().getNamespace()))).thenReturn(mockNameable); KubernetesClient mockClient = mock(clientType()); mocker(mockClient, mockCms); AbstractResourceOperator<KubernetesClient, PodDisruptionBudget, PodDisruptionBudgetList, DoneablePodDisruptionBudget, Resource<PodDisruptionBudget, DoneablePodDisruptionBudget>> op = createResourceOperations(vertx, mockClient); Checkpoint async = context.checkpoint(); Future<ReconcileResult<PodDisruptionBudget>> fut = op.createOrUpdate(resource()); fut.onComplete(ar -> { if (!ar.succeeded()) { ar.cause().printStackTrace(); } assertThat(ar.succeeded(), is(true)); verify(mockResource).get(); verify(mockDeletable).delete(); verify(mockResource).create(any()); verify(mockResource, never()).patch(any()); verify(mockResource, never()).createNew(); verify(mockResource, never()).createOrReplace(any()); async.flag(); }); }
Example #3
Source File: PodDisruptionBudgetTest.java From kubernetes-client with Apache License 2.0 | 5 votes |
@Test public void testListWithLabels() { server.expect().withPath("/apis/policy/v1beta1/namespaces/test/poddisruptionbudgets?labelSelector=" + Utils.toUrlEncoded("key1=value1,key2=value2,key3=value3")).andReturn(200, new PodDisruptionBudgetListBuilder().build()).always(); server.expect().withPath("/apis/policy/v1beta1/namespaces/test/poddisruptionbudgets?labelSelector=" + Utils.toUrlEncoded("key1=value1,key2=value2")).andReturn(200, new PodDisruptionBudgetListBuilder() .addNewItem().and() .addNewItem().and() .addNewItem().and() .build()).once(); KubernetesClient client = server.getClient(); PodDisruptionBudgetList podDisruptionBudgetList = client.policy().podDisruptionBudget() .withLabel("key1", "value1") .withLabel("key2", "value2") .withLabel("key3", "value3") .list(); assertNotNull(podDisruptionBudgetList); assertEquals(0, podDisruptionBudgetList.getItems().size()); podDisruptionBudgetList = client.policy().podDisruptionBudget() .withLabel("key1", "value1") .withLabel("key2", "value2") .list(); assertNotNull(podDisruptionBudgetList); assertEquals(3, podDisruptionBudgetList.getItems().size()); }
Example #4
Source File: PodDisruptionBudgetController.java From rabbitmq-operator with Apache License 2.0 | 4 votes |
@Override protected MixedOperation<PodDisruptionBudget, PodDisruptionBudgetList, DoneablePodDisruptionBudget, Resource<PodDisruptionBudget, DoneablePodDisruptionBudget>> operation() { return getClient().policy().podDisruptionBudget(); }
Example #5
Source File: PodDisruptionBudgetOperator.java From strimzi-kafka-operator with Apache License 2.0 | 4 votes |
@Override protected MixedOperation<PodDisruptionBudget, PodDisruptionBudgetList, DoneablePodDisruptionBudget, Resource<PodDisruptionBudget, DoneablePodDisruptionBudget>> operation() { return client.policy().podDisruptionBudget(); }
Example #6
Source File: PodDisruptionBudgetOperatorTest.java From strimzi-kafka-operator with Apache License 2.0 | 4 votes |
@Override protected AbstractResourceOperator<KubernetesClient, PodDisruptionBudget, PodDisruptionBudgetList, DoneablePodDisruptionBudget, Resource<PodDisruptionBudget, DoneablePodDisruptionBudget>> createResourceOperations(Vertx vertx, KubernetesClient mockClient) { return new PodDisruptionBudgetOperator(vertx, mockClient); }
Example #7
Source File: PolicyAPIGroupClient.java From kubernetes-client with Apache License 2.0 | 4 votes |
@Override public MixedOperation<PodDisruptionBudget, PodDisruptionBudgetList, DoneablePodDisruptionBudget, Resource<PodDisruptionBudget, DoneablePodDisruptionBudget>> podDisruptionBudget() { return new PodDisruptionBudgetOperationsImpl(httpClient, getConfiguration()); }
Example #8
Source File: PolicyAPIGroupDSL.java From kubernetes-client with Apache License 2.0 | votes |
MixedOperation<PodDisruptionBudget, PodDisruptionBudgetList, DoneablePodDisruptionBudget, Resource<PodDisruptionBudget, DoneablePodDisruptionBudget>> podDisruptionBudget();