use of io.fabric8.kubernetes.api.model.EndpointsList in project strimzi by strimzi.
the class MockKube method build.
public KubernetesClient build() {
KubernetesClient mockClient = mock(KubernetesClient.class);
MixedOperation<ConfigMap, ConfigMapList, DoneableConfigMap, Resource<ConfigMap, DoneableConfigMap>> mockCms = buildConfigMaps();
MixedOperation<PersistentVolumeClaim, PersistentVolumeClaimList, DoneablePersistentVolumeClaim, Resource<PersistentVolumeClaim, DoneablePersistentVolumeClaim>> mockPvcs = buildPvcs();
MixedOperation<Endpoints, EndpointsList, DoneableEndpoints, Resource<Endpoints, DoneableEndpoints>> mockEndpoints = buildEndpoints();
MixedOperation<Service, ServiceList, DoneableService, Resource<Service, DoneableService>> mockSvc = buildServices();
MixedOperation<Pod, PodList, DoneablePod, PodResource<Pod, DoneablePod>> mockPods = buildPods();
MixedOperation<StatefulSet, StatefulSetList, DoneableStatefulSet, RollableScalableResource<StatefulSet, DoneableStatefulSet>> mockSs = buildStatefulSets(mockPods);
MixedOperation<Deployment, DeploymentList, DoneableDeployment, ScalableResource<Deployment, DoneableDeployment>> mockDep = buildDeployments();
when(mockClient.configMaps()).thenReturn(mockCms);
when(mockClient.services()).thenReturn(mockSvc);
AppsAPIGroupDSL api = mock(AppsAPIGroupDSL.class);
when(api.statefulSets()).thenReturn(mockSs);
when(mockClient.apps()).thenReturn(api);
ExtensionsAPIGroupDSL ext = mock(ExtensionsAPIGroupDSL.class);
when(mockClient.extensions()).thenReturn(ext);
when(ext.deployments()).thenReturn(mockDep);
when(mockClient.pods()).thenReturn(mockPods);
when(mockClient.endpoints()).thenReturn(mockEndpoints);
when(mockClient.persistentVolumeClaims()).thenReturn(mockPvcs);
return mockClient;
}
use of io.fabric8.kubernetes.api.model.EndpointsList in project fabric8 by fabric8io.
the class Example method listEndpoints.
protected static void listEndpoints(KubernetesClient kube) {
System.out.println("\n\nLooking up endpoints");
System.out.println("=========================================================================");
EndpointsList endpoints = kube.endpoints().list();
List<Endpoints> endpointItems = endpoints.getItems();
for (Endpoints endpoint : endpointItems) {
System.out.println("Endpoint " + KubernetesHelper.getName(endpoint) + " labels: " + endpoint.getMetadata().getLabels());
}
System.out.println();
}
use of io.fabric8.kubernetes.api.model.EndpointsList in project fabric8 by fabric8io.
the class ServicePodsAssert method hasEndpointOrReadyPod.
/**
* Asserts that either this service has a valid Endpoint or that a pod is Ready for a period of time
*/
public ServicePodsAssert hasEndpointOrReadyPod(long notReadyTimeoutMS, long readyPeriodMS) {
EndpointsList list = client.endpoints().withLabels(getLabels(actual)).list();
if (list != null) {
List<Endpoints> items = list.getItems();
if (items.size() > 0) {
return this;
}
}
pods().isPodReadyForPeriod(notReadyTimeoutMS, readyPeriodMS);
return this;
}
Aggregations