io.fabric8.kubernetes.api.model.DoneablePersistentVolumeClaim Java Examples

The following examples show how to use io.fabric8.kubernetes.api.model.DoneablePersistentVolumeClaim. 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: PatchService.java    From jkube with Eclipse Public License 2.0 6 votes vote down vote up
private static EntityPatcher<PersistentVolumeClaim> pvcPatcher() {
    return (KubernetesClient client, String namespace, PersistentVolumeClaim newObj, PersistentVolumeClaim oldObj) -> {
        if (UserConfigurationCompare.configEqual(newObj, oldObj)) {
            return oldObj;
        }
        DoneablePersistentVolumeClaim entity =
            client.persistentVolumeClaims()
                  .inNamespace(namespace)
                  .withName(oldObj.getMetadata().getName())
                  .edit();

        if (!UserConfigurationCompare.configEqual(newObj.getMetadata(), oldObj.getMetadata())) {
            entity.withMetadata(newObj.getMetadata());
        }

        if(!UserConfigurationCompare.configEqual(newObj.getSpec(), oldObj.getSpec())) {
                entity.withSpec(newObj.getSpec());
        }
        return entity.done();
    };
}
 
Example #2
Source File: KubernetesPersistentVolumeClaims.java    From che with Eclipse Public License 2.0 6 votes vote down vote up
private Watch pvcIsBoundWatcher(
    CompletableFuture<PersistentVolumeClaim> future,
    Resource<PersistentVolumeClaim, DoneablePersistentVolumeClaim> pvcResource) {
  return pvcResource.watch(
      new Watcher<PersistentVolumeClaim>() {
        @Override
        public void eventReceived(Action action, PersistentVolumeClaim pvc) {
          if (pvc.getStatus().getPhase().equals(PVC_BOUND_PHASE)) {
            LOG.debug("pvc '" + pvc.getMetadata().getName() + "' is bound");
            future.complete(pvc);
          }
        }

        @Override
        public void onClose(KubernetesClientException cause) {
          safelyFinishFutureOnClose(cause, future, pvcResource.get().getMetadata().getName());
        }
      });
}
 
Example #3
Source File: MockKube.java    From strimzi-kafka-operator with Apache License 2.0 5 votes vote down vote up
private MixedOperation<StatefulSet, StatefulSetList, DoneableStatefulSet, RollableScalableResource<StatefulSet, DoneableStatefulSet>>
    buildStatefulSets(MockBuilder<Pod, PodList, DoneablePod, PodResource<Pod, DoneablePod>> podMockBuilder, MixedOperation<Pod, PodList, DoneablePod, PodResource<Pod, DoneablePod>> mockPods,
                      MixedOperation<PersistentVolumeClaim, PersistentVolumeClaimList, DoneablePersistentVolumeClaim,
                              Resource<PersistentVolumeClaim, DoneablePersistentVolumeClaim>> mockPvcs) {
    MixedOperation<StatefulSet, StatefulSetList, DoneableStatefulSet, RollableScalableResource<StatefulSet,
            DoneableStatefulSet>> result = new StatefulSetMockBuilder(podMockBuilder, ssDb, podDb, mockPods, mockPvcs).build();
    return result;
}
 
Example #4
Source File: PersistentVolumeClaimTest.java    From kubernetes-client with Apache License 2.0 5 votes vote down vote up
@Test
void testEditMissing() {
  server.expect().withPath("/api/v1/namespaces/test/persistentvolumeclaims/persistentvolumeclaim").andReturn(404, "error message from kubernetes").always();
  KubernetesClient client = server.getClient();
  Resource<PersistentVolumeClaim, DoneablePersistentVolumeClaim> pvcResource =  client.persistentVolumeClaims().inNamespace("test").withName("persistentvolumeclaim");
  Assertions.assertThrows(KubernetesClientException.class, pvcResource::edit);
}
 
Example #5
Source File: PersistentVolumeClaimController.java    From rabbitmq-operator with Apache License 2.0 4 votes vote down vote up
@Override
protected MixedOperation<PersistentVolumeClaim, PersistentVolumeClaimList, DoneablePersistentVolumeClaim, Resource<PersistentVolumeClaim, DoneablePersistentVolumeClaim>> operation() {
    return getClient().persistentVolumeClaims();
}
 
Example #6
Source File: PvcOperator.java    From strimzi-kafka-operator with Apache License 2.0 4 votes vote down vote up
@Override
protected MixedOperation<PersistentVolumeClaim, PersistentVolumeClaimList, DoneablePersistentVolumeClaim, Resource<PersistentVolumeClaim, DoneablePersistentVolumeClaim>> operation() {
    return client.persistentVolumeClaims();
}
 
Example #7
Source File: AutoAdaptableKubernetesClient.java    From kubernetes-client with Apache License 2.0 4 votes vote down vote up
@Override
public MixedOperation<PersistentVolumeClaim, PersistentVolumeClaimList, DoneablePersistentVolumeClaim, Resource<PersistentVolumeClaim, DoneablePersistentVolumeClaim>> persistentVolumeClaims() {
  return delegate.persistentVolumeClaims();
}
 
Example #8
Source File: DefaultKubernetesClient.java    From kubernetes-client with Apache License 2.0 4 votes vote down vote up
@Override
public MixedOperation<PersistentVolumeClaim, PersistentVolumeClaimList, DoneablePersistentVolumeClaim, Resource<PersistentVolumeClaim, DoneablePersistentVolumeClaim>> persistentVolumeClaims() {
  return new PersistentVolumeClaimOperationsImpl(httpClient, getConfiguration());
}
 
Example #9
Source File: ManagedKubernetesClient.java    From kubernetes-client with Apache License 2.0 4 votes vote down vote up
public MixedOperation<PersistentVolumeClaim, PersistentVolumeClaimList, DoneablePersistentVolumeClaim, Resource<PersistentVolumeClaim, DoneablePersistentVolumeClaim>> persistentVolumeClaims() {
  return delegate.persistentVolumeClaims();
}
 
Example #10
Source File: DefaultOpenShiftClient.java    From kubernetes-client with Apache License 2.0 4 votes vote down vote up
@Override
public MixedOperation<PersistentVolumeClaim, PersistentVolumeClaimList, DoneablePersistentVolumeClaim, Resource<PersistentVolumeClaim, DoneablePersistentVolumeClaim>> persistentVolumeClaims() {
  return delegate.persistentVolumeClaims();
}
 
Example #11
Source File: KubernetesClient.java    From kubernetes-client with Apache License 2.0 2 votes vote down vote up
/**
 * API entrypoint for PersistentVolumeClaim related operations. PersistentVolumeClaim (core/v1)
 *
 * @return MixedOperation object for PersistentVolumeClaim related operations.
 */
MixedOperation<PersistentVolumeClaim, PersistentVolumeClaimList, DoneablePersistentVolumeClaim, Resource<PersistentVolumeClaim, DoneablePersistentVolumeClaim>> persistentVolumeClaims();