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;
}
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);
}
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));
}
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));
}
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;
}
Aggregations