Search in sources :

Example 1 with KerberosConfig

use of com.sequenceiq.cloudbreak.domain.KerberosConfig in project cloudbreak by hortonworks.

the class KerberosBlueprintService method customTextManipulation.

@Override
public BlueprintTextProcessor customTextManipulation(BlueprintPreparationObject source, BlueprintTextProcessor blueprintProcessor) {
    KerberosConfig kerberosConfig = source.getKerberosConfig().orElse(null);
    if (source.getGeneralClusterConfigs().getInstanceGroupsPresented()) {
        Integer propagationPort = source.getGeneralClusterConfigs().isGatewayInstanceMetadataPresented() ? KERBEROS_DB_PROPAGATION_PORT : null;
        String gatewayHost = source.getGeneralClusterConfigs().getPrimaryGatewayInstanceDiscoveryFQDN().orElse(null);
        String domain = gatewayHost.substring(gatewayHost.indexOf('.') + 1);
        extendBlueprintWithKerberos(blueprintProcessor, kerberosConfig, gatewayHost, domain, propagationPort);
        if (StringUtils.hasLength(kerberosConfig.getDescriptor())) {
            blueprintProcessor.replaceConfiguration("kerberos-env", kerberosConfig.getDescriptor());
        }
        if (StringUtils.hasLength(kerberosConfig.getKrb5Conf())) {
            blueprintProcessor.replaceConfiguration("krb5-conf", kerberosConfig.getKrb5Conf());
        }
    } else {
        // TODO this won't work on yarn, but it doesn't work anyway
        extendBlueprintWithKerberos(blueprintProcessor, kerberosConfig, source.getGeneralClusterConfigs().getAmbariIp(), REALM, DOMAIN, null);
    }
    return blueprintProcessor;
}
Also used : KerberosConfig(com.sequenceiq.cloudbreak.domain.KerberosConfig)

Example 2 with KerberosConfig

use of com.sequenceiq.cloudbreak.domain.KerberosConfig in project cloudbreak by hortonworks.

the class KerberosBlueprintServiceTest method testExtendBlueprintWithKerberosCustomConfig.

@Test
public void testExtendBlueprintWithKerberosCustomConfig() throws IOException {
    String blueprintText = FileReaderUtils.readFileFromClasspath("blueprints-jackson/bp-not-kerberized.bp");
    Blueprint blueprint = TestUtil.blueprint("name", blueprintText);
    Stack stack = TestUtil.stack();
    KerberosConfig kerberosConfig = new KerberosConfig();
    kerberosConfig.setDescriptor("{\"kerberos-env\":{\"properties\":{\"install_packages\":false,\"realm\":\"REALM.BP\",\"kdc_type\":\"mit-kdc\"," + "\"kdc_hosts\":\"kdc_host.bp\",\"admin_server_host\":\"admin_server_host.bp\",\"encryption_types\":\"enc_types.bp\",\"ldap_url\":\"\"," + "\"container_dn\":\"\"}}}");
    kerberosConfig.setKrb5Conf("{\"krb5-conf\":{\"properties\":{\"domains\":\".domains.bp\",\"manage_krb5_conf\":\"true\",\"content\":\"content.bp\"}}}");
    kerberosConfig.setTcpAllowed(true);
    Cluster cluster = TestUtil.cluster(blueprint, stack, 1L, kerberosConfig);
    BlueprintPreparationObject object = BlueprintPreparationObject.Builder.builder().withKerberosConfig(cluster.getKerberosConfig()).withGeneralClusterConfigs(BlueprintTestUtil.generalClusterConfigs()).build();
    BlueprintTextProcessor b = new BlueprintTextProcessor(blueprint.getBlueprintText());
    String actualBlueprint = underTest.customTextManipulation(object, b).asText();
    String expectedBlueprint = FileReaderUtils.readFileFromClasspath("blueprints-jackson/bp-not-kerberized-custom-config-expected.bp");
    JsonNode expectedNode = JsonUtil.readTree(expectedBlueprint);
    JsonNode resultNode = JsonUtil.readTree(actualBlueprint);
    Assert.assertEquals(expectedNode, resultNode);
}
Also used : Blueprint(com.sequenceiq.cloudbreak.domain.Blueprint) BlueprintTextProcessor(com.sequenceiq.cloudbreak.blueprint.BlueprintTextProcessor) KerberosConfig(com.sequenceiq.cloudbreak.domain.KerberosConfig) Cluster(com.sequenceiq.cloudbreak.domain.Cluster) BlueprintPreparationObject(com.sequenceiq.cloudbreak.blueprint.BlueprintPreparationObject) JsonNode(com.fasterxml.jackson.databind.JsonNode) Stack(com.sequenceiq.cloudbreak.domain.Stack) Test(org.junit.Test)

Example 3 with KerberosConfig

use of com.sequenceiq.cloudbreak.domain.KerberosConfig in project cloudbreak by hortonworks.

the class KerberosDetailServiceTest method testAmbariManagedKerberosTrue.

@Test
public void testAmbariManagedKerberosTrue() throws IOException {
    KerberosConfig config = new KerberosConfig();
    config.setDescriptor("{\"kerberos-env\":{\"properties\":{\"install_packages\":true}}}");
    Assert.assertTrue(underTest.isAmbariManagedKerberosPackages(config));
}
Also used : KerberosConfig(com.sequenceiq.cloudbreak.domain.KerberosConfig) Test(org.junit.Test)

Example 4 with KerberosConfig

use of com.sequenceiq.cloudbreak.domain.KerberosConfig in project cloudbreak by hortonworks.

the class KerberosDetailServiceTest method testAmbariManagedKerberosFalse.

@Test
public void testAmbariManagedKerberosFalse() throws IOException {
    KerberosConfig config = new KerberosConfig();
    config.setDescriptor("{\"kerberos-env\":{\"properties\":{\"install_packages\":false}}}");
    Assert.assertFalse(underTest.isAmbariManagedKerberosPackages(config));
}
Also used : KerberosConfig(com.sequenceiq.cloudbreak.domain.KerberosConfig) Test(org.junit.Test)

Example 5 with KerberosConfig

use of com.sequenceiq.cloudbreak.domain.KerberosConfig in project cloudbreak by hortonworks.

the class TestUtil method kerberosConfig.

public static KerberosConfig kerberosConfig() {
    KerberosConfig kerberosConfig = new KerberosConfig();
    kerberosConfig.setType(KerberosType.CB_MANAGED);
    kerberosConfig.setMasterKey("mk");
    kerberosConfig.setAdmin("admin");
    kerberosConfig.setPassword("passwd");
    kerberosConfig.setTcpAllowed(true);
    return kerberosConfig;
}
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