Search in sources :

Example 16 with Stack

use of com.sequenceiq.cloudbreak.domain.stack.Stack in project cloudbreak by hortonworks.

the class ClusterServiceRunner method redeployGatewayPillar.

public void redeployGatewayPillar(Long stackId) {
    Stack stack = stackService.getByIdWithListsInTransaction(stackId);
    Long clusterId = stack.getCluster().getId();
    Cluster cluster = clusterService.findOneWithLists(clusterId).orElseThrow(NotFoundException.notFound("Cluster", clusterId));
    hostRunner.redeployGatewayPillarOnly(stack, cluster);
}
Also used : Cluster(com.sequenceiq.cloudbreak.domain.stack.cluster.Cluster) Stack(com.sequenceiq.cloudbreak.domain.stack.Stack)

Example 17 with Stack

use of com.sequenceiq.cloudbreak.domain.stack.Stack in project cloudbreak by hortonworks.

the class StackToStackV4RequestConverter method convert.

public StackV4Request convert(Stack source) {
    StackV4Request stackV4Request = new StackV4Request();
    stackV4Request.setCloudPlatform(getIfNotNull(source.getCloudPlatform(), cp -> Enum.valueOf(CloudPlatform.class, cp)));
    stackV4Request.setEnvironmentCrn(source.getEnvironmentCrn());
    stackV4Request.setCustomDomain(getCustomDomainSettings(source));
    providerParameterCalculator.parse(new HashMap<>(source.getParameters()), stackV4Request);
    stackV4Request.setAuthentication(stackAuthenticationToStackAuthenticationV4RequestConverter.convert(source.getStackAuthentication()));
    stackV4Request.setNetwork(networkToNetworkV4RequestConverter.convert(source.getNetwork()));
    stackV4Request.setCluster(clusterToClusterV4RequestConverter.convert(source.getCluster()));
    stackV4Request.setExternalDatabase(getIfNotNull(source, stackToExternalDatabaseRequestConverter::convert));
    if (!source.getLoadBalancers().isEmpty()) {
        stackV4Request.setEnableLoadBalancer(true);
    }
    stackV4Request.setInstanceGroups(getInstanceGroups(source));
    prepareImage(source, stackV4Request);
    prepareTags(source, stackV4Request);
    prepareTelemetryRequest(source, stackV4Request);
    datalakeService.prepareDatalakeRequest(source, stackV4Request);
    stackV4Request.setPlacement(getPlacementSettings(source.getRegion(), source.getAvailabilityZone()));
    prepareInputs(source, stackV4Request);
    stackV4Request.setTimeToLive(getStackTimeToLive(source));
    return stackV4Request;
}
Also used : PlacementSettingsV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.environment.placement.PlacementSettingsV4Request) Stack(com.sequenceiq.cloudbreak.domain.stack.Stack) Cluster(com.sequenceiq.cloudbreak.domain.stack.cluster.Cluster) NullUtil.getIfNotNull(com.sequenceiq.cloudbreak.util.NullUtil.getIfNotNull) TelemetryConverter(com.sequenceiq.cloudbreak.converter.v4.stacks.TelemetryConverter) LoggerFactory(org.slf4j.LoggerFactory) DatalakeService(com.sequenceiq.cloudbreak.service.sharedservice.DatalakeService) HashMap(java.util.HashMap) ComponentConfigProviderService(com.sequenceiq.cloudbreak.service.ComponentConfigProviderService) PlatformParametersConsts(com.sequenceiq.cloudbreak.cloud.PlatformParametersConsts) Image(com.sequenceiq.cloudbreak.cloud.model.Image) CloudPlatform(com.sequenceiq.cloudbreak.common.mappable.CloudPlatform) ArrayList(java.util.ArrayList) TelemetryRequest(com.sequenceiq.common.api.telemetry.request.TelemetryRequest) Inject(javax.inject.Inject) Strings(com.google.common.base.Strings) ProviderParameterCalculator(com.sequenceiq.cloudbreak.common.mappable.ProviderParameterCalculator) Map(java.util.Map) CustomDomainSettingsV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.customdomain.CustomDomainSettingsV4Request) Telemetry(com.sequenceiq.common.api.telemetry.model.Telemetry) InstanceGroupV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.instancegroup.InstanceGroupV4Request) StackToExternalDatabaseRequestConverter(com.sequenceiq.cloudbreak.converter.v4.stacks.StackToExternalDatabaseRequestConverter) TagsV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.tags.TagsV4Request) Logger(org.slf4j.Logger) ImageSettingsV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.image.ImageSettingsV4Request) StackTags(com.sequenceiq.cloudbreak.cloud.model.StackTags) Set(java.util.Set) IOException(java.io.IOException) StackInputs(com.sequenceiq.cloudbreak.cloud.model.StackInputs) Collectors(java.util.stream.Collectors) CloudbreakImageNotFoundException(com.sequenceiq.cloudbreak.core.CloudbreakImageNotFoundException) Recipe(com.sequenceiq.cloudbreak.domain.Recipe) List(java.util.List) Component(org.springframework.stereotype.Component) StackV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.StackV4Request) Optional(java.util.Optional) InstanceGroup(com.sequenceiq.cloudbreak.domain.stack.instance.InstanceGroup) InstanceGroupNetworkToInstanceGroupNetworkV4RequestConverter(com.sequenceiq.cloudbreak.converter.v4.stacks.instancegroup.network.InstanceGroupNetworkToInstanceGroupNetworkV4RequestConverter) StackV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.StackV4Request)

