Search in sources :

Example 1 with ServiceLocationMap

use of com.sequenceiq.cloudbreak.cluster.model.ServiceLocationMap in project cloudbreak by hortonworks.

the class ClusterHostServiceRunner method createPillarWithClouderaManagerSettings.

public Map<String, SaltPillarProperties> createPillarWithClouderaManagerSettings(ClouderaManagerRepo clouderaManagerRepo, Stack stack, GatewayConfig primaryGatewayConfig) {
    ServiceLocationMap serviceLocations = clusterApiConnectors.getConnector(stack.getCluster()).getServiceLocations();
    String cmVersion = clouderaManagerRepo.getVersion();
    boolean disableAutoBundleCollection = entitlementService.cmAutoBundleCollectionDisabled(Crn.safeFromString(stack.getResourceCrn()).getAccountId());
    return Map.of("cloudera-manager-settings", new SaltPillarProperties("/cloudera-manager/settings.sls", singletonMap("cloudera-manager", Map.of("settings", Map.of("heartbeat_interval", cmHeartbeatInterval, "missed_heartbeat_interval", cmMissedHeartbeatInterval, "disable_auto_bundle_collection", disableAutoBundleCollection, "set_cdp_env", isVersionNewerOrEqualThanLimited(cmVersion, CLOUDERAMANAGER_VERSION_7_0_2), "deterministic_uid_gid", isVersionNewerOrEqualThanLimited(cmVersion, CLOUDERAMANAGER_VERSION_7_2_1), "cloudera_scm_sudo_access", CMRepositoryVersionUtil.isSudoAccessNeededForHostCertRotation(clouderaManagerRepo)), "mgmt_service_directories", serviceLocations.getAllVolumePath(), "address", primaryGatewayConfig.getPrivateAddress()))));
}
Also used : ServiceLocationMap(com.sequenceiq.cloudbreak.cluster.model.ServiceLocationMap) SaltPillarProperties(com.sequenceiq.cloudbreak.orchestrator.model.SaltPillarProperties)

Example 2 with ServiceLocationMap

use of com.sequenceiq.cloudbreak.cluster.model.ServiceLocationMap in project cloudbreak by hortonworks.

the class CmMgmtServiceConfigLocationService method setConfigs.

@Override
public void setConfigs(Stack stack, ApiRoleList apiRoleList) {
    ServiceLocationMap serviceLocationMap = volumePathBuilder.buildServiceLocationMap();
    Arrays.stream(MgmtServices.values()).forEach(mgmtService -> addConfigIfRoleIsPresent(apiRoleList, serviceLocationMap, mgmtService));
}
Also used : ServiceLocationMap(com.sequenceiq.cloudbreak.cluster.model.ServiceLocationMap)

Example 3 with ServiceLocationMap

use of com.sequenceiq.cloudbreak.cluster.model.ServiceLocationMap in project cloudbreak by hortonworks.

the class CmMgmtVolumePathBuilder method buildServiceLocationMap.

public ServiceLocationMap buildServiceLocationMap() {
    ServiceLocationMap serviceLocations = new ServiceLocationMap();
    Arrays.stream(MgmtServices.values()).forEach(service -> serviceLocations.add(new ServiceLocation(service.name(), buildSingleVolumePath(1, service.getDirectory()))));
    return serviceLocations;
}
Also used : ServiceLocationMap(com.sequenceiq.cloudbreak.cluster.model.ServiceLocationMap) ServiceLocation(com.sequenceiq.cloudbreak.cluster.model.ServiceLocation)

Example 4 with ServiceLocationMap

use of com.sequenceiq.cloudbreak.cluster.model.ServiceLocationMap in project cloudbreak by hortonworks.

the class ClusterHostServiceRunnerTest method setupMocksForRunClusterServices.

