Search in sources :

Example 1 with JolokiaClients

use of io.fabric8.kubernetes.jolokia.JolokiaClients in project fabric8 by fabric8io.

the class J4pClientProvider method lookup.

@Override
public Object lookup(ArquillianResource resource, Annotation... qualifiers) {
    KubernetesClient client = this.clientInstance.get();
    Session session = this.sessionInstance.get();
    JolokiaClients jolokiaClients = new JolokiaClients(client);
    String serviceName = getServiceName(qualifiers);
    String podName = getPodName(qualifiers);
    String replicationControllerName = getReplicationControllerName(qualifiers);
    if (Strings.isNotBlank(serviceName)) {
        Service service = client.services().inNamespace(session.getNamespace()).withName(serviceName).get();
        if (service != null) {
            return jolokiaClients.clientForService(service);
        }
    }
    if (Strings.isNotBlank(podName)) {
        Pod pod = client.pods().inNamespace(session.getNamespace()).withName(serviceName).get();
        if (pod != null) {
            return jolokiaClients.clientForPod(pod);
        }
    }
    if (Strings.isNotBlank(replicationControllerName)) {
        ReplicationController replicationController = client.replicationControllers().inNamespace(session.getNamespace()).withName(replicationControllerName).get();
        if (replicationController != null) {
            return jolokiaClients.clientForReplicationController(replicationController);
        }
    }
    return null;
}
Also used : KubernetesClient(io.fabric8.kubernetes.client.KubernetesClient) Pod(io.fabric8.kubernetes.api.model.Pod) ReplicationController(io.fabric8.kubernetes.api.model.ReplicationController) Service(io.fabric8.kubernetes.api.model.Service) JolokiaClients(io.fabric8.kubernetes.jolokia.JolokiaClients) Session(io.fabric8.arquillian.kubernetes.Session)

Example 2 with JolokiaClients

use of io.fabric8.kubernetes.jolokia.JolokiaClients in project fabric8 by fabric8io.

the class JolokiaClientsProvider method lookup.

@Override
public Object lookup(ArquillianResource resource, Annotation... qualifiers) {
    KubernetesClient client = this.clientInstance.get();
    JolokiaClients jolokiaClients = new JolokiaClients(client);
    return jolokiaClients;
}
Also used : KubernetesClient(io.fabric8.kubernetes.client.KubernetesClient) JolokiaClients(io.fabric8.kubernetes.jolokia.JolokiaClients)

Aggregations

KubernetesClient (io.fabric8.kubernetes.client.KubernetesClient)2 JolokiaClients (io.fabric8.kubernetes.jolokia.JolokiaClients)2 Session (io.fabric8.arquillian.kubernetes.Session)1 Pod (io.fabric8.kubernetes.api.model.Pod)1 ReplicationController (io.fabric8.kubernetes.api.model.ReplicationController)1 Service (io.fabric8.kubernetes.api.model.Service)1