use of com.sequenceiq.cloudbreak.template.model.GeneralClusterConfigs in project cloudbreak by hortonworks.
the class RangerCloudStorageServiceConfigProviderTest method getTemplatePreparationObjectForAws.
private TemplatePreparationObject.Builder getTemplatePreparationObjectForAws(boolean includeLocations, boolean above721, boolean includeBackup) {
HostgroupView gateway = new HostgroupView("gateway", 1, InstanceGroupType.GATEWAY, Set.of("g"));
HostgroupView master = new HostgroupView("master", 1, InstanceGroupType.CORE, Set.of("m1", "m2"));
HostgroupView worker = new HostgroupView("worker", 2, InstanceGroupType.CORE, Set.of("w1", "w2", "w3"));
List<StorageLocationView> locations = new ArrayList<>();
if (includeLocations) {
locations.add(new StorageLocationView(getRangerAuditCloudStorageDirAws()));
if (above721) {
locations.add(new StorageLocationView(buildStorageLocation("hive.metastore.warehouse.dir", "s3a://bucket/warehouse/tablespace/managed/hive")));
locations.add(new StorageLocationView(buildStorageLocation("hive.repl.replica.functions.root.dir", "s3a://bucket/hive_replica_functions_dir")));
locations.add(new StorageLocationView(buildStorageLocation("hive.metastore.warehouse.external.dir", "s3a://bucket/warehouse/tablespace/external/hive")));
locations.add(new StorageLocationView(buildStorageLocation("hbase.rootdir", "s3a://bucket/hbase")));
if (includeBackup) {
locations.add(new StorageLocationView(buildStorageLocation(DEFAULT_BACKUP_DIR, "s3a://bucket/backup/location")));
}
}
}
S3FileSystemConfigurationsView fileSystemConfigurationsView = new S3FileSystemConfigurationsView(new S3FileSystem(), locations, false);
GeneralClusterConfigs generalClusterConfigs = new GeneralClusterConfigs();
generalClusterConfigs.setPrimaryGatewayInstanceDiscoveryFQDN(Optional.of("fqdn"));
return Builder.builder().withFileSystemConfigurationView(fileSystemConfigurationsView).withHostgroupViews(Set.of(gateway, master, worker)).withGeneralClusterConfigs(generalClusterConfigs);
}
use of com.sequenceiq.cloudbreak.template.model.GeneralClusterConfigs in project cloudbreak by hortonworks.
the class RangerUserSyncRoleConfigProviderTest method testAwsWhenCmVersionIs726ShouldReturnWithRangerAsSysAdmin.
@Test
public void testAwsWhenCmVersionIs726ShouldReturnWithRangerAsSysAdmin() {
TemplatePreparationObject preparationObject = TemplatePreparationObject.Builder.builder().withCloudPlatform(CloudPlatform.AWS).withServicePrincipals(null).withProductDetails(new ClouderaManagerRepo().withVersion("7.2.6"), new ArrayList<>()).withGeneralClusterConfigs(new GeneralClusterConfigs()).build();
List<ApiClusterTemplateConfig> serviceConfigs = underTest.getRoleConfigs(RANGER_USERSYNC, preparationObject);
assertEquals(2, serviceConfigs.size());
assertEquals("conf/ranger-ugsync-site.xml_role_safety_valve", serviceConfigs.get(0).getName());
assertEquals("<property><name>ranger.usersync.unix.backend</name><value>nss</value></property>", serviceConfigs.get(0).getValue());
assertEquals("ranger.usersync.group.based.role.assignment.rules", serviceConfigs.get(1).getName());
assertEquals("&ROLE_SYS_ADMIN:g:mockAdmin", serviceConfigs.get(1).getValue());
}
use of com.sequenceiq.cloudbreak.template.model.GeneralClusterConfigs in project cloudbreak by hortonworks.
the class RangerUserSyncRoleConfigProviderTest method testAzureWithRaz.
@Test
public void testAzureWithRaz() {
GeneralClusterConfigs generalClusterConfigs = new GeneralClusterConfigs();
generalClusterConfigs.setEnableRangerRaz(true);
TemplatePreparationObject preparationObject = TemplatePreparationObject.Builder.builder().withCloudPlatform(CloudPlatform.AZURE).withProductDetails(new ClouderaManagerRepo().withVersion("7.2.6"), new ArrayList<>()).withServicePrincipals(generateServicePrincipals()).withGeneralClusterConfigs(generalClusterConfigs).build();
List<ApiClusterTemplateConfig> serviceConfigs = underTest.getRoleConfigs(RANGER_USERSYNC, preparationObject);
assertEquals(3, serviceConfigs.size());
assertEquals("conf/ranger-ugsync-site.xml_role_safety_valve", serviceConfigs.get(0).getName());
assertEquals("<property><name>ranger.usersync.unix.backend</name><value>nss</value></property>", serviceConfigs.get(0).getValue());
assertEquals("ranger.usersync.group.based.role.assignment.rules", serviceConfigs.get(1).getName());
assertEquals("&ROLE_SYS_ADMIN:g:mockAdmin", serviceConfigs.get(1).getValue());
assertEquals("ranger_usersync_azure_user_mapping", serviceConfigs.get(2).getName());
assertEquals("hive=3d4fcb5f-51b7-473c-9ca4-9d1e501f47u8;" + "ranger=f346892c-8d70-464c-8330-6ed1112bd880;hbase=286463ce-41c5-4f03-89f6-adb7109394ec", serviceConfigs.get(2).getValue());
}
use of com.sequenceiq.cloudbreak.template.model.GeneralClusterConfigs in project cloudbreak by hortonworks.
the class RangerUserSyncRoleConfigProviderTest method testAzureWhenCmVersionIs726ShouldReturnWithRangerAsSysAdmin.
@Test
public void testAzureWhenCmVersionIs726ShouldReturnWithRangerAsSysAdmin() {
GeneralClusterConfigs generalClusterConfigs = new GeneralClusterConfigs();
generalClusterConfigs.setEnableRangerRaz(false);
TemplatePreparationObject preparationObject = TemplatePreparationObject.Builder.builder().withCloudPlatform(CloudPlatform.AZURE).withProductDetails(new ClouderaManagerRepo().withVersion("7.2.6"), new ArrayList<>()).withServicePrincipals(null).withGeneralClusterConfigs(generalClusterConfigs).build();
List<ApiClusterTemplateConfig> serviceConfigs = underTest.getRoleConfigs(RANGER_USERSYNC, preparationObject);
assertEquals(2, serviceConfigs.size());
assertEquals("conf/ranger-ugsync-site.xml_role_safety_valve", serviceConfigs.get(0).getName());
assertEquals("<property><name>ranger.usersync.unix.backend</name><value>nss</value></property>", serviceConfigs.get(0).getValue());
assertEquals("ranger.usersync.group.based.role.assignment.rules", serviceConfigs.get(1).getName());
assertEquals("&ROLE_SYS_ADMIN:g:mockAdmin", serviceConfigs.get(1).getValue());
}
use of com.sequenceiq.cloudbreak.template.model.GeneralClusterConfigs in project cloudbreak by hortonworks.
the class RangerUserSyncRoleConfigProviderTest method testAzureWithRazNoServicePrincipals.
@Test
public void testAzureWithRazNoServicePrincipals() {
GeneralClusterConfigs generalClusterConfigs = new GeneralClusterConfigs();
generalClusterConfigs.setEnableRangerRaz(true);
TemplatePreparationObject preparationObject = TemplatePreparationObject.Builder.builder().withCloudPlatform(CloudPlatform.AZURE).withProductDetails(new ClouderaManagerRepo().withVersion("7.2.6"), new ArrayList<>()).withServicePrincipals(Collections.emptyMap()).withGeneralClusterConfigs(generalClusterConfigs).build();
List<ApiClusterTemplateConfig> serviceConfigs = underTest.getRoleConfigs(RANGER_USERSYNC, preparationObject);
assertEquals(3, serviceConfigs.size());
assertEquals("conf/ranger-ugsync-site.xml_role_safety_valve", serviceConfigs.get(0).getName());
assertEquals("<property><name>ranger.usersync.unix.backend</name><value>nss</value></property>", serviceConfigs.get(0).getValue());
assertEquals("ranger.usersync.group.based.role.assignment.rules", serviceConfigs.get(1).getName());
assertEquals("&ROLE_SYS_ADMIN:g:mockAdmin", serviceConfigs.get(1).getValue());
assertEquals("ranger_usersync_azure_user_mapping", serviceConfigs.get(2).getName());
assertEquals("", serviceConfigs.get(2).getValue());
}
Aggregations