use of io.fabric8.kubernetes.api.model.networking.v1.ServiceBackendPort in project devspaces-images by redhat-developer.
the class IngressesTest method findHostWhenPortDefinedByString.
@Test
public void findHostWhenPortDefinedByString() {
final String SERVER_PORT_NAME = "server-8080";
final int PORT = 8080;
Service service = createService(SERVER_PORT_NAME, PORT);
Ingress ingress = createIngress(new IngressBackend(null, new IngressServiceBackend("servicename", new ServiceBackendPort(SERVER_PORT_NAME, PORT))));
Optional<IngressRule> foundRule = Ingresses.findIngressRuleForServicePort(singletonList(ingress), service, PORT);
assertTrue(foundRule.isPresent());
assertEquals(foundRule.get().getHost(), "ingresshost");
}
use of io.fabric8.kubernetes.api.model.networking.v1.ServiceBackendPort in project cmcc-operator by T-Systems-MMS.
the class NginxIngressBuilder method build.
@Override
public Collection<? extends HasMetadata> build() {
ObjectMeta metadata = targetState.getResourceMetadataFor(name);
metadata.getAnnotations().putAll(annotations);
List<HTTPIngressPath> httpPaths = paths.stream().map(path -> withPath(new HTTPIngressPathBuilder(), path).withBackend(new IngressBackendBuilder().withService(new IngressServiceBackendBuilder().withName(path.getService()).withPort(new ServiceBackendPort("http", null)).build()).build()).build()).collect(Collectors.toList());
return Collections.singletonList(new io.fabric8.kubernetes.api.model.networking.v1.IngressBuilder().withMetadata(metadata).withSpec(new IngressSpecBuilder().withIngressClassName("nginx").withTls(new IngressTLSBuilder().withHosts(hostname).build()).withRules(new IngressRuleBuilder().withHost(hostname).withHttp(new HTTPIngressRuleValueBuilder().withPaths(httpPaths).build()).build()).build()).build());
}
Aggregations