Search in sources :

Example 16 with External

use of io.fabric8.annotations.External in project fabric8 by fabric8io.

the class GetServiceURL method main.

public static void main(String... args) {
    if (args.length < 1) {
        System.out.println("Usage nameOfService");
        return;
    }
    try {
        String name = args[0];
        KubernetesClient kube = new DefaultKubernetesClient();
        String namespace = kube.getNamespace();
        if (Strings.isNullOrBlank(namespace)) {
            namespace = "default";
        }
        String url = KubernetesHelper.getServiceURL(kube, name, namespace, "http", true);
        System.out.println("Service " + name + " has external URL: " + url);
    } catch (Exception e) {
        System.out.println("FAILED: " + e);
        e.printStackTrace();
    }
}
Also used : KubernetesClient(io.fabric8.kubernetes.client.KubernetesClient) DefaultKubernetesClient(io.fabric8.kubernetes.client.DefaultKubernetesClient) DefaultKubernetesClient(io.fabric8.kubernetes.client.DefaultKubernetesClient)

Aggregations

ArrayList (java.util.ArrayList)4 External (io.fabric8.annotations.External)3 PortName (io.fabric8.annotations.PortName)3 Protocol (io.fabric8.annotations.Protocol)3 ServiceName (io.fabric8.annotations.ServiceName)3 LockHandle (io.fabric8.api.LockHandle)3 Alias (io.fabric8.annotations.Alias)2 Configuration (io.fabric8.annotations.Configuration)2 Endpoint (io.fabric8.annotations.Endpoint)2 Path (io.fabric8.annotations.Path)2 Service (io.fabric8.kubernetes.api.model.Service)2 KubernetesClient (io.fabric8.kubernetes.client.KubernetesClient)2 OpenShiftClient (io.fabric8.openshift.client.OpenShiftClient)2 IOException (java.io.IOException)2 Type (java.lang.reflect.Type)2 List (java.util.List)2 Set (java.util.Set)2 DeploymentEndpoints (com.liveperson.ephemerals.deploy.DeploymentEndpoints)1 ResourceUtils.addIdentityRequirement (io.fabric8.agent.resolver.ResourceUtils.addIdentityRequirement)1 DataStoreTemplate (io.fabric8.api.DataStoreTemplate)1