io.fabric8.kubernetes.api.model.policy.DoneablePodDisruptionBudget Java Examples

The following examples show how to use io.fabric8.kubernetes.api.model.policy.DoneablePodDisruptionBudget. 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: PodDisruptionBudgetOperatorTest.java    From strimzi-kafka-operator with Apache License 2.0 5 votes vote down vote up
@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 #2
Source File: PodDisruptionBudgetController.java    From rabbitmq-operator with Apache License 2.0 4 votes vote down vote up
@Override
protected MixedOperation<PodDisruptionBudget, PodDisruptionBudgetList, DoneablePodDisruptionBudget, Resource<PodDisruptionBudget, DoneablePodDisruptionBudget>> operation() {
    return getClient().policy().podDisruptionBudget();
}
 
Example #3
Source File: PodDisruptionBudgetOperator.java    From strimzi-kafka-operator with Apache License 2.0 4 votes vote down vote up
@Override
protected MixedOperation<PodDisruptionBudget, PodDisruptionBudgetList, DoneablePodDisruptionBudget, Resource<PodDisruptionBudget, DoneablePodDisruptionBudget>> operation() {
    return client.policy().podDisruptionBudget();
}
 
Example #4
Source File: PodDisruptionBudgetOperatorTest.java    From strimzi-kafka-operator with Apache License 2.0 4 votes vote down vote up
@Override
protected AbstractResourceOperator<KubernetesClient, PodDisruptionBudget, PodDisruptionBudgetList, DoneablePodDisruptionBudget, Resource<PodDisruptionBudget, DoneablePodDisruptionBudget>> createResourceOperations(Vertx vertx, KubernetesClient mockClient) {
    return new PodDisruptionBudgetOperator(vertx, mockClient);
}
 
Example #5
Source File: PolicyAPIGroupClient.java    From kubernetes-client with Apache License 2.0 4 votes vote down vote up
@Override
public MixedOperation<PodDisruptionBudget, PodDisruptionBudgetList, DoneablePodDisruptionBudget, Resource<PodDisruptionBudget, DoneablePodDisruptionBudget>> podDisruptionBudget() {
  return new PodDisruptionBudgetOperationsImpl(httpClient, getConfiguration());
}
 
Example #6
Source File: PolicyAPIGroupDSL.java    From kubernetes-client with Apache License 2.0 votes vote down vote up
MixedOperation<PodDisruptionBudget, PodDisruptionBudgetList, DoneablePodDisruptionBudget, Resource<PodDisruptionBudget, DoneablePodDisruptionBudget>> podDisruptionBudget();