Search in sources :

Example 6 with KerberosConfig

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;
}
Also used : KerberosConfig(com.sequenceiq.cloudbreak.domain.KerberosConfig)

Example 7 with 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"));
}
Also used : FileSystemRequest(com.sequenceiq.cloudbreak.api.model.FileSystemRequest) KerberosConfig(com.sequenceiq.cloudbreak.domain.KerberosConfig) FileSystem(com.sequenceiq.cloudbreak.domain.FileSystem) KerberosRequest(com.sequenceiq.cloudbreak.api.model.KerberosRequest) Cluster(com.sequenceiq.cloudbreak.domain.Cluster) Test(org.junit.Test)

Example 8 with KerberosConfig

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);
    }
}
Also used : KerberosConfig(com.sequenceiq.cloudbreak.domain.KerberosConfig)

Example 9 with KerberosConfig

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);
    }
}
Also used : BlueprintProcessingException(com.sequenceiq.cloudbreak.blueprint.BlueprintProcessingException) GeneralClusterConfigs(com.sequenceiq.cloudbreak.blueprint.templates.GeneralClusterConfigs) RDSConfig(com.sequenceiq.cloudbreak.domain.RDSConfig) Blueprint(com.sequenceiq.cloudbreak.domain.Blueprint) BlueprintView(com.sequenceiq.cloudbreak.blueprint.template.views.BlueprintView) CloudbreakServiceException(com.sequenceiq.cloudbreak.service.CloudbreakServiceException) KerberosConfig(com.sequenceiq.cloudbreak.domain.KerberosConfig) IOException(java.io.IOException) IdentityUser(com.sequenceiq.cloudbreak.common.model.user.IdentityUser) LdapConfig(com.sequenceiq.cloudbreak.domain.LdapConfig) BlueprintStackInfo(com.sequenceiq.cloudbreak.blueprint.templates.BlueprintStackInfo) FlexSubscription(com.sequenceiq.cloudbreak.domain.FlexSubscription) FileSystemConfigurationView(com.sequenceiq.cloudbreak.blueprint.template.views.FileSystemConfigurationView) HostgroupView(com.sequenceiq.cloudbreak.blueprint.template.views.HostgroupView)

Example 10 with KerberosConfig

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);
    }
}
Also used : KerberosConfig(com.sequenceiq.cloudbreak.domain.KerberosConfig)

Aggregations

KerberosConfig (com.sequenceiq.cloudbreak.domain.KerberosConfig)21 Test (org.junit.Test)10 KerberosRequest (com.sequenceiq.cloudbreak.api.model.KerberosRequest)5 Blueprint (com.sequenceiq.cloudbreak.domain.Blueprint)5 Cluster (com.sequenceiq.cloudbreak.domain.Cluster)5 AbstractConverterTest (com.sequenceiq.cloudbreak.converter.AbstractConverterTest)4 Stack (com.sequenceiq.cloudbreak.domain.Stack)3 JsonNode (com.fasterxml.jackson.databind.JsonNode)2 BlueprintPreparationObject (com.sequenceiq.cloudbreak.blueprint.BlueprintPreparationObject)2 BlueprintTextProcessor (com.sequenceiq.cloudbreak.blueprint.BlueprintTextProcessor)2 GeneralClusterConfigs (com.sequenceiq.cloudbreak.blueprint.templates.GeneralClusterConfigs)2 FileSystem (com.sequenceiq.cloudbreak.domain.FileSystem)2 RDSConfig (com.sequenceiq.cloudbreak.domain.RDSConfig)2 CloudbreakServiceException (com.sequenceiq.cloudbreak.service.CloudbreakServiceException)2 JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)1 BlueprintInputJson (com.sequenceiq.cloudbreak.api.model.BlueprintInputJson)1 BlueprintResponse (com.sequenceiq.cloudbreak.api.model.BlueprintResponse)1 FileSystemBase (com.sequenceiq.cloudbreak.api.model.FileSystemBase)1 FileSystemRequest (com.sequenceiq.cloudbreak.api.model.FileSystemRequest)1 GatewayJson (com.sequenceiq.cloudbreak.api.model.GatewayJson)1