private void setupMocksForRunClusterServices() {
    when(umsClient.getAccountDetails(any(), any(), any())).thenReturn(UserManagementProto.Account.getDefaultInstance());
    when(stackService.get(any())).thenReturn(stack);
    when(stack.getCluster()).thenReturn(cluster);
    when(stack.getTunnel()).thenReturn(Tunnel.DIRECT);
    when(stack.getCloudPlatform()).thenReturn(CloudPlatform.AWS.name());
    when(stack.getResourceCrn()).thenReturn(TEST_CLUSTER_CRN);
    when(cluster.getName()).thenReturn("clustername");
    when(cluster.getStack()).thenReturn(stack);
    when(componentLocator.getComponentLocation(any(), any())).thenReturn(new HashMap<>());
    when(exposedServiceCollector.getImpalaService()).thenReturn(mock(ExposedService.class));
    when(environmentConfigProvider.getParentEnvironmentCrn(any())).thenReturn("crn:cdp:iam:us-west-1:accid:user:mockuser@cloudera.com");
    ClouderaManagerRepo clouderaManagerRepo = mock(ClouderaManagerRepo.class);
    when(clouderaManagerRepo.getVersion()).thenReturn("7.2.2");
    GatewayConfig gatewayConfig = mock(GatewayConfig.class);
    when(gatewayConfig.getPrivateAddress()).thenReturn("1.2.3.4");
    when(gatewayConfig.getHostname()).thenReturn("hostname");
    when(gatewayConfigService.getPrimaryGatewayConfig(any())).thenReturn(gatewayConfig);
    when(clusterComponentConfigProvider.getClouderaManagerRepoDetails(any())).thenReturn(clouderaManagerRepo);
    when(exposedServiceCollector.getRangerService()).thenReturn(mock(ExposedService.class));
    ExposedService cmExposedService = mock(ExposedService.class);
    when(cmExposedService.getServiceName()).thenReturn("CM");
    when(exposedServiceCollector.getClouderaManagerService()).thenReturn(cmExposedService);
    Template template = new Template();
    template.setTemporaryStorage(TemporaryStorage.EPHEMERAL_VOLUMES);
    Set<InstanceGroup> instanceGroups = new HashSet<>();
    createInstanceGroup(template, instanceGroups, "fqdn1", null, "1.1.1.1", "1.1.1.2");
    createInstanceGroup(template, instanceGroups, "fqdn2", null, "1.1.2.1", "1.1.2.2");
    InstanceGroup gwIg = createInstanceGroup(template, instanceGroups, "gateway1", "gateway2", "1.1.3.1", "1.1.3.2");
    lenient().when(stack.getNotTerminatedAndNotZombieGatewayInstanceMetadata()).thenReturn(Lists.newArrayList(gwIg.getAllInstanceMetaData()));
    when(stack.getInstanceGroups()).thenReturn(instanceGroups);
    RdsConfigWithoutCluster rdsConfigWithoutCluster = mock(RdsConfigWithoutCluster.class);
    when(rdsConfigWithoutClusterService.findByClusterIdAndType(any(), eq(DatabaseType.CLOUDERA_MANAGER))).thenReturn(rdsConfigWithoutCluster);
    when(rdsConfigWithoutCluster.getType()).thenReturn("asdf");
    when(rdsConfigWithoutCluster.getConnectionURL()).thenReturn("jdbc:postgresql:subname://some-rds.1d3nt1f13r.eu-west-1.rds.amazonaws.com:5432/ranger");
    when(rdsConfigWithoutCluster.getConnectionUserName()).thenReturn(new Secret("username"));
    when(rdsConfigWithoutCluster.getConnectionPassword()).thenReturn(new Secret("password"));
    when(loadBalancerSANProvider.getLoadBalancerSAN(stack)).thenReturn(Optional.empty());
    ClusterPreCreationApi clusterPreCreationApi = mock(ClusterPreCreationApi.class);
    when(clusterApiConnectors.getConnector(cluster)).thenReturn(clusterPreCreationApi);
    ServiceLocationMap serviceLocationMap = new ServiceLocationMap();
    serviceLocationMap.add(new ServiceLocation("serv", "paath"));
    when(clusterPreCreationApi.getServiceLocations()).thenReturn(serviceLocationMap);
    ReflectionTestUtils.setField(underTest, "cmHeartbeatInterval", "1");
    ReflectionTestUtils.setField(underTest, "cmMissedHeartbeatInterval", "1");
}
Also used : ServiceLocationMap(com.sequenceiq.cloudbreak.cluster.model.ServiceLocationMap) ClusterPreCreationApi(com.sequenceiq.cloudbreak.cluster.api.ClusterPreCreationApi) Template(com.sequenceiq.cloudbreak.domain.Template) InstanceGroup(com.sequenceiq.cloudbreak.domain.stack.instance.InstanceGroup) Secret(com.sequenceiq.cloudbreak.service.secret.domain.Secret) ClouderaManagerRepo(com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerRepo) ExposedService(com.sequenceiq.cloudbreak.api.service.ExposedService) ServiceLocation(com.sequenceiq.cloudbreak.cluster.model.ServiceLocation) GatewayConfig(com.sequenceiq.cloudbreak.orchestrator.model.GatewayConfig) HashSet(java.util.HashSet) RdsConfigWithoutCluster(com.sequenceiq.cloudbreak.domain.view.RdsConfigWithoutCluster)

Aggregations

ServiceLocationMap (com.sequenceiq.cloudbreak.cluster.model.ServiceLocationMap)4 ServiceLocation (com.sequenceiq.cloudbreak.cluster.model.ServiceLocation)2 ExposedService (com.sequenceiq.cloudbreak.api.service.ExposedService)1 ClouderaManagerRepo (com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerRepo)1 ClusterPreCreationApi (com.sequenceiq.cloudbreak.cluster.api.ClusterPreCreationApi)1 Template (com.sequenceiq.cloudbreak.domain.Template)1 InstanceGroup (com.sequenceiq.cloudbreak.domain.stack.instance.InstanceGroup)1 RdsConfigWithoutCluster (com.sequenceiq.cloudbreak.domain.view.RdsConfigWithoutCluster)1 GatewayConfig (com.sequenceiq.cloudbreak.orchestrator.model.GatewayConfig)1 SaltPillarProperties (com.sequenceiq.cloudbreak.orchestrator.model.SaltPillarProperties)1 Secret (com.sequenceiq.cloudbreak.service.secret.domain.Secret)1 HashSet (java.util.HashSet)1