Example 18 with Stack

use of com.sequenceiq.cloudbreak.domain.stack.Stack in project cloudbreak by hortonworks.

the class ClusterHostServiceRunner method changePrimaryGateway.

public String changePrimaryGateway(Stack stack) throws CloudbreakException {
    GatewayConfig formerPrimaryGatewayConfig = gatewayConfigService.getPrimaryGatewayConfig(stack);
    List<GatewayConfig> gatewayConfigs = gatewayConfigService.getAllGatewayConfigs(stack);
    Optional<GatewayConfig> newPrimaryCandidate = gatewayConfigs.stream().filter(gc -> !gc.isPrimary()).findFirst();
    if (newPrimaryCandidate.isPresent()) {
        GatewayConfig newPrimary = newPrimaryCandidate.get();
        Set<Node> allNodes = stackUtil.collectNodes(stack);
        try {
            hostOrchestrator.changePrimaryGateway(formerPrimaryGatewayConfig, newPrimary, gatewayConfigs, allNodes, clusterDeletionBasedModel(stack.getId(), stack.getCluster().getId()));
            return newPrimary.getHostname();
        } catch (CloudbreakOrchestratorException ex) {
            throw new CloudbreakException(ex);
        }
    } else {
        throw new CloudbreakException("Primary gateway change is not possible because there is no available node for the action");
    }
}
Also used : CloudbreakException(com.sequenceiq.cloudbreak.service.CloudbreakException) DatalakeService(com.sequenceiq.cloudbreak.service.sharedservice.DatalakeService) ComponentConfigProviderService(com.sequenceiq.cloudbreak.service.ComponentConfigProviderService) StringUtils(org.apache.commons.lang3.StringUtils) ThreadBasedUserCrnProvider(com.sequenceiq.cloudbreak.auth.ThreadBasedUserCrnProvider) Map(java.util.Map) Gateway(com.sequenceiq.cloudbreak.domain.stack.cluster.gateway.Gateway) StringUtils.isEmpty(org.apache.commons.lang3.StringUtils.isEmpty) HostAttributeDecorator(com.sequenceiq.cloudbreak.core.bootstrap.service.host.decorator.HostAttributeDecorator) RecipeEngine(com.sequenceiq.cloudbreak.service.cluster.flow.recipe.RecipeEngine) CLOUDERAMANAGER_VERSION_7_2_1(com.sequenceiq.cloudbreak.cmtemplate.CMRepositoryVersionUtil.CLOUDERAMANAGER_VERSION_7_2_1) CLOUDERAMANAGER_VERSION_7_2_0(com.sequenceiq.cloudbreak.cmtemplate.CMRepositoryVersionUtil.CLOUDERAMANAGER_VERSION_7_2_0) Set(java.util.Set) Crn(com.sequenceiq.cloudbreak.auth.crn.Crn) CloudbreakOrchestratorException(com.sequenceiq.cloudbreak.orchestrator.exception.CloudbreakOrchestratorException) ClouderaManagerRepo(com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerRepo) Serializable(java.io.Serializable) TargetedUpscaleSupportService(com.sequenceiq.cloudbreak.service.stack.TargetedUpscaleSupportService) StringUtils.isNotBlank(org.apache.commons.lang3.StringUtils.isNotBlank) RdsConfigWithoutClusterService(com.sequenceiq.cloudbreak.service.rdsconfig.RdsConfigWithoutClusterService) StackUtil(com.sequenceiq.cloudbreak.util.StackUtil) MDCUtils(com.sequenceiq.cloudbreak.logger.MDCUtils) CloudbreakOrchestratorFailedException(com.sequenceiq.cloudbreak.orchestrator.exception.CloudbreakOrchestratorFailedException) CollectionUtils(org.springframework.util.CollectionUtils) GatewayConfig(com.sequenceiq.cloudbreak.orchestrator.model.GatewayConfig) ExposedServices(com.sequenceiq.cloudbreak.domain.stack.cluster.gateway.ExposedServices) CancellationException(com.sequenceiq.cloudbreak.cloud.scheduler.CancellationException) InstanceGroup(com.sequenceiq.cloudbreak.domain.stack.instance.InstanceGroup) StackService(com.sequenceiq.cloudbreak.service.stack.StackService) Joiner(com.google.common.base.Joiner) Stack(com.sequenceiq.cloudbreak.domain.stack.Stack) CMLicenseParser(com.sequenceiq.cloudbreak.auth.CMLicenseParser) OrchestratorGrainRunnerParams(com.sequenceiq.cloudbreak.orchestrator.host.OrchestratorGrainRunnerParams) HostGroupService(com.sequenceiq.cloudbreak.service.hostgroup.HostGroupService) StringUtils.isNotEmpty(org.apache.commons.lang3.StringUtils.isNotEmpty) ArrayList(java.util.ArrayList) Value(org.springframework.beans.factory.annotation.Value) CsdParcelDecorator(com.sequenceiq.cloudbreak.core.bootstrap.service.host.decorator.CsdParcelDecorator) KerberosDetailService(com.sequenceiq.cloudbreak.template.kerberos.KerberosDetailService) Lists(com.google.common.collect.Lists) KerberosType(com.sequenceiq.cloudbreak.type.KerberosType) LdapView(com.sequenceiq.cloudbreak.dto.LdapView) CMRepositoryVersionUtil.isVersionNewerOrEqualThanLimited(com.sequenceiq.cloudbreak.cmtemplate.CMRepositoryVersionUtil.isVersionNewerOrEqualThanLimited) ClusterComponentConfigProvider(com.sequenceiq.cloudbreak.cluster.service.ClusterComponentConfigProvider) NullUtil.throwIfNull(com.sequenceiq.cloudbreak.util.NullUtil.throwIfNull) DatabaseType(com.sequenceiq.cloudbreak.api.endpoint.v4.database.base.DatabaseType) DnsResolverType(com.sequenceiq.cloudbreak.domain.stack.DnsResolverType) ExitCriteriaModel(com.sequenceiq.cloudbreak.orchestrator.state.ExitCriteriaModel) IOException(java.io.IOException) PostgresConfigService(com.sequenceiq.cloudbreak.core.bootstrap.service.container.postgres.PostgresConfigService) ServiceLocationMap(com.sequenceiq.cloudbreak.cluster.model.ServiceLocationMap) ClusterDeletionBasedExitCriteriaModel(com.sequenceiq.cloudbreak.core.bootstrap.service.ClusterDeletionBasedExitCriteriaModel) GrpcUmsClient(com.sequenceiq.cloudbreak.auth.altus.GrpcUmsClient) HostGroup(com.sequenceiq.cloudbreak.domain.stack.cluster.host.HostGroup) GrainProperties(com.sequenceiq.cloudbreak.orchestrator.model.GrainProperties) InstanceMetaData(com.sequenceiq.cloudbreak.domain.stack.instance.InstanceMetaData) GatewayTopology(com.sequenceiq.cloudbreak.domain.stack.cluster.gateway.GatewayTopology) ComponentLocatorService(com.sequenceiq.cloudbreak.service.blueprint.ComponentLocatorService) InetAddresses(com.google.common.net.InetAddresses) NodesUnreachableException(com.sequenceiq.cloudbreak.util.NodesUnreachableException) SaltConfig(com.sequenceiq.cloudbreak.orchestrator.model.SaltConfig) GrainOperation(com.sequenceiq.cloudbreak.orchestrator.host.GrainOperation) EntitlementService(com.sequenceiq.cloudbreak.auth.altus.EntitlementService) CloudbreakOrchestratorCancelledException(com.sequenceiq.cloudbreak.orchestrator.exception.CloudbreakOrchestratorCancelledException) LoggerFactory(org.slf4j.LoggerFactory) LoadBalancerSANProvider(com.sequenceiq.cloudbreak.san.LoadBalancerSANProvider) InstanceGroupService(com.sequenceiq.cloudbreak.service.stack.InstanceGroupService) ClusterPreCreationApi(com.sequenceiq.cloudbreak.cluster.api.ClusterPreCreationApi) KerberosConfigService(com.sequenceiq.cloudbreak.kerberos.KerberosConfigService) ExposedServiceCollector(com.sequenceiq.cloudbreak.api.service.ExposedServiceCollector) Telemetry(com.sequenceiq.common.api.telemetry.model.Telemetry) NotFoundException(com.sequenceiq.cloudbreak.common.exception.NotFoundException) HostOrchestrator(com.sequenceiq.cloudbreak.orchestrator.host.HostOrchestrator) CLOUDERAMANAGER_VERSION_7_0_2(com.sequenceiq.cloudbreak.cmtemplate.CMRepositoryVersionUtil.CLOUDERAMANAGER_VERSION_7_0_2) SaltPillarProperties(com.sequenceiq.cloudbreak.orchestrator.model.SaltPillarProperties) DataBusCredential(com.sequenceiq.common.api.telemetry.model.DataBusCredential) StackTags(com.sequenceiq.cloudbreak.cloud.model.StackTags) ExposedService(com.sequenceiq.cloudbreak.api.service.ExposedService) Collectors(java.util.stream.Collectors) TemporaryStorage(com.sequenceiq.cloudbreak.common.type.TemporaryStorage) RegionAwareInternalCrnGeneratorFactory(com.sequenceiq.cloudbreak.auth.crn.RegionAwareInternalCrnGeneratorFactory) Json(com.sequenceiq.cloudbreak.common.json.Json) IdBrokerService(com.sequenceiq.cloudbreak.service.idbroker.IdBrokerService) GatewayConfigService(com.sequenceiq.cloudbreak.service.GatewayConfigService) ProxyConfigProvider(com.sequenceiq.cloudbreak.service.proxy.ProxyConfigProvider) List(java.util.List) VirtualGroupService(com.sequenceiq.cloudbreak.auth.altus.VirtualGroupService) RdsView(com.sequenceiq.cloudbreak.template.views.RdsView) Optional(java.util.Optional) SSOType(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.base.SSOType) Pattern(java.util.regex.Pattern) KerberosConfig(com.sequenceiq.cloudbreak.dto.KerberosConfig) Account(com.cloudera.thunderhead.service.usermanagement.UserManagementProto.Account) Cluster(com.sequenceiq.cloudbreak.domain.stack.cluster.Cluster) LoadBalancerConfigService(com.sequenceiq.cloudbreak.service.LoadBalancerConfigService) CMRepositoryVersionUtil(com.sequenceiq.cloudbreak.cmtemplate.CMRepositoryVersionUtil) IdBroker(com.sequenceiq.cloudbreak.domain.stack.cluster.IdBroker) LdapConfigService(com.sequenceiq.cloudbreak.ldap.LdapConfigService) HashMap(java.util.HashMap) FreeIpaConfigProvider(com.sequenceiq.cloudbreak.service.freeipa.FreeIpaConfigProvider) HashSet(java.util.HashSet) Inject(javax.inject.Inject) InstanceMetaDataService(com.sequenceiq.cloudbreak.service.stack.InstanceMetaDataService) Collections.singletonMap(java.util.Collections.singletonMap) RdsConfigWithoutCluster(com.sequenceiq.cloudbreak.domain.view.RdsConfigWithoutCluster) Nonnull(javax.annotation.Nonnull) TelemetryDecorator(com.sequenceiq.cloudbreak.core.bootstrap.service.host.decorator.TelemetryDecorator) ClusterDeletionBasedExitCriteriaModel.clusterDeletionBasedModel(com.sequenceiq.cloudbreak.core.bootstrap.service.ClusterDeletionBasedExitCriteriaModel.clusterDeletionBasedModel) Logger(org.slf4j.Logger) VirtualGroupRequest(com.sequenceiq.cloudbreak.auth.altus.VirtualGroupRequest) NodeReachabilityResult(com.sequenceiq.cloudbreak.orchestrator.model.NodeReachabilityResult) EnvironmentConfigProvider(com.sequenceiq.cloudbreak.service.environment.EnvironmentConfigProvider) Node(com.sequenceiq.cloudbreak.common.orchestration.Node) MountDisks(com.sequenceiq.cloudbreak.service.stack.flow.MountDisks) Component(org.springframework.stereotype.Component) UmsVirtualGroupRight(com.sequenceiq.cloudbreak.auth.altus.UmsVirtualGroupRight) ClusterApiConnectors(com.sequenceiq.cloudbreak.service.cluster.ClusterApiConnectors) CloudbreakServiceException(com.sequenceiq.cloudbreak.common.exception.CloudbreakServiceException) Comparator(java.util.Comparator) Collections(java.util.Collections) CloudbreakOrchestratorException(com.sequenceiq.cloudbreak.orchestrator.exception.CloudbreakOrchestratorException) Node(com.sequenceiq.cloudbreak.common.orchestration.Node) CloudbreakException(com.sequenceiq.cloudbreak.service.CloudbreakException) GatewayConfig(com.sequenceiq.cloudbreak.orchestrator.model.GatewayConfig)

