Search in sources :

Example 6 with S3FileSystemConfigurationsView

use of com.sequenceiq.cloudbreak.template.filesystem.s3.S3FileSystemConfigurationsView in project cloudbreak by hortonworks.

the class HiveLLAPServiceConfigProviderTest method getTemplatePreparationObject.

private TemplatePreparationObject getTemplatePreparationObject(boolean includeLocations) {
    HostgroupView master = new HostgroupView("master", 1, InstanceGroupType.GATEWAY, 1);
    HostgroupView worker = new HostgroupView("worker", 2, InstanceGroupType.CORE, 2);
    List<StorageLocationView> locations = new ArrayList<>();
    if (includeLocations) {
        StorageLocation hmsExternalWarehouseDir = new StorageLocation();
        hmsExternalWarehouseDir.setProperty("hive.metastore.warehouse.external.dir");
        hmsExternalWarehouseDir.setValue("s3a://bucket/hive/warehouse/external");
        locations.add(new StorageLocationView(hmsExternalWarehouseDir));
    }
    S3FileSystemConfigurationsView fileSystemConfigurationsView = new S3FileSystemConfigurationsView(new S3FileSystem(), locations, false);
    return Builder.builder().withFileSystemConfigurationView(fileSystemConfigurationsView).withHostgroupViews(Set.of(master, worker)).build();
}
Also used : StorageLocationView(com.sequenceiq.cloudbreak.template.filesystem.StorageLocationView) ArrayList(java.util.ArrayList) HostgroupView(com.sequenceiq.cloudbreak.template.views.HostgroupView) StorageLocation(com.sequenceiq.cloudbreak.domain.StorageLocation) S3FileSystemConfigurationsView(com.sequenceiq.cloudbreak.template.filesystem.s3.S3FileSystemConfigurationsView) S3FileSystem(com.sequenceiq.common.api.filesystem.S3FileSystem)

Example 7 with S3FileSystemConfigurationsView

use of com.sequenceiq.cloudbreak.template.filesystem.s3.S3FileSystemConfigurationsView in project cloudbreak by hortonworks.

the class HiveMetastoreCloudStorageServiceConfigProviderTest method getTemplatePreparationObject.

private TemplatePreparationObject getTemplatePreparationObject(boolean includeLocations) {
    HostgroupView master = new HostgroupView("master", 1, InstanceGroupType.GATEWAY, 1);
    HostgroupView worker = new HostgroupView("worker", 2, InstanceGroupType.CORE, 2);
    List<StorageLocationView> locations = new ArrayList<>();
    if (includeLocations) {
        locations.add(new StorageLocationView(getHiveWarehouseStorageLocation()));
        locations.add(new StorageLocationView(getHiveWarehouseExternalStorageLocation()));
        locations.add(new StorageLocationView(getHiveWarehouseReplicaStorageLocation()));
    }
    S3FileSystemConfigurationsView fileSystemConfigurationsView = new S3FileSystemConfigurationsView(new S3FileSystem(), locations, false);
    return Builder.builder().withFileSystemConfigurationView(fileSystemConfigurationsView).withHostgroupViews(Set.of(master, worker)).build();
}
Also used : StorageLocationView(com.sequenceiq.cloudbreak.template.filesystem.StorageLocationView) ArrayList(java.util.ArrayList) HostgroupView(com.sequenceiq.cloudbreak.template.views.HostgroupView) S3FileSystemConfigurationsView(com.sequenceiq.cloudbreak.template.filesystem.s3.S3FileSystemConfigurationsView) S3FileSystem(com.sequenceiq.common.api.filesystem.S3FileSystem)

Example 8 with S3FileSystemConfigurationsView

use of com.sequenceiq.cloudbreak.template.filesystem.s3.S3FileSystemConfigurationsView in project cloudbreak by hortonworks.

the class CentralCmTemplateUpdaterTest method getKafkaPropertiesWhenNoHdfsInClusterShouldPresentCoreSettings.

