use of org.eclipse.che.workspace.infrastructure.kubernetes.server.RuntimeServerBuilder in project devspaces-images by redhat-developer.
the class IngressServerResolver method fillIngressServers.
private Map<String, ServerImpl> fillIngressServers(Ingress ingress) {
IngressRule ingressRule = ingress.getSpec().getRules().get(0);
// host either set by rule, or determined by LB ip
final String host = ingressRule.getHost() != null ? ingressRule.getHost() : ingress.getStatus().getLoadBalancer().getIngress().get(0).getIp();
return Annotations.newDeserializer(ingress.getMetadata().getAnnotations()).servers().entrySet().stream().collect(Collectors.toMap(Entry::getKey, e -> {
String root = pathTransformInverter.undoPathTransformation(ingressRule.getHttp().getPaths().get(0).getPath());
String path = buildPath(root, e.getValue().getPath());
// the /jwt/auth needs to be based on the webroot of the server, not the path of
// the endpoint.
String endpointOrigin = buildPath(root, "/");
return new RuntimeServerBuilder().protocol(e.getValue().getProtocol()).host(host).path(path).endpointOrigin(endpointOrigin).attributes(e.getValue().getAttributes()).targetPort(e.getValue().getPort()).build();
}));
}
use of org.eclipse.che.workspace.infrastructure.kubernetes.server.RuntimeServerBuilder in project che-server by eclipse-che.
the class IngressServerResolver method fillIngressServers.
private Map<String, ServerImpl> fillIngressServers(Ingress ingress) {
IngressRule ingressRule = ingress.getSpec().getRules().get(0);
// host either set by rule, or determined by LB ip
final String host = ingressRule.getHost() != null ? ingressRule.getHost() : ingress.getStatus().getLoadBalancer().getIngress().get(0).getIp();
return Annotations.newDeserializer(ingress.getMetadata().getAnnotations()).servers().entrySet().stream().collect(Collectors.toMap(Entry::getKey, e -> {
String root = pathTransformInverter.undoPathTransformation(ingressRule.getHttp().getPaths().get(0).getPath());
String path = buildPath(root, e.getValue().getPath());
// the /jwt/auth needs to be based on the webroot of the server, not the path of
// the endpoint.
String endpointOrigin = buildPath(root, "/");
return new RuntimeServerBuilder().protocol(e.getValue().getProtocol()).host(host).path(path).endpointOrigin(endpointOrigin).attributes(e.getValue().getAttributes()).targetPort(e.getValue().getPort()).build();
}));
}
Aggregations