Example 19 with Stack

use of com.sequenceiq.cloudbreak.domain.stack.Stack in project cloudbreak by hortonworks.

the class ClusterHostServiceRunner method createSaltConfig.

private SaltConfig createSaltConfig(Stack stack, Cluster cluster, List<GrainProperties> grainsProperties) throws IOException, CloudbreakOrchestratorException {
    GatewayConfig primaryGatewayConfig = gatewayConfigService.getPrimaryGatewayConfig(stack);
    ClouderaManagerRepo clouderaManagerRepo = clusterComponentConfigProvider.getClouderaManagerRepoDetails(cluster.getId());
    Map<String, SaltPillarProperties> servicePillar = new HashMap<>();
    KerberosConfig kerberosConfig = kerberosConfigService.get(stack.getEnvironmentCrn(), stack.getName()).orElse(null);
    saveCustomNameservers(stack, kerberosConfig, servicePillar);
    servicePillar.putAll(createUnboundEliminationPillar(stack.getDomainDnsResolver()));
    addKerberosConfig(servicePillar, kerberosConfig);
    servicePillar.putAll(hostAttributeDecorator.createHostAttributePillars(stack));
    servicePillar.put("discovery", new SaltPillarProperties("/discovery/init.sls", singletonMap("platform", stack.cloudPlatform())));
    String virtualGroupsEnvironmentCrn = environmentConfigProvider.getParentEnvironmentCrn(stack.getEnvironmentCrn());
    boolean deployedInChildEnvironment = !virtualGroupsEnvironmentCrn.equals(stack.getEnvironmentCrn());
    Map<String, ? extends Serializable> clusterProperties = Map.of("name", stack.getCluster().getName(), "deployedInChildEnvironment", deployedInChildEnvironment);
    servicePillar.put("metadata", new SaltPillarProperties("/metadata/init.sls", singletonMap("cluster", clusterProperties)));
    ClusterPreCreationApi connector = clusterApiConnectors.getConnector(cluster);
    Map<String, List<String>> serviceLocations = getServiceLocations(cluster);
    Optional<LdapView> ldapView = ldapConfigService.get(stack.getEnvironmentCrn(), stack.getName());
    VirtualGroupRequest virtualGroupRequest = getVirtualGroupRequest(virtualGroupsEnvironmentCrn, ldapView);
    servicePillar.putAll(createGatewayPillar(primaryGatewayConfig, cluster, stack, virtualGroupRequest, connector, kerberosConfig, serviceLocations, clouderaManagerRepo));
    saveIdBrokerPillar(cluster, servicePillar);
    postgresConfigService.decorateServicePillarWithPostgresIfNeeded(servicePillar, stack, cluster);
    addClouderaManagerConfig(stack, cluster, servicePillar, clouderaManagerRepo, primaryGatewayConfig);
    ldapView.ifPresent(ldap -> saveLdapPillar(ldap, servicePillar));
    saveSssdAdPillar(servicePillar, kerberosConfig);
    servicePillar.putAll(saveSssdIpaPillar(kerberosConfig, serviceLocations, stack.getEnvironmentCrn()));
    Map<String, Map<String, String>> mountPathMap = stack.getInstanceGroups().stream().flatMap(group -> group.getInstanceMetaDataSet().stream().filter(instanceMetaData -> instanceMetaData.getDiscoveryFQDN() != null).collect(Collectors.toMap(InstanceMetaData::getDiscoveryFQDN, node -> Map.of("mount_path", getMountPath(group), "cloud_platform", stack.getCloudPlatform(), "temporary_storage", group.getTemplate().getTemporaryStorage().name()), (l, r) -> Map.of("mount_path", getMountPath(group), "cloud_platform", stack.getCloudPlatform(), "temporary_storage", group.getTemplate().getTemporaryStorage().name()))).entrySet().stream()).collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
    servicePillar.put("startup", new SaltPillarProperties("/mount/startup.sls", singletonMap("mount", mountPathMap)));
    proxyConfigProvider.decoratePillarWithProxyDataIfNeeded(servicePillar, cluster);
    decoratePillarWithJdbcConnectors(cluster, servicePillar);
    return new SaltConfig(servicePillar, grainsProperties);
}
Also used : CloudbreakException(com.sequenceiq.cloudbreak.service.CloudbreakException) DatalakeService(com.sequenceiq.cloudbreak.service.sharedservice.DatalakeService) ComponentConfigProviderService(com.sequenceiq.cloudbreak.service.ComponentConfigProviderService) StringUtils(org.apache.commons.lang3.StringUtils) ThreadBasedUserCrnProvider(com.sequenceiq.cloudbreak.auth.ThreadBasedUserCrnProvider) Map(java.util.Map) Gateway(com.sequenceiq.cloudbreak.domain.stack.cluster.gateway.Gateway) StringUtils.isEmpty(org.apache.commons.lang3.StringUtils.isEmpty) HostAttributeDecorator(com.sequenceiq.cloudbreak.core.bootstrap.service.host.decorator.HostAttributeDecorator) RecipeEngine(com.sequenceiq.cloudbreak.service.cluster.flow.recipe.RecipeEngine) CLOUDERAMANAGER_VERSION_7_2_1(com.sequenceiq.cloudbreak.cmtemplate.CMRepositoryVersionUtil.CLOUDERAMANAGER_VERSION_7_2_1) CLOUDERAMANAGER_VERSION_7_2_0(com.sequenceiq.cloudbreak.cmtemplate.CMRepositoryVersionUtil.CLOUDERAMANAGER_VERSION_7_2_0) Set(java.util.Set) Crn(com.sequenceiq.cloudbreak.auth.crn.Crn) CloudbreakOrchestratorException(com.sequenceiq.cloudbreak.orchestrator.exception.CloudbreakOrchestratorException) ClouderaManagerRepo(com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerRepo) Serializable(java.io.Serializable) TargetedUpscaleSupportService(com.sequenceiq.cloudbreak.service.stack.TargetedUpscaleSupportService) StringUtils.isNotBlank(org.apache.commons.lang3.StringUtils.isNotBlank) RdsConfigWithoutClusterService(com.sequenceiq.cloudbreak.service.rdsconfig.RdsConfigWithoutClusterService) StackUtil(com.sequenceiq.cloudbreak.util.StackUtil) MDCUtils(com.sequenceiq.cloudbreak.logger.MDCUtils) CloudbreakOrchestratorFailedException(com.sequenceiq.cloudbreak.orchestrator.exception.CloudbreakOrchestratorFailedException) CollectionUtils(org.springframework.util.CollectionUtils) GatewayConfig(com.sequenceiq.cloudbreak.orchestrator.model.GatewayConfig) ExposedServices(com.sequenceiq.cloudbreak.domain.stack.cluster.gateway.ExposedServices) CancellationException(com.sequenceiq.cloudbreak.cloud.scheduler.CancellationException) InstanceGroup(com.sequenceiq.cloudbreak.domain.stack.instance.InstanceGroup) StackService(com.sequenceiq.cloudbreak.service.stack.StackService) Joiner(com.google.common.base.Joiner) Stack(com.sequenceiq.cloudbreak.domain.stack.Stack) CMLicenseParser(com.sequenceiq.cloudbreak.auth.CMLicenseParser) OrchestratorGrainRunnerParams(com.sequenceiq.cloudbreak.orchestrator.host.OrchestratorGrainRunnerParams) HostGroupService(com.sequenceiq.cloudbreak.service.hostgroup.HostGroupService) StringUtils.isNotEmpty(org.apache.commons.lang3.StringUtils.isNotEmpty) ArrayList(java.util.ArrayList) Value(org.springframework.beans.factory.annotation.Value) CsdParcelDecorator(com.sequenceiq.cloudbreak.core.bootstrap.service.host.decorator.CsdParcelDecorator) KerberosDetailService(com.sequenceiq.cloudbreak.template.kerberos.KerberosDetailService) Lists(com.google.common.collect.Lists) KerberosType(com.sequenceiq.cloudbreak.type.KerberosType) LdapView(com.sequenceiq.cloudbreak.dto.LdapView) CMRepositoryVersionUtil.isVersionNewerOrEqualThanLimited(com.sequenceiq.cloudbreak.cmtemplate.CMRepositoryVersionUtil.isVersionNewerOrEqualThanLimited) ClusterComponentConfigProvider(com.sequenceiq.cloudbreak.cluster.service.ClusterComponentConfigProvider) NullUtil.throwIfNull(com.sequenceiq.cloudbreak.util.NullUtil.throwIfNull) DatabaseType(com.sequenceiq.cloudbreak.api.endpoint.v4.database.base.DatabaseType) DnsResolverType(com.sequenceiq.cloudbreak.domain.stack.DnsResolverType) ExitCriteriaModel(com.sequenceiq.cloudbreak.orchestrator.state.ExitCriteriaModel) IOException(java.io.IOException) PostgresConfigService(com.sequenceiq.cloudbreak.core.bootstrap.service.container.postgres.PostgresConfigService) ServiceLocationMap(com.sequenceiq.cloudbreak.cluster.model.ServiceLocationMap) ClusterDeletionBasedExitCriteriaModel(com.sequenceiq.cloudbreak.core.bootstrap.service.ClusterDeletionBasedExitCriteriaModel) GrpcUmsClient(com.sequenceiq.cloudbreak.auth.altus.GrpcUmsClient) HostGroup(com.sequenceiq.cloudbreak.domain.stack.cluster.host.HostGroup) GrainProperties(com.sequenceiq.cloudbreak.orchestrator.model.GrainProperties) InstanceMetaData(com.sequenceiq.cloudbreak.domain.stack.instance.InstanceMetaData) GatewayTopology(com.sequenceiq.cloudbreak.domain.stack.cluster.gateway.GatewayTopology) ComponentLocatorService(com.sequenceiq.cloudbreak.service.blueprint.ComponentLocatorService) InetAddresses(com.google.common.net.InetAddresses) NodesUnreachableException(com.sequenceiq.cloudbreak.util.NodesUnreachableException) SaltConfig(com.sequenceiq.cloudbreak.orchestrator.model.SaltConfig) GrainOperation(com.sequenceiq.cloudbreak.orchestrator.host.GrainOperation) EntitlementService(com.sequenceiq.cloudbreak.auth.altus.EntitlementService) CloudbreakOrchestratorCancelledException(com.sequenceiq.cloudbreak.orchestrator.exception.CloudbreakOrchestratorCancelledException) LoggerFactory(org.slf4j.LoggerFactory) LoadBalancerSANProvider(com.sequenceiq.cloudbreak.san.LoadBalancerSANProvider) InstanceGroupService(com.sequenceiq.cloudbreak.service.stack.InstanceGroupService) ClusterPreCreationApi(com.sequenceiq.cloudbreak.cluster.api.ClusterPreCreationApi) KerberosConfigService(com.sequenceiq.cloudbreak.kerberos.KerberosConfigService) ExposedServiceCollector(com.sequenceiq.cloudbreak.api.service.ExposedServiceCollector) Telemetry(com.sequenceiq.common.api.telemetry.model.Telemetry) NotFoundException(com.sequenceiq.cloudbreak.common.exception.NotFoundException) HostOrchestrator(com.sequenceiq.cloudbreak.orchestrator.host.HostOrchestrator) CLOUDERAMANAGER_VERSION_7_0_2(com.sequenceiq.cloudbreak.cmtemplate.CMRepositoryVersionUtil.CLOUDERAMANAGER_VERSION_7_0_2) SaltPillarProperties(com.sequenceiq.cloudbreak.orchestrator.model.SaltPillarProperties) DataBusCredential(com.sequenceiq.common.api.telemetry.model.DataBusCredential) StackTags(com.sequenceiq.cloudbreak.cloud.model.StackTags) ExposedService(com.sequenceiq.cloudbreak.api.service.ExposedService) Collectors(java.util.stream.Collectors) TemporaryStorage(com.sequenceiq.cloudbreak.common.type.TemporaryStorage) RegionAwareInternalCrnGeneratorFactory(com.sequenceiq.cloudbreak.auth.crn.RegionAwareInternalCrnGeneratorFactory) Json(com.sequenceiq.cloudbreak.common.json.Json) IdBrokerService(com.sequenceiq.cloudbreak.service.idbroker.IdBrokerService) GatewayConfigService(com.sequenceiq.cloudbreak.service.GatewayConfigService) ProxyConfigProvider(com.sequenceiq.cloudbreak.service.proxy.ProxyConfigProvider) List(java.util.List) VirtualGroupService(com.sequenceiq.cloudbreak.auth.altus.VirtualGroupService) RdsView(com.sequenceiq.cloudbreak.template.views.RdsView) Optional(java.util.Optional) SSOType(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.base.SSOType) Pattern(java.util.regex.Pattern) KerberosConfig(com.sequenceiq.cloudbreak.dto.KerberosConfig) Account(com.cloudera.thunderhead.service.usermanagement.UserManagementProto.Account) Cluster(com.sequenceiq.cloudbreak.domain.stack.cluster.Cluster) LoadBalancerConfigService(com.sequenceiq.cloudbreak.service.LoadBalancerConfigService) CMRepositoryVersionUtil(com.sequenceiq.cloudbreak.cmtemplate.CMRepositoryVersionUtil) IdBroker(com.sequenceiq.cloudbreak.domain.stack.cluster.IdBroker) LdapConfigService(com.sequenceiq.cloudbreak.ldap.LdapConfigService) HashMap(java.util.HashMap) FreeIpaConfigProvider(com.sequenceiq.cloudbreak.service.freeipa.FreeIpaConfigProvider) HashSet(java.util.HashSet) Inject(javax.inject.Inject) InstanceMetaDataService(com.sequenceiq.cloudbreak.service.stack.InstanceMetaDataService) Collections.singletonMap(java.util.Collections.singletonMap) RdsConfigWithoutCluster(com.sequenceiq.cloudbreak.domain.view.RdsConfigWithoutCluster) Nonnull(javax.annotation.Nonnull) TelemetryDecorator(com.sequenceiq.cloudbreak.core.bootstrap.service.host.decorator.TelemetryDecorator) ClusterDeletionBasedExitCriteriaModel.clusterDeletionBasedModel(com.sequenceiq.cloudbreak.core.bootstrap.service.ClusterDeletionBasedExitCriteriaModel.clusterDeletionBasedModel) Logger(org.slf4j.Logger) VirtualGroupRequest(com.sequenceiq.cloudbreak.auth.altus.VirtualGroupRequest) NodeReachabilityResult(com.sequenceiq.cloudbreak.orchestrator.model.NodeReachabilityResult) EnvironmentConfigProvider(com.sequenceiq.cloudbreak.service.environment.EnvironmentConfigProvider) Node(com.sequenceiq.cloudbreak.common.orchestration.Node) MountDisks(com.sequenceiq.cloudbreak.service.stack.flow.MountDisks) Component(org.springframework.stereotype.Component) UmsVirtualGroupRight(com.sequenceiq.cloudbreak.auth.altus.UmsVirtualGroupRight) ClusterApiConnectors(com.sequenceiq.cloudbreak.service.cluster.ClusterApiConnectors) CloudbreakServiceException(com.sequenceiq.cloudbreak.common.exception.CloudbreakServiceException) Comparator(java.util.Comparator) Collections(java.util.Collections) HashMap(java.util.HashMap) KerberosConfig(com.sequenceiq.cloudbreak.dto.KerberosConfig) SaltConfig(com.sequenceiq.cloudbreak.orchestrator.model.SaltConfig) ClusterPreCreationApi(com.sequenceiq.cloudbreak.cluster.api.ClusterPreCreationApi) LdapView(com.sequenceiq.cloudbreak.dto.LdapView) SaltPillarProperties(com.sequenceiq.cloudbreak.orchestrator.model.SaltPillarProperties) ClouderaManagerRepo(com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerRepo) VirtualGroupRequest(com.sequenceiq.cloudbreak.auth.altus.VirtualGroupRequest) ArrayList(java.util.ArrayList) List(java.util.List) Map(java.util.Map) ServiceLocationMap(com.sequenceiq.cloudbreak.cluster.model.ServiceLocationMap) HashMap(java.util.HashMap) Collections.singletonMap(java.util.Collections.singletonMap) GatewayConfig(com.sequenceiq.cloudbreak.orchestrator.model.GatewayConfig)

