use of com.sequenceiq.cloudbreak.domain.stack.cluster.gateway.GatewayTopology in project cloudbreak by hortonworks.
the class OpdbServiceEndpointCollectorTest method createClusterWithComponents.
private Cluster createClusterWithComponents(GatewayType gatewayType) {
Cluster cluster = clusterWithOrchestrator("ANY");
GatewayTopology topology1 = gatewayTopology("proxy");
topology1.setGateway(cluster.getGateway());
cluster.getGateway().setTopologies(Collections.singleton(topology1));
cluster.getGateway().setGatewayType(gatewayType);
Workspace workspace = new Workspace();
Tenant tenant = new Tenant();
tenant.setName("tenant");
workspace.setTenant(tenant);
cluster.setWorkspace(workspace);
return cluster;
}
use of com.sequenceiq.cloudbreak.domain.stack.cluster.gateway.GatewayTopology in project cloudbreak by hortonworks.
the class ServiceEndpointCollectorTest method createClusterWithComponents.
private Cluster createClusterWithComponents(ExposedService[] topology1Services, ExposedService[] topology2Services, GatewayType gatewayType) {
Cluster cluster = clusterkWithOrchestrator("ANY");
GatewayTopology topology1 = gatewayTopology("topology1", topology1Services);
topology1.setGateway(cluster.getGateway());
GatewayTopology topology2 = gatewayTopology("topology2", topology2Services);
topology2.setGateway(cluster.getGateway());
cluster.getGateway().setTopologies(Sets.newHashSet(topology1, topology2));
cluster.getGateway().setGatewayType(gatewayType);
Workspace workspace = new Workspace();
Tenant tenant = new Tenant();
tenant.setName("tenant");
workspace.setTenant(tenant);
cluster.setWorkspace(workspace);
return cluster;
}
use of com.sequenceiq.cloudbreak.domain.stack.cluster.gateway.GatewayTopology in project cloudbreak by hortonworks.
the class ServiceEndpointCollectorTest method gatewayTopology.
private GatewayTopology gatewayTopology(String name, ExposedService... services) {
GatewayTopologyV4Request gatewayTopologyJson = new GatewayTopologyV4Request();
gatewayTopologyJson.setTopologyName(name);
gatewayTopologyJson.setExposedServices(Arrays.stream(services).map(ExposedService::getKnoxService).collect(Collectors.toList()));
ExposedServices exposedServices = exposedServicesConverter.convert(gatewayTopologyJson);
GatewayTopology gatewayTopology = new GatewayTopology();
gatewayTopology.setTopologyName(name);
gatewayTopology.setExposedServices(new Json(exposedServices));
return gatewayTopology;
}
use of com.sequenceiq.cloudbreak.domain.stack.cluster.gateway.GatewayTopology in project cloudbreak by hortonworks.
the class ServiceEndpointCollector method prepareClusterExposedServices.
public Map<String, Collection<ClusterExposedServiceV4Response>> prepareClusterExposedServices(Cluster cluster, String managerIp) {
String blueprintText = getBlueprintString(cluster);
Map<String, Collection<ClusterExposedServiceV4Response>> clusterExposedServiceMap = new HashMap<>();
if (!Strings.isNullOrEmpty(blueprintText)) {
BlueprintTextProcessor processor = cmTemplateProcessorFactory.get(blueprintText);
Collection<ExposedService> knownExposedServices = getExposedServices(blueprintText, entitlementService.getEntitlements(cluster.getWorkspace().getTenant().getName()));
Gateway gateway = cluster.getGateway();
Optional<String> version = Optional.ofNullable(cluster.getBlueprint()).map(Blueprint::getStackVersion);
Map<String, List<String>> privateIps = componentLocatorService.getComponentLocation(cluster.getId(), processor, knownExposedServices.stream().map(ExposedService::getServiceName).collect(Collectors.toSet()));
LOGGER.debug("The private IPs in the cluster {}", privateIps);
if (privateIps.containsKey(exposedServiceCollector.getImpalaService().getServiceName())) {
setImpalaDebugUIToCoordinator(cluster, privateIps);
}
if (gateway != null) {
for (GatewayTopology gatewayTopology : gateway.getTopologies()) {
generateGatewayTopology(cluster, managerIp, clusterExposedServiceMap, knownExposedServices, gateway, privateIps, gatewayTopology, version);
}
}
}
return clusterExposedServiceMap;
}
use of com.sequenceiq.cloudbreak.domain.stack.cluster.gateway.GatewayTopology in project cloudbreak by hortonworks.
the class ServiceEndpointCollector method getManagerServerUrl.
public String getManagerServerUrl(Cluster cluster, String managerIp) {
if (managerIp != null) {
String orchestrator = cluster.getStack().getOrchestrator().getType();
if (YARN.equals(orchestrator)) {
return String.format("http://%s:8080", managerIp);
} else {
Gateway gateway = cluster.getGateway();
if (gateway != null) {
Optional<String> version = Optional.ofNullable(cluster.getBlueprint()).map(Blueprint::getStackVersion);
ExposedService exposedService = exposedServiceCollector.getClouderaManagerUIService();
Optional<GatewayTopology> gatewayTopology = getGatewayTopologyForService(gateway, exposedService, version);
Optional<String> managerUrl = gatewayTopology.map(t -> getExposedServiceUrl(managerIp, gateway, t.getTopologyName(), exposedService, false));
// when knox gateway is enabled, but cm is not exposed, use the default url
return managerUrl.orElse(String.format("https://%s/", managerIp));
}
return String.format("https://%s/clouderamanager/", managerIp);
}
}
return null;
}
Aggregations