use of com.sequenceiq.cloudbreak.domain.KerberosConfig in project cloudbreak by hortonworks.
the class KerbersoRequestToKerberosConfigConverter method convert.
@Override
public KerberosConfig convert(KerberosRequest source) {
KerberosConfig kerberosConfig = new KerberosConfig();
kerberosConfig.setType(KerberosType.valueOf(source));
kerberosConfig.setMasterKey(source.getMasterKey());
kerberosConfig.setAdmin(source.getAdmin());
kerberosConfig.setPassword(source.getPassword());
kerberosConfig.setUrl(source.getUrl());
kerberosConfig.setAdminUrl(Optional.ofNullable(source.getAdminUrl()).orElse(source.getUrl()));
kerberosConfig.setRealm(source.getRealm());
kerberosConfig.setTcpAllowed(source.getTcpAllowed());
kerberosConfig.setPrincipal(source.getPrincipal());
kerberosConfig.setLdapUrl(source.getLdapUrl());
kerberosConfig.setContainerDn(source.getContainerDn());
kerberosConfig.setDescriptor(source.getDescriptor());
kerberosConfig.setKrb5Conf(source.getKrb5Conf());
return kerberosConfig;
}
use of com.sequenceiq.cloudbreak.domain.KerberosConfig in project cloudbreak by hortonworks.
the class ClusterRequestToClusterConverterTest method testConvertWithFileSystemDetails.
@Test
public void testConvertWithFileSystemDetails() {
// GIVEN
given(conversionService.convert(any(KerberosRequest.class), eq(KerberosConfig.class))).willReturn(new KerberosConfig());
given(conversionService.convert(any(FileSystemRequest.class), eq(FileSystem.class))).willReturn(new FileSystem());
// WHEN
Cluster result = underTest.convert(getRequest("stack/cluster-with-file-system.json"));
// THEN
assertAllFieldsNotNull(result, Arrays.asList("stack", "blueprint", "creationStarted", "creationFinished", "upSince", "statusReason", "ambariIp", "ambariStackDetails", "certDir", "rdsConfigs", "ldapConfig", "attributes", "blueprintCustomProperties", "uptime", "ambariSecurityMasterKey", "proxyConfig", "extendedBlueprintText"));
}
use of com.sequenceiq.cloudbreak.domain.KerberosConfig in project cloudbreak by hortonworks.
the class ClusterToClusterDetailsConverter method convertKerberosConfig.
private void convertKerberosConfig(ClusterDetails clusterDetails, Cluster source) {
Boolean secure = source.isSecure();
clusterDetails.setSecure(secure);
if (secure) {
clusterDetails.setSecure(Boolean.TRUE);
KerberosConfig kerberosConfig = source.getKerberosConfig();
String kerberosType = "New MIT Kerberos";
if (kerberosConfig != null) {
if (StringUtils.isNoneEmpty(kerberosConfig.getUrl())) {
kerberosType = StringUtils.isNoneEmpty(kerberosConfig.getLdapUrl()) ? "Existing Active Directory" : "Existing MIT Kerberos";
}
}
clusterDetails.setKerberosType(kerberosType);
}
}
use of com.sequenceiq.cloudbreak.domain.KerberosConfig in project cloudbreak by hortonworks.
the class StackRequestToBlueprintPreparationObjectConverter method convert.
@Override
public BlueprintPreparationObject convert(StackV2Request source) {
try {
IdentityUser identityUser = userDetailsService.getDetails(source.getOwner(), UserFilterField.USERID);
FlexSubscription flexSubscription = getFlexSubscription(source);
String smartsenseSubscriptionId = getSmartsenseSubscriptionId(source, flexSubscription);
KerberosConfig kerberosConfig = getKerberosConfig(source);
LdapConfig ldapConfig = getLdapConfig(source, identityUser);
FileSystemConfigurationView fileSystemConfigurationView = getFileSystemConfigurationView(source);
Set<RDSConfig> rdsConfigs = getRdsConfigs(source, identityUser);
Blueprint blueprint = getBlueprint(source, identityUser);
BlueprintStackInfo blueprintStackInfo = stackInfoService.blueprintStackInfo(blueprint.getBlueprintText());
Set<HostgroupView> hostgroupViews = getHostgroupViews(source);
BlueprintView blueprintView = new BlueprintView(blueprint.getBlueprintText(), blueprintStackInfo.getVersion(), blueprintStackInfo.getType());
GeneralClusterConfigs generalClusterConfigs = generalClusterConfigsProvider.generalClusterConfigs(source, identityUser);
return BlueprintPreparationObject.Builder.builder().withFlexSubscription(flexSubscription).withRdsConfigs(rdsConfigs).withHostgroupViews(hostgroupViews).withBlueprintView(blueprintView).withStackRepoDetailsHdpVersion(blueprintStackInfo.getVersion()).withFileSystemConfigurationView(fileSystemConfigurationView).withGeneralClusterConfigs(generalClusterConfigs).withSmartSenseSubscriptionId(smartsenseSubscriptionId).withLdapConfig(ldapConfig).withKerberosConfig(kerberosConfig).build();
} catch (BlueprintProcessingException e) {
throw new CloudbreakServiceException(e.getMessage(), e);
} catch (IOException e) {
throw new CloudbreakServiceException(e.getMessage(), e);
}
}
use of com.sequenceiq.cloudbreak.domain.KerberosConfig in project cloudbreak by hortonworks.
the class AmbariClusterTemplateService method addClusterTemplate.
public void addClusterTemplate(Cluster cluster, Map<String, List<Map<String, String>>> hostGroupMappings, ClusterService ambariClient) {
String clusterName = cluster.getName();
String blueprintName = cluster.getBlueprint().getAmbariName();
String configStrategy = cluster.getConfigStrategy().name();
String clusterTemplate;
if (ambariClient.getClusterName() == null) {
try {
String repositoryVersion = ambariRepositoryVersionService.getRepositoryVersion(cluster.getId(), cluster.getStack().getOrchestrator());
if (cluster.isSecure()) {
KerberosConfig kerberosConfig = cluster.getKerberosConfig();
String principal = kerberosDetailService.resolvePrincipalForKerberos(kerberosConfig);
clusterTemplate = ambariClient.createSecureCluster(clusterName, blueprintName, hostGroupMappings, configStrategy, ambariSecurityConfigProvider.getAmbariPassword(cluster), principal, kerberosConfig.getPassword(), KEY_TYPE, false, repositoryVersion);
} else {
clusterTemplate = ambariClient.createCluster(clusterName, blueprintName, hostGroupMappings, configStrategy, ambariSecurityConfigProvider.getAmbariPassword(cluster), false, repositoryVersion);
}
LOGGER.info("Submitted cluster creation template: {}", JsonUtil.minify(clusterTemplate, Collections.singleton("credentials")));
} catch (Exception exception) {
String msg = "Ambari client failed to apply cluster creation template.";
LOGGER.error(msg, exception);
throw new AmbariServiceException(msg, exception);
}
} else {
LOGGER.info("Ambari cluster already exists: {}", clusterName);
}
}
Aggregations