@Test
public void getKafkaPropertiesWhenNoHdfsInClusterShouldPresentCoreSettings() {
    CoreConfigProvider coreConfigProvider = new CoreConfigProvider();
    ReflectionTestUtils.setField(coreConfigProvider, "s3ConfigProvider", s3ConfigProvider);
    List<CmTemplateComponentConfigProvider> cmTemplateComponentConfigProviders = List.of(coreConfigProvider);
    ReflectionTestUtils.setField(cmTemplateComponentConfigProviderProcessor, "providers", cmTemplateComponentConfigProviders);
    S3FileSystem s3FileSystem = new S3FileSystem();
    s3FileSystem.setInstanceProfile("profile");
    s3FileSystem.setS3GuardDynamoTableName("cb-table");
    s3FileSystem.setStorageContainer("cloudbreak-bucket");
    StorageLocation storageLocation = new StorageLocation();
    storageLocation.setProperty("core_defaultfs");
    storageLocation.setValue("s3a://cloudbreak-bucket/kafka");
    storageLocation.setConfigFile("core_settings");
    StorageLocationView storageLocationView = new StorageLocationView(storageLocation);
    BaseFileSystemConfigurationsView baseFileSystemConfigurationsView = new S3FileSystemConfigurationsView(s3FileSystem, Sets.newHashSet(storageLocationView), false);
    when(templatePreparationObject.getFileSystemConfigurationView()).thenReturn(Optional.of(baseFileSystemConfigurationsView));
    when(templatePreparationObject.getGatewayView()).thenReturn(new GatewayView(new Gateway(), "signkey", new HashSet<>()));
    Set<HostgroupView> hostgroupViews = new HashSet<>();
    hostgroupViews.add(new HostgroupView("master", 1, InstanceGroupType.GATEWAY, 1));
    when(templatePreparationObject.getHostgroupViews()).thenReturn(hostgroupViews);
    when(templatePreparationObject.getGatewayView()).thenReturn(new GatewayView(new Gateway(), "signkey", new HashSet<>()));
    when(blueprintView.getBlueprintText()).thenReturn(getBlueprintText("input/kafka-without-hdfs.bp"));
    String generated = generator.getBlueprintText(templatePreparationObject);
    String expected = new CmTemplateProcessor(getBlueprintText("output/kafka-without-hdfs.bp")).getTemplate().toString();
    String output = new CmTemplateProcessor(generated).getTemplate().toString();
    Assert.assertEquals(expected, output);
}
Also used : StorageLocationView(com.sequenceiq.cloudbreak.template.filesystem.StorageLocationView) CoreConfigProvider(com.sequenceiq.cloudbreak.cmtemplate.configproviders.core.CoreConfigProvider) BaseFileSystemConfigurationsView(com.sequenceiq.cloudbreak.template.filesystem.BaseFileSystemConfigurationsView) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) S3FileSystemConfigurationsView(com.sequenceiq.cloudbreak.template.filesystem.s3.S3FileSystemConfigurationsView) S3FileSystem(com.sequenceiq.common.api.filesystem.S3FileSystem) Gateway(com.sequenceiq.cloudbreak.domain.stack.cluster.gateway.Gateway) StorageLocation(com.sequenceiq.cloudbreak.domain.StorageLocation) HostgroupView(com.sequenceiq.cloudbreak.template.views.HostgroupView) GatewayView(com.sequenceiq.cloudbreak.template.views.GatewayView) HashSet(java.util.HashSet) Test(org.junit.Test)

Example 9 with S3FileSystemConfigurationsView

use of com.sequenceiq.cloudbreak.template.filesystem.s3.S3FileSystemConfigurationsView in project cloudbreak by hortonworks.

the class S3ConfigProvider method configureS3BucketLocationCoreSiteParameters.

private void configureS3BucketLocationCoreSiteParameters(TemplatePreparationObject source, StringBuilder hdfsCoreSiteSafetyValveValue) {
    S3FileSystemConfigurationsView s3FileSystemConfigurationsView = (S3FileSystemConfigurationsView) source.getFileSystemConfigurationView().get();
    source.getPlacementView().ifPresent(placementView -> {
        Set<String> buckets = s3FileSystemConfigurationsView.getLocations().stream().map(loc -> locationHelper.parseS3BucketName(loc.getValue())).collect(Collectors.toSet());
        buckets.forEach(bucketName -> {
            String s3BucketEndpointParam = String.format(S3_BUCKET_ENDPOINT_PARAM_TEMPLATE, bucketName);
            String s3BucketEndpoint = String.format(S3_ENDPOINT_TEMPLATE, placementView.getRegion());
            hdfsCoreSiteSafetyValveValue.append(ConfigUtils.getSafetyValveProperty(s3BucketEndpointParam, s3BucketEndpoint));
        });
    });
}
Also used : Inject(javax.inject.Inject) Component(org.springframework.stereotype.Component) S3FileSystemConfigurationsView(com.sequenceiq.cloudbreak.template.filesystem.s3.S3FileSystemConfigurationsView) LocationHelper(com.sequenceiq.cloudbreak.cloud.storage.LocationHelper) Map(java.util.Map) FileSystemType(com.sequenceiq.common.model.FileSystemType) Set(java.util.Set) HMS_METASTORE_DIR(com.sequenceiq.cloudbreak.cmtemplate.configproviders.hive.HiveMetastoreCloudStorageServiceConfigProvider.HMS_METASTORE_DIR) Collectors(java.util.stream.Collectors) StringUtils(org.apache.commons.lang3.StringUtils) TemplatePreparationObject(com.sequenceiq.cloudbreak.template.TemplatePreparationObject) ConfigUtils(com.sequenceiq.cloudbreak.cmtemplate.configproviders.ConfigUtils) S3FileSystemConfigurationsView(com.sequenceiq.cloudbreak.template.filesystem.s3.S3FileSystemConfigurationsView)

