Search in sources :

Example 1 with ExposedServices

use of com.sequenceiq.cloudbreak.domain.ExposedServices in project cloudbreak by hortonworks.

the class ClusterHostServiceRunner method saveGatewayPillar.

private void saveGatewayPillar(GatewayConfig gatewayConfig, Cluster cluster, Map<String, SaltPillarProperties> servicePillar) throws IOException {
    Map<String, Object> gateway = new HashMap<>();
    gateway.put("address", gatewayConfig.getPublicAddress());
    gateway.put("username", cluster.getUserName());
    gateway.put("password", cluster.getPassword());
    gateway.put("path", cluster.getGateway().getPath());
    gateway.put("topology", cluster.getGateway().getTopologyName());
    gateway.put("ssotype", cluster.getGateway().getSsoType());
    gateway.put("ssoprovider", cluster.getGateway().getSsoProvider());
    gateway.put("signpub", cluster.getGateway().getSignPub());
    gateway.put("signcert", cluster.getGateway().getSignCert());
    gateway.put("signkey", cluster.getGateway().getSignKey());
    gateway.put("tokencert", cluster.getGateway().getTokenCert());
    gateway.put("mastersecret", cluster.getStack().getSecurityConfig().getKnoxMasterSecret());
    gateway.put("kerberos", cluster.isSecure());
    Json exposedJson = cluster.getGateway().getExposedServices();
    if (exposedJson != null && StringUtils.isNoneEmpty(exposedJson.getValue())) {
        List<String> exposedServices = exposedJson.get(ExposedServices.class).getServices();
        if (blueprintProcessorFactory.get(cluster.getBlueprint().getBlueprintText()).componentExistsInBlueprint("HIVE_SERVER_INTERACTIVE")) {
            exposedServices = exposedServices.stream().map(x -> "HIVE".equals(x) ? "HIVE_INTERACTIVE" : x).collect(Collectors.toList());
        }
        gateway.put("exposed", exposedServices);
    } else {
        gateway.put("exposed", new ArrayList<>());
    }
    Map<String, List<String>> serviceLocation = componentLocator.getComponentLocation(cluster, new HashSet<>(ExposedService.getAllServiceName()));
    gateway.put("location", serviceLocation);
    servicePillar.put("gateway", new SaltPillarProperties("/gateway/init.sls", singletonMap("gateway", gateway)));
}
Also used : HashMap(java.util.HashMap) ExposedServices(com.sequenceiq.cloudbreak.domain.ExposedServices) List(java.util.List) ArrayList(java.util.ArrayList) Json(com.sequenceiq.cloudbreak.domain.json.Json) SaltPillarProperties(com.sequenceiq.cloudbreak.orchestrator.model.SaltPillarProperties)

Aggregations

ExposedServices (com.sequenceiq.cloudbreak.domain.ExposedServices)1 Json (com.sequenceiq.cloudbreak.domain.json.Json)1 SaltPillarProperties (com.sequenceiq.cloudbreak.orchestrator.model.SaltPillarProperties)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 List (java.util.List)1