Search in sources :

Example 6 with SaltPillarProperties

use of com.sequenceiq.cloudbreak.orchestrator.model.SaltPillarProperties in project cloudbreak by hortonworks.

the class ClusterHostServiceRunner method saveDatalakeNameservers.

/**
 * In order to be able to connect an ephemeral cluster to a datalake, the ephemeral cluster needs to know some of the datalake nameservers to resolve
 * the custom hostnames.
 */
private void saveDatalakeNameservers(Stack stack, Map<String, SaltPillarProperties> servicePillar) {
    Long datalakeId = stack.getDatalakeId();
    if (datalakeId != null) {
        Stack dataLakeStack = stackRepository.findOneWithLists(datalakeId);
        String datalakeDomain = dataLakeStack.getGatewayInstanceMetadata().get(0).getDomain();
        List<String> ipList = dataLakeStack.getGatewayInstanceMetadata().stream().map(InstanceMetaData::getPrivateIp).collect(Collectors.toList());
        servicePillar.put("forwarder-zones", new SaltPillarProperties("/unbound/forwarders.sls", singletonMap("forwarder-zones", singletonMap(datalakeDomain, singletonMap("nameservers", ipList)))));
    }
}
Also used : SaltPillarProperties(com.sequenceiq.cloudbreak.orchestrator.model.SaltPillarProperties) Stack(com.sequenceiq.cloudbreak.domain.Stack)

Example 7 with SaltPillarProperties

use of com.sequenceiq.cloudbreak.orchestrator.model.SaltPillarProperties in project cloudbreak by hortonworks.

the class ClusterHostServiceRunner method decoratePillarWithAmbariDatabase.

private void decoratePillarWithAmbariDatabase(Cluster cluster, Map<String, SaltPillarProperties> servicePillar) throws CloudbreakOrchestratorFailedException {
    RDSConfig ambariRdsConfig = rdsConfigService.findByClusterIdAndType(cluster.getOwner(), cluster.getAccount(), cluster.getId(), RdsType.AMBARI);
    if (ambariRdsConfig == null) {
        throw new CloudbreakOrchestratorFailedException("Ambari RDSConfig is missing for stack");
    }
    RdsView ambariRdsView = new RdsView(ambariRdsConfig);
    servicePillar.put("ambari-database", new SaltPillarProperties("/ambari/database.sls", singletonMap("ambari", singletonMap("database", ambariRdsView))));
}
Also used : CloudbreakOrchestratorFailedException(com.sequenceiq.cloudbreak.orchestrator.exception.CloudbreakOrchestratorFailedException) RDSConfig(com.sequenceiq.cloudbreak.domain.RDSConfig) RdsView(com.sequenceiq.cloudbreak.blueprint.template.views.RdsView) SaltPillarProperties(com.sequenceiq.cloudbreak.orchestrator.model.SaltPillarProperties)

Example 8 with SaltPillarProperties

use of com.sequenceiq.cloudbreak.orchestrator.model.SaltPillarProperties in project cloudbreak by hortonworks.

the class ClusterHostServiceRunner method saveDockerPillar.

private void saveDockerPillar(ExecutorType executorType, Map<String, SaltPillarProperties> servicePillar) {
    Map<String, Object> dockerMap = new HashMap<>();
    dockerMap.put("enableContainerExecutor", ExecutorType.CONTAINER.equals(executorType));
    servicePillar.put("docker", new SaltPillarProperties("/docker/init.sls", singletonMap("docker", dockerMap)));
}
Also used : HashMap(java.util.HashMap) SaltPillarProperties(com.sequenceiq.cloudbreak.orchestrator.model.SaltPillarProperties)

Example 9 with SaltPillarProperties

use of com.sequenceiq.cloudbreak.orchestrator.model.SaltPillarProperties 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)

Example 10 with SaltPillarProperties

use of com.sequenceiq.cloudbreak.orchestrator.model.SaltPillarProperties in project cloudbreak by hortonworks.

the class ProxyConfigProvider method decoratePillarWithProxyDataIfNeeded.

@Transactional
public void decoratePillarWithProxyDataIfNeeded(Map<String, SaltPillarProperties> servicePillar, Cluster cluster) {
    ProxyConfig proxyConfig = cluster.getProxyConfig();
    if (proxyConfig != null) {
        Map<String, Object> proxy = new HashMap<>();
        proxy.put("host", proxyConfig.getServerHost());
        proxy.put("port", proxyConfig.getServerPort());
        proxy.put("protocol", proxyConfig.getProtocol());
        if (StringUtils.isNotBlank(proxyConfig.getUserName()) && StringUtils.isNotBlank(proxyConfig.getPassword())) {
            proxy.put("user", proxyConfig.getUserName());
            proxy.put("password", proxyConfig.getPassword());
        }
        servicePillar.put(PROXY_KEY, new SaltPillarProperties(PROXY_SLS_PATH, singletonMap(PROXY_KEY, proxy)));
    }
}
Also used : HashMap(java.util.HashMap) ProxyConfig(com.sequenceiq.cloudbreak.domain.ProxyConfig) SaltPillarProperties(com.sequenceiq.cloudbreak.orchestrator.model.SaltPillarProperties) Transactional(javax.transaction.Transactional)

Aggregations

SaltPillarProperties (com.sequenceiq.cloudbreak.orchestrator.model.SaltPillarProperties)12 HashMap (java.util.HashMap)7 CloudbreakOrchestratorFailedException (com.sequenceiq.cloudbreak.orchestrator.exception.CloudbreakOrchestratorFailedException)5 SaltConfig (com.sequenceiq.cloudbreak.orchestrator.model.SaltConfig)4 AmbariRepo (com.sequenceiq.cloudbreak.cloud.model.AmbariRepo)3 Stack (com.sequenceiq.cloudbreak.domain.Stack)3 CloudbreakOrchestratorException (com.sequenceiq.cloudbreak.orchestrator.exception.CloudbreakOrchestratorException)3 HostOrchestrator (com.sequenceiq.cloudbreak.orchestrator.host.HostOrchestrator)3 GatewayConfig (com.sequenceiq.cloudbreak.orchestrator.model.GatewayConfig)3 Node (com.sequenceiq.cloudbreak.orchestrator.model.Node)3 RdsView (com.sequenceiq.cloudbreak.blueprint.template.views.RdsView)2 StackRepoDetails (com.sequenceiq.cloudbreak.cloud.model.component.StackRepoDetails)2 Cluster (com.sequenceiq.cloudbreak.domain.Cluster)2 ExposedServices (com.sequenceiq.cloudbreak.domain.ExposedServices)2 InstanceMetaData (com.sequenceiq.cloudbreak.domain.InstanceMetaData)2 KerberosConfig (com.sequenceiq.cloudbreak.domain.KerberosConfig)2 RDSConfig (com.sequenceiq.cloudbreak.domain.RDSConfig)2 Json (com.sequenceiq.cloudbreak.domain.json.Json)2 OrchestratorBootstrap (com.sequenceiq.cloudbreak.orchestrator.OrchestratorBootstrap)2 SaltConnector (com.sequenceiq.cloudbreak.orchestrator.salt.client.SaltConnector)2