Example 10 with S3FileSystemConfigurationsView

use of com.sequenceiq.cloudbreak.template.filesystem.s3.S3FileSystemConfigurationsView in project cloudbreak by hortonworks.

the class Spark3OnYarnRoleConfigProviderTest method getTemplatePreparationObject.

private TemplatePreparationObject getTemplatePreparationObject(String... locations) {
    HostgroupView master = new HostgroupView("master", 1, InstanceGroupType.GATEWAY, 1);
    HostgroupView worker = new HostgroupView("worker", 2, InstanceGroupType.CORE, 2);
    List<StorageLocationView> storageLocations = new ArrayList<>();
    if (locations.length >= 1) {
        StorageLocation hmsExternalWarehouseDir = new StorageLocation();
        hmsExternalWarehouseDir.setProperty("hive.metastore.warehouse.external.dir");
        hmsExternalWarehouseDir.setValue(locations[0]);
        storageLocations.add(new StorageLocationView(hmsExternalWarehouseDir));
    }
    S3FileSystemConfigurationsView fileSystemConfigurationsView = new S3FileSystemConfigurationsView(new S3FileSystem(), storageLocations, false);
    return Builder.builder().withFileSystemConfigurationView(fileSystemConfigurationsView).withHostgroupViews(Set.of(master, worker)).build();
}
Also used : StorageLocationView(com.sequenceiq.cloudbreak.template.filesystem.StorageLocationView) ArrayList(java.util.ArrayList) HostgroupView(com.sequenceiq.cloudbreak.template.views.HostgroupView) StorageLocation(com.sequenceiq.cloudbreak.domain.StorageLocation) S3FileSystemConfigurationsView(com.sequenceiq.cloudbreak.template.filesystem.s3.S3FileSystemConfigurationsView) S3FileSystem(com.sequenceiq.common.api.filesystem.S3FileSystem)

Aggregations

S3FileSystemConfigurationsView (com.sequenceiq.cloudbreak.template.filesystem.s3.S3FileSystemConfigurationsView)25 S3FileSystem (com.sequenceiq.common.api.filesystem.S3FileSystem)23 StorageLocationView (com.sequenceiq.cloudbreak.template.filesystem.StorageLocationView)22 ArrayList (java.util.ArrayList)21 HostgroupView (com.sequenceiq.cloudbreak.template.views.HostgroupView)18 StorageLocation (com.sequenceiq.cloudbreak.domain.StorageLocation)11 BaseFileSystemConfigurationsView (com.sequenceiq.cloudbreak.template.filesystem.BaseFileSystemConfigurationsView)4 Gateway (com.sequenceiq.cloudbreak.domain.stack.cluster.gateway.Gateway)3 TemplatePreparationObject (com.sequenceiq.cloudbreak.template.TemplatePreparationObject)3 HashSet (java.util.HashSet)3 Test (org.junit.Test)3 ApiClusterTemplate (com.cloudera.api.swagger.model.ApiClusterTemplate)2 ClouderaManagerRepo (com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerRepo)2 CmTemplateProcessor (com.sequenceiq.cloudbreak.cmtemplate.CmTemplateProcessor)2 AdlsFileSystemConfigurationsView (com.sequenceiq.cloudbreak.template.filesystem.adls.AdlsFileSystemConfigurationsView)2 GeneralClusterConfigs (com.sequenceiq.cloudbreak.template.model.GeneralClusterConfigs)2 PlacementView (com.sequenceiq.cloudbreak.template.views.PlacementView)2 AdlsFileSystem (com.sequenceiq.common.api.filesystem.AdlsFileSystem)2 ApiClusterTemplateConfig (com.cloudera.api.swagger.model.ApiClusterTemplateConfig)1 LocationHelper (com.sequenceiq.cloudbreak.cloud.storage.LocationHelper)1