use of com.sequenceiq.cloudbreak.cloud.model.AmbariRepo 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.cloud.model.AmbariRepo in project cloudbreak by hortonworks.
the class ClusterToClusterResponseConverter method convertComponentConfig.
private void convertComponentConfig(ClusterResponse response, Cluster source) {
try {
AmbariRepo ambariRepo = componentConfigProvider.getAmbariRepo(source.getComponents());
if (ambariRepo != null) {
AmbariRepoDetailsJson ambariRepoDetailsJson = getConversionService().convert(ambariRepo, AmbariRepoDetailsJson.class);
response.setAmbariRepoDetailsJson(ambariRepoDetailsJson);
}
StackRepoDetails stackRepoDetails = componentConfigProvider.getStackRepo(source.getComponents());
if (stackRepoDetails != null) {
AmbariStackDetailsResponse ambariRepoDetailsJson = getConversionService().convert(stackRepoDetails, AmbariStackDetailsResponse.class);
response.setAmbariStackDetails(ambariRepoDetailsJson);
}
} catch (RuntimeException e) {
LOGGER.error("Failed to convert dynamic component.", e);
}
}
use of com.sequenceiq.cloudbreak.cloud.model.AmbariRepo in project cloudbreak by hortonworks.
the class ImageToAmbariRepoConverter method convert.
@Override
public AmbariRepo convert(Image image) {
AmbariRepo ambariRepo = new AmbariRepo();
ambariRepo.setPredefined(Boolean.TRUE);
ambariRepo.setVersion(image.getVersion());
ambariRepo.setBaseUrl(image.getRepo().get(image.getOsType()));
return ambariRepo;
}
use of com.sequenceiq.cloudbreak.cloud.model.AmbariRepo in project cloudbreak by hortonworks.
the class ImagesToImagesResponseJsonConverter method getBaseImageResponses.
private List<BaseImageResponse> getBaseImageResponses(Images source) {
List<StackDetailsJson> defaultHdpStacks = getDefaultStackInfos(defaultHDPEntries.getEntries().values());
List<StackDetailsJson> defaultHdfStacks = getDefaultStackInfos(defaultHDFEntries.getEntries().values());
List<BaseImageResponse> baseImages = source.getBaseImages().stream().filter(i -> defaultAmbariRepoService.getDefault(i.getOsType()) != null).map(i -> {
BaseImageResponse imgJson = new BaseImageResponse();
copyImageFieldsToJson(i, imgJson);
imgJson.setHdpStacks(defaultHdpStacks);
imgJson.setHdfStacks(defaultHdfStacks);
imgJson.setVersion(defaultAmbariRepoService.getVersion());
AmbariRepo ambariRepo = defaultAmbariRepoService.getDefault(i.getOsType());
Map<String, String> repoJson = new HashMap<>();
repoJson.put("baseurl", ambariRepo.getBaseUrl());
repoJson.put("gpgkey", ambariRepo.getGpgKeyUrl());
imgJson.setRepo(repoJson);
return imgJson;
}).collect(Collectors.toList());
return baseImages;
}
use of com.sequenceiq.cloudbreak.cloud.model.AmbariRepo in project cloudbreak by hortonworks.
the class AmbariRepositoryVersionService method getRepositoryVersion.
public String getRepositoryVersion(long clusterId, Orchestrator orchestrator) throws CloudbreakException {
StackRepoDetails stackRepoDetails = getStackRepoDetails(clusterId, orchestrator);
AmbariRepo ambariRepoDetails = clusterComponentConfigProvider.getAmbariRepo(clusterId);
String result = "";
if (stackRepoDetails != null && isVersionNewerOrEqualThanLimited(ambariRepoDetails::getVersion, AMBARI_VERSION_2_6_0_0)) {
Optional<String> repositoryVersion = Optional.ofNullable(stackRepoDetails.getStack().get(StackRepoDetails.REPOSITORY_VERSION));
result = repositoryVersion.orElse("");
}
return result;
}
Aggregations