Search in sources :

Example 1 with EndpointsList

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;
}
Also used : ConfigMapList(io.fabric8.kubernetes.api.model.ConfigMapList) PodResource(io.fabric8.kubernetes.client.dsl.PodResource) PersistentVolumeClaimList(io.fabric8.kubernetes.api.model.PersistentVolumeClaimList) DoneableStatefulSet(io.fabric8.kubernetes.api.model.extensions.DoneableStatefulSet) DoneablePod(io.fabric8.kubernetes.api.model.DoneablePod) Deployment(io.fabric8.kubernetes.api.model.extensions.Deployment) DoneableDeployment(io.fabric8.kubernetes.api.model.extensions.DoneableDeployment) DoneableEndpoints(io.fabric8.kubernetes.api.model.DoneableEndpoints) Endpoints(io.fabric8.kubernetes.api.model.Endpoints) DoneableDeployment(io.fabric8.kubernetes.api.model.extensions.DoneableDeployment) DeploymentList(io.fabric8.kubernetes.api.model.extensions.DeploymentList) DoneableService(io.fabric8.kubernetes.api.model.DoneableService) ExtensionsAPIGroupDSL(io.fabric8.kubernetes.client.dsl.ExtensionsAPIGroupDSL) StatefulSetList(io.fabric8.kubernetes.api.model.extensions.StatefulSetList) DoneableConfigMap(io.fabric8.kubernetes.api.model.DoneableConfigMap) EndpointsList(io.fabric8.kubernetes.api.model.EndpointsList) KubernetesClient(io.fabric8.kubernetes.client.KubernetesClient) PodList(io.fabric8.kubernetes.api.model.PodList) DoneableConfigMap(io.fabric8.kubernetes.api.model.DoneableConfigMap) ConfigMap(io.fabric8.kubernetes.api.model.ConfigMap) DoneablePod(io.fabric8.kubernetes.api.model.DoneablePod) Pod(io.fabric8.kubernetes.api.model.Pod) ServiceList(io.fabric8.kubernetes.api.model.ServiceList) Resource(io.fabric8.kubernetes.client.dsl.Resource) ScalableResource(io.fabric8.kubernetes.client.dsl.ScalableResource) RollableScalableResource(io.fabric8.kubernetes.client.dsl.RollableScalableResource) PodResource(io.fabric8.kubernetes.client.dsl.PodResource) KubernetesResource(io.fabric8.kubernetes.api.model.KubernetesResource) DoneableService(io.fabric8.kubernetes.api.model.DoneableService) Service(io.fabric8.kubernetes.api.model.Service) AppsAPIGroupDSL(io.fabric8.kubernetes.client.dsl.AppsAPIGroupDSL) ScalableResource(io.fabric8.kubernetes.client.dsl.ScalableResource) RollableScalableResource(io.fabric8.kubernetes.client.dsl.RollableScalableResource) DoneableEndpoints(io.fabric8.kubernetes.api.model.DoneableEndpoints) RollableScalableResource(io.fabric8.kubernetes.client.dsl.RollableScalableResource) DoneablePersistentVolumeClaim(io.fabric8.kubernetes.api.model.DoneablePersistentVolumeClaim) PersistentVolumeClaim(io.fabric8.kubernetes.api.model.PersistentVolumeClaim) DoneablePersistentVolumeClaim(io.fabric8.kubernetes.api.model.DoneablePersistentVolumeClaim) DoneableStatefulSet(io.fabric8.kubernetes.api.model.extensions.DoneableStatefulSet) StatefulSet(io.fabric8.kubernetes.api.model.extensions.StatefulSet)

Example 2 with EndpointsList

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();
}
Also used : EndpointsList(io.fabric8.kubernetes.api.model.EndpointsList) Endpoints(io.fabric8.kubernetes.api.model.Endpoints)

Example 3 with EndpointsList

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;
}
Also used : EndpointsList(io.fabric8.kubernetes.api.model.EndpointsList) Endpoints(io.fabric8.kubernetes.api.model.Endpoints)

Aggregations

Endpoints (io.fabric8.kubernetes.api.model.Endpoints)3 EndpointsList (io.fabric8.kubernetes.api.model.EndpointsList)3 ConfigMap (io.fabric8.kubernetes.api.model.ConfigMap)1 ConfigMapList (io.fabric8.kubernetes.api.model.ConfigMapList)1 DoneableConfigMap (io.fabric8.kubernetes.api.model.DoneableConfigMap)1 DoneableEndpoints (io.fabric8.kubernetes.api.model.DoneableEndpoints)1 DoneablePersistentVolumeClaim (io.fabric8.kubernetes.api.model.DoneablePersistentVolumeClaim)1 DoneablePod (io.fabric8.kubernetes.api.model.DoneablePod)1 DoneableService (io.fabric8.kubernetes.api.model.DoneableService)1 KubernetesResource (io.fabric8.kubernetes.api.model.KubernetesResource)1 PersistentVolumeClaim (io.fabric8.kubernetes.api.model.PersistentVolumeClaim)1 PersistentVolumeClaimList (io.fabric8.kubernetes.api.model.PersistentVolumeClaimList)1 Pod (io.fabric8.kubernetes.api.model.Pod)1 PodList (io.fabric8.kubernetes.api.model.PodList)1 Service (io.fabric8.kubernetes.api.model.Service)1 ServiceList (io.fabric8.kubernetes.api.model.ServiceList)1 Deployment (io.fabric8.kubernetes.api.model.extensions.Deployment)1 DeploymentList (io.fabric8.kubernetes.api.model.extensions.DeploymentList)1 DoneableDeployment (io.fabric8.kubernetes.api.model.extensions.DoneableDeployment)1 DoneableStatefulSet (io.fabric8.kubernetes.api.model.extensions.DoneableStatefulSet)1