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

The following examples show how to use io.fabric8.kubernetes.api.model.PersistentVolumeClaimList. 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: PersistentVolumeClaimTest.java    From kubernetes-client with Apache License 2.0 6 votes vote down vote up
@Test
void testList() {
  server.expect().withPath("/api/v1/namespaces/test/persistentvolumeclaims").andReturn(200, new PersistentVolumeClaimListBuilder().build()).once();

  server.expect().withPath("/api/v1/namespaces/ns1/persistentvolumeclaims").andReturn(200, new PersistentVolumeClaimListBuilder()
    .addNewItem().and()
    .addNewItem().and()
    .build()).once();

  KubernetesClient client = server.getClient();
  PersistentVolumeClaimList persistentVolumeClaimList = client.persistentVolumeClaims().inNamespace("test").list();
  assertNotNull(persistentVolumeClaimList);
  assertEquals(0, persistentVolumeClaimList.getItems().size());

  persistentVolumeClaimList = client.persistentVolumeClaims().inNamespace("ns1").list();
  assertNotNull(persistentVolumeClaimList);
  assertEquals(2, persistentVolumeClaimList.getItems().size());
}
 
Example #2
Source File: PersistentVolumeClaimTest.java    From kubernetes-client with Apache License 2.0 6 votes vote down vote up
@Test
void testListWithlabels() {
  server.expect().withPath("/api/v1/namespaces/test/persistentvolumeclaims?labelSelector=" + Utils.toUrlEncoded("key1=value1,key2=value2,key3=value3")).andReturn(200, new PersistentVolumeClaimListBuilder().build()).once();

  server.expect().withPath("/api/v1/namespaces/test/persistentvolumeclaims?labelSelector=" + Utils.toUrlEncoded("key1=value1,key2=value2")).andReturn(200, new PersistentVolumeClaimListBuilder()
    .addNewItem().and()
    .addNewItem().and()
    .addNewItem().and()
    .build()).once();

  KubernetesClient client = server.getClient();
  PersistentVolumeClaimList persistentVolumeClaimList = client.persistentVolumeClaims().inNamespace("test")
    .withLabel("key1", "value1")
    .withLabel("key2","value2")
    .withLabel("key3","value3")
    .list();
  assertNotNull(persistentVolumeClaimList);
  assertEquals(0, persistentVolumeClaimList.getItems().size());

  persistentVolumeClaimList = client.persistentVolumeClaims().inNamespace("test")
    .withLabel("key1", "value1")
    .withLabel("key2","value2")
    .list();
  assertNotNull(persistentVolumeClaimList);
  assertEquals(3, persistentVolumeClaimList.getItems().size());
}
 
Example #3
Source File: KubernetesAppDeployer.java    From spring-cloud-deployer-kubernetes with Apache License 2.0 5 votes vote down vote up
private void deletePvc(Map<String, String> labels) {
	FilterWatchListDeletable<PersistentVolumeClaim, PersistentVolumeClaimList, Boolean, Watch,
			Watcher<PersistentVolumeClaim>> pvcsToDelete = client.persistentVolumeClaims()
			.withLabels(labels);

	if (pvcsToDelete != null && pvcsToDelete.list().getItems() != null) {
		boolean pvcsDeleted = pvcsToDelete.delete();
		logger.debug(String.format("PVC deleted for: %s - %b", labels, pvcsDeleted));
	}
}
 
Example #4
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 #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: 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();