Search in sources :

Example 1 with ServiceListBuilder

use of io.fabric8.kubernetes.api.model.ServiceListBuilder in project carbon-apimgt by wso2.

the class ServiceDiscovererKubernetesTestCase method createMalformedServiceList.

/**
 * Create ServiceList with the given port type, but without a loadBalancer ingress
 *
 * @param portType http or https or a wrong port to check behavior
 * @return ServiceList containing one service of LoadBalancer type
 */
private ServiceList createMalformedServiceList(String portType) {
    ServicePort port = new ServicePortBuilder().withName(portType).withPort(80).withNodePort(30005).build();
    Service malformedService5 = new ServiceBuilder().withNewMetadata().withName("service5").withNamespace("prod").and().withNewSpec().withType("LoadBalancer").withClusterIP("1.1.1.5").withPorts(port).and().withNewStatus().withNewLoadBalancer().endLoadBalancer().and().build();
    List<Service> servicesList = new ArrayList<>();
    servicesList.add(malformedService5);
    return new ServiceListBuilder().withItems(servicesList).build();
}
Also used : ServicePort(io.fabric8.kubernetes.api.model.ServicePort) ServiceListBuilder(io.fabric8.kubernetes.api.model.ServiceListBuilder) ServicePortBuilder(io.fabric8.kubernetes.api.model.ServicePortBuilder) ArrayList(java.util.ArrayList) Service(io.fabric8.kubernetes.api.model.Service) ServiceBuilder(io.fabric8.kubernetes.api.model.ServiceBuilder)

Aggregations

Service (io.fabric8.kubernetes.api.model.Service)1 ServiceBuilder (io.fabric8.kubernetes.api.model.ServiceBuilder)1 ServiceListBuilder (io.fabric8.kubernetes.api.model.ServiceListBuilder)1 ServicePort (io.fabric8.kubernetes.api.model.ServicePort)1 ServicePortBuilder (io.fabric8.kubernetes.api.model.ServicePortBuilder)1 ArrayList (java.util.ArrayList)1