use of com.sequenceiq.cloudbreak.orchestrator.model.SaltPillarProperties in project cloudbreak by hortonworks.
the class AmbariClusterUpgradeService method upgradeCluster.
public void upgradeCluster(Long stackId) throws CloudbreakOrchestratorException {
Stack stack = stackRepository.findOneWithLists(stackId);
Cluster cluster = stack.getCluster();
try {
OrchestratorType orchestratorType = orchestratorTypeResolver.resolveType(stack.getOrchestrator().getType());
if (orchestratorType.hostOrchestrator()) {
HostOrchestrator hostOrchestrator = hostOrchestratorResolver.get(stack.getOrchestrator().getType());
InstanceMetaData gatewayInstance = stack.getPrimaryGatewayInstance();
GatewayConfig gatewayConfig = gatewayConfigService.getGatewayConfig(stack, gatewayInstance, cluster.getGateway().getEnableGateway());
Set<String> gatewayFQDN = Collections.singleton(gatewayInstance.getDiscoveryFQDN());
ExitCriteriaModel exitCriteriaModel = clusterDeletionBasedModel(stack.getId(), cluster.getId());
AmbariRepo ambariRepo = componentConfigProvider.getAmbariRepo(cluster.getId());
Map<String, SaltPillarProperties> servicePillar = new HashMap<>();
Map<String, Object> credentials = new HashMap<>();
credentials.put("username", ambariSecurityConfigProvider.getAmbariUserName(cluster));
credentials.put("password", ambariSecurityConfigProvider.getAmbariPassword(cluster));
servicePillar.put("ambari-credentials", new SaltPillarProperties("/ambari/credentials.sls", singletonMap("ambari", credentials)));
if (ambariRepo != null) {
servicePillar.put("ambari-repo", new SaltPillarProperties("/ambari/repo.sls", singletonMap("ambari", singletonMap("repo", ambariRepo))));
}
SaltConfig pillar = new SaltConfig(servicePillar);
hostOrchestrator.upgradeAmbari(gatewayConfig, gatewayFQDN, stackUtil.collectNodes(stack), pillar, exitCriteriaModel);
} else {
throw new UnsupportedOperationException("Ambari upgrade works only with host orchestrator");
}
} catch (CloudbreakException e) {
throw new CloudbreakOrchestratorFailedException(e);
}
}
use of com.sequenceiq.cloudbreak.orchestrator.model.SaltPillarProperties in project cloudbreak by hortonworks.
the class ClusterHostServiceRunner method saveSharedRangerService.
private void saveSharedRangerService(Stack stack, Map<String, SaltPillarProperties> servicePillar) {
Long datalakeId = stack.getDatalakeId();
if (datalakeId != null) {
Stack dataLakeStack = stackRepository.findOne(datalakeId);
Cluster dataLakeCluster = dataLakeStack.getCluster();
Set<String> groupNames = blueprintProcessorFactory.get(dataLakeCluster.getBlueprint().getBlueprintText()).getHostGroupsWithComponent("RANGER_ADMIN");
List<HostGroup> groups = dataLakeCluster.getHostGroups().stream().filter(hg -> groupNames.contains(hg.getName())).collect(Collectors.toList());
Set<String> hostNames = new HashSet<>();
groups.forEach(hg -> hostNames.addAll(hg.getHostMetadata().stream().map(HostMetadata::getHostName).collect(Collectors.toList())));
Map<String, Object> rangerMap = new HashMap<>();
rangerMap.put("servers", hostNames);
rangerMap.put("port", "6080");
servicePillar.put("datalake-services", new SaltPillarProperties("/datalake/init.sls", singletonMap("datalake-services", singletonMap("ranger", rangerMap))));
}
}
use of com.sequenceiq.cloudbreak.orchestrator.model.SaltPillarProperties in project cloudbreak by hortonworks.
the class ProxyConfigProviderTest method testProxyCore.
private Map<String, Object> testProxyCore(ProxyConfig proxyConfig) {
proxyConfig.setServerHost("test");
proxyConfig.setServerPort(3128);
proxyConfig.setProtocol("http");
cluster.setProxyConfig(proxyConfig);
proxyConfigProvider.decoratePillarWithProxyDataIfNeeded(servicePillar, cluster);
SaltPillarProperties pillarProperties = servicePillar.get(ProxyConfigProvider.PROXY_KEY);
assertNotNull(pillarProperties);
assertEquals(ProxyConfigProvider.PROXY_SLS_PATH, pillarProperties.getPath());
return (Map<String, Object>) pillarProperties.getProperties().get(ProxyConfigProvider.PROXY_KEY);
}
use of com.sequenceiq.cloudbreak.orchestrator.model.SaltPillarProperties in project cloudbreak by hortonworks.
the class ClusterHostServiceRunner method createSaltConfig.
private SaltConfig createSaltConfig(Stack stack, Cluster cluster, GatewayConfig primaryGatewayConfig, Iterable<GatewayConfig> gatewayConfigs) throws IOException, CloudbreakOrchestratorException {
Map<String, SaltPillarProperties> servicePillar = new HashMap<>();
saveDatalakeNameservers(stack, servicePillar);
saveSharedRangerService(stack, servicePillar);
if (cluster.isSecure() && kerberosDetailService.isAmbariManagedKerberosPackages(cluster.getKerberosConfig())) {
Map<String, String> kerberosPillarConf = new HashMap<>();
KerberosConfig kerberosConfig = cluster.getKerberosConfig();
putIfNotNull(kerberosPillarConf, kerberosConfig.getMasterKey(), "masterKey");
putIfNotNull(kerberosPillarConf, kerberosConfig.getAdmin(), "user");
putIfNotNull(kerberosPillarConf, kerberosConfig.getPassword(), "password");
if (StringUtils.isEmpty(kerberosConfig.getDescriptor())) {
putIfNotNull(kerberosPillarConf, kerberosConfig.getUrl(), "url");
putIfNotNull(kerberosPillarConf, kerberosConfig.getAdminUrl(), "adminUrl");
putIfNotNull(kerberosPillarConf, kerberosConfig.getRealm(), "realm");
} else {
Map<String, Object> properties = kerberosDetailService.getKerberosEnvProperties(kerberosConfig);
putIfNotNull(kerberosPillarConf, properties.get("kdc_hosts"), "url");
putIfNotNull(kerberosPillarConf, properties.get("admin_server_host"), "adminUrl");
putIfNotNull(kerberosPillarConf, properties.get("realm"), "realm");
}
putIfNotNull(kerberosPillarConf, cluster.getUserName(), "clusterUser");
putIfNotNull(kerberosPillarConf, cluster.getPassword(), "clusterPassword");
servicePillar.put("kerberos", new SaltPillarProperties("/kerberos/init.sls", singletonMap("kerberos", kerberosPillarConf)));
}
servicePillar.put("discovery", new SaltPillarProperties("/discovery/init.sls", singletonMap("platform", stack.cloudPlatform())));
servicePillar.put("metadata", new SaltPillarProperties("/metadata/init.sls", singletonMap("cluster", singletonMap("name", stack.getCluster().getName()))));
saveGatewayPillar(primaryGatewayConfig, cluster, servicePillar);
AmbariRepo ambariRepo = clusterComponentConfigProvider.getAmbariRepo(cluster.getId());
if (ambariRepo != null) {
servicePillar.put("ambari-repo", new SaltPillarProperties("/ambari/repo.sls", singletonMap("ambari", singletonMap("repo", ambariRepo))));
}
servicePillar.put("ambari-gpl-repo", new SaltPillarProperties("/ambari/gpl.sls", singletonMap("ambari", singletonMap("gpl", singletonMap("enabled", clusterComponentConfigProvider.getHDPRepo(cluster.getId()).isEnableGplRepo())))));
decoratePillarWithAmbariDatabase(cluster, servicePillar);
saveLdapPillar(cluster.getLdapConfig(), servicePillar);
saveDockerPillar(cluster.getExecutorType(), servicePillar);
saveHDPPillar(cluster.getId(), servicePillar);
Map<String, Object> credentials = new HashMap<>();
credentials.put("username", ambariSecurityConfigProvider.getAmbariUserName(stack.getCluster()));
credentials.put("password", ambariSecurityConfigProvider.getAmbariPassword(stack.getCluster()));
credentials.put("securityMasterKey", ambariSecurityConfigProvider.getAmbariSecurityMasterKey(cluster));
servicePillar.put("ambari-credentials", new SaltPillarProperties("/ambari/credentials.sls", singletonMap("ambari", credentials)));
if (smartSenseCredentialConfigService.areCredentialsSpecified()) {
Map<String, Object> smartSenseCredentials = smartSenseCredentialConfigService.getCredentials();
servicePillar.put("smartsense-credentials", new SaltPillarProperties("/smartsense/credentials.sls", smartSenseCredentials));
}
postgresConfigService.decorateServicePillarWithPostgresIfNeeded(servicePillar, stack, cluster);
proxyConfigProvider.decoratePillarWithProxyDataIfNeeded(servicePillar, cluster);
return new SaltConfig(servicePillar, createGrainProperties(gatewayConfigs));
}
use of com.sequenceiq.cloudbreak.orchestrator.model.SaltPillarProperties in project cloudbreak by hortonworks.
the class ClusterHostServiceRunner method saveHDPPillar.
private void saveHDPPillar(Long clusterId, Map<String, SaltPillarProperties> servicePillar) {
StackRepoDetails hdprepo = clusterComponentConfigProvider.getHDPRepo(clusterId);
servicePillar.put("hdp", new SaltPillarProperties("/hdp/repo.sls", singletonMap("hdp", hdprepo)));
}
Aggregations