Search in sources :

Example 1 with Serializer

use of org.eclipse.che.workspace.infrastructure.kubernetes.Annotations.Serializer in project che-server by eclipse-che.

the class RouteServerResolverTest method createService.

private Service createService(String name, String machineName, Integer port, Map<String, ServerConfigImpl> servers) {
    Serializer serializer = Annotations.newSerializer();
    serializer.machineName(machineName);
    if (servers != null) {
        serializer.servers(servers);
    }
    return new ServiceBuilder().withNewMetadata().withName(name).withAnnotations(serializer.annotations()).endMetadata().withNewSpec().withPorts(new ServicePortBuilder().withPort(port).withNewTargetPort().withIntVal(port).endTargetPort().build()).endSpec().build();
}
Also used : ServicePortBuilder(io.fabric8.kubernetes.api.model.ServicePortBuilder) Serializer(org.eclipse.che.workspace.infrastructure.kubernetes.Annotations.Serializer) ServiceBuilder(io.fabric8.kubernetes.api.model.ServiceBuilder)

Example 2 with Serializer

use of org.eclipse.che.workspace.infrastructure.kubernetes.Annotations.Serializer in project che-server by eclipse-che.

the class IngressServerResolverTest method createService.

private Service createService(String name, String machineName, Integer port, Map<String, ServerConfigImpl> servers) {
    Serializer serializer = Annotations.newSerializer();
    serializer.machineName(machineName);
    if (servers != null) {
        serializer.servers(servers);
    }
    return new ServiceBuilder().withNewMetadata().withName(name).withAnnotations(serializer.annotations()).endMetadata().withNewSpec().withPorts(new ServicePortBuilder().withPort(port).withNewTargetPort().withIntVal(port).endTargetPort().build()).endSpec().build();
}
Also used : ServicePortBuilder(io.fabric8.kubernetes.api.model.ServicePortBuilder) Serializer(org.eclipse.che.workspace.infrastructure.kubernetes.Annotations.Serializer) ServiceBuilder(io.fabric8.kubernetes.api.model.ServiceBuilder)

Example 3 with Serializer

use of org.eclipse.che.workspace.infrastructure.kubernetes.Annotations.Serializer in project devspaces-images by redhat-developer.

the class RouteServerResolverTest method createService.

private Service createService(String name, String machineName, Integer port, Map<String, ServerConfigImpl> servers) {
    Serializer serializer = Annotations.newSerializer();
    serializer.machineName(machineName);
    if (servers != null) {
        serializer.servers(servers);
    }
    return new ServiceBuilder().withNewMetadata().withName(name).withAnnotations(serializer.annotations()).endMetadata().withNewSpec().withPorts(new ServicePortBuilder().withPort(port).withNewTargetPort().withIntVal(port).endTargetPort().build()).endSpec().build();
}
Also used : ServicePortBuilder(io.fabric8.kubernetes.api.model.ServicePortBuilder) Serializer(org.eclipse.che.workspace.infrastructure.kubernetes.Annotations.Serializer) ServiceBuilder(io.fabric8.kubernetes.api.model.ServiceBuilder)

Example 4 with Serializer

use of org.eclipse.che.workspace.infrastructure.kubernetes.Annotations.Serializer in project che-server by eclipse-che.

the class IngressServerResolverTest method createIngress.

private Ingress createIngress(String name, String machineName, Pair<String, ServerConfig> server) {
    Serializer serializer = Annotations.newSerializer();
    serializer.machineName(machineName);
    serializer.server(server.first, server.second);
    return new IngressBuilder().withNewMetadata().withName(name).withAnnotations(serializer.annotations()).endMetadata().withNewSpec().withRules(new IngressRule(null, new HTTPIngressRuleValue(singletonList(new HTTPIngressPath(new IngressBackend(null, new IngressServiceBackend(name, new ServiceBackendPort("8080", 8080))), INGRESS_PATH_PREFIX, null))))).endSpec().withNewStatus().withLoadBalancer(new LoadBalancerStatusBuilder().addNewIngress().withIp("127.0.0.1").endIngress().build()).endStatus().build();
}
Also used : IngressBuilder(io.fabric8.kubernetes.api.model.networking.v1.IngressBuilder) ServiceBackendPort(io.fabric8.kubernetes.api.model.networking.v1.ServiceBackendPort) IngressRule(io.fabric8.kubernetes.api.model.networking.v1.IngressRule) HTTPIngressRuleValue(io.fabric8.kubernetes.api.model.networking.v1.HTTPIngressRuleValue) HTTPIngressPath(io.fabric8.kubernetes.api.model.networking.v1.HTTPIngressPath) IngressBackend(io.fabric8.kubernetes.api.model.networking.v1.IngressBackend) LoadBalancerStatusBuilder(io.fabric8.kubernetes.api.model.LoadBalancerStatusBuilder) Serializer(org.eclipse.che.workspace.infrastructure.kubernetes.Annotations.Serializer) IngressServiceBackend(io.fabric8.kubernetes.api.model.networking.v1.IngressServiceBackend)

Example 5 with Serializer

use of org.eclipse.che.workspace.infrastructure.kubernetes.Annotations.Serializer in project che-server by eclipse-che.

the class RouteServerResolverTest method createRoute.

private Route createRoute(String name, String machineName, Map<String, ServerConfigImpl> servers) {
    Serializer serializer = Annotations.newSerializer();
    serializer.machineName(machineName);
    if (servers != null) {
        serializer.servers(servers);
    }
    return new RouteBuilder().withNewMetadata().withName(name).withAnnotations(serializer.annotations()).endMetadata().withNewSpec().withHost(ROUTE_HOST).withNewTo().withName(name).endTo().endSpec().build();
}
Also used : RouteBuilder(io.fabric8.openshift.api.model.RouteBuilder) Serializer(org.eclipse.che.workspace.infrastructure.kubernetes.Annotations.Serializer)

Aggregations

Serializer (org.eclipse.che.workspace.infrastructure.kubernetes.Annotations.Serializer)8 ServiceBuilder (io.fabric8.kubernetes.api.model.ServiceBuilder)4 ServicePortBuilder (io.fabric8.kubernetes.api.model.ServicePortBuilder)4 LoadBalancerStatusBuilder (io.fabric8.kubernetes.api.model.LoadBalancerStatusBuilder)2 HTTPIngressPath (io.fabric8.kubernetes.api.model.networking.v1.HTTPIngressPath)2 HTTPIngressRuleValue (io.fabric8.kubernetes.api.model.networking.v1.HTTPIngressRuleValue)2 IngressBackend (io.fabric8.kubernetes.api.model.networking.v1.IngressBackend)2 IngressBuilder (io.fabric8.kubernetes.api.model.networking.v1.IngressBuilder)2 IngressRule (io.fabric8.kubernetes.api.model.networking.v1.IngressRule)2 IngressServiceBackend (io.fabric8.kubernetes.api.model.networking.v1.IngressServiceBackend)2 ServiceBackendPort (io.fabric8.kubernetes.api.model.networking.v1.ServiceBackendPort)2 RouteBuilder (io.fabric8.openshift.api.model.RouteBuilder)2