Example 20 with Stack

use of com.sequenceiq.cloudbreak.domain.stack.Stack in project cloudbreak by hortonworks.

the class AmbariClusterResetService method resetCluster.

public void resetCluster(Long stackId) throws CloudbreakOrchestratorException {
    Stack stack = stackService.getByIdWithListsInTransaction(stackId);
    InstanceMetaData gatewayInstance = stack.getPrimaryGatewayInstance();
    GatewayConfig gatewayConfig = gatewayConfigService.getGatewayConfig(stack, gatewayInstance, stack.getCluster().hasGateway());
    Set<String> gatewayFQDN = Collections.singleton(gatewayInstance.getDiscoveryFQDN());
    ExitCriteriaModel exitCriteriaModel = clusterDeletionBasedModel(stack.getId(), stack.getCluster().getId());
    hostOrchestrator.resetClusterManager(gatewayConfig, gatewayFQDN, stackUtil.collectNodes(stack), exitCriteriaModel);
}
Also used : InstanceMetaData(com.sequenceiq.cloudbreak.domain.stack.instance.InstanceMetaData) ExitCriteriaModel(com.sequenceiq.cloudbreak.orchestrator.state.ExitCriteriaModel) Stack(com.sequenceiq.cloudbreak.domain.stack.Stack) GatewayConfig(com.sequenceiq.cloudbreak.orchestrator.model.GatewayConfig)

Aggregations

Stack (com.sequenceiq.cloudbreak.domain.stack.Stack)1041 Test (org.junit.jupiter.api.Test)326 Cluster (com.sequenceiq.cloudbreak.domain.stack.cluster.Cluster)255 Test (org.junit.Test)208 InstanceMetaData (com.sequenceiq.cloudbreak.domain.stack.instance.InstanceMetaData)158 Map (java.util.Map)114 DetailedEnvironmentResponse (com.sequenceiq.environment.api.v1.environment.model.response.DetailedEnvironmentResponse)113 InstanceGroup (com.sequenceiq.cloudbreak.domain.stack.instance.InstanceGroup)112 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)111 List (java.util.List)101 Set (java.util.Set)101 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)100 Collectors (java.util.stream.Collectors)84 Optional (java.util.Optional)83 HashSet (java.util.HashSet)82 Inject (javax.inject.Inject)80 Logger (org.slf4j.Logger)78 LoggerFactory (org.slf4j.LoggerFactory)78 DetailedStackStatus (com.sequenceiq.cloudbreak.api.endpoint.v4.common.DetailedStackStatus)69 StackStatus (com.sequenceiq.cloudbreak.domain.stack.StackStatus)67