Search in sources :

Example 1 with CLOUDERA_STACK_VERSION_7_2_11

use of com.sequenceiq.cloudbreak.cmtemplate.CMRepositoryVersionUtil.CLOUDERA_STACK_VERSION_7_2_11 in project cloudbreak by hortonworks.

the class LoadBalancerConfigService method getOozieHAInstanceGroup.

private Optional<InstanceGroup> getOozieHAInstanceGroup(Stack stack) {
    Cluster cluster = stack.getCluster();
    if (cluster != null) {
        CmTemplateProcessor cmTemplateProcessor = new CmTemplateProcessor(cluster.getBlueprint().getBlueprintText());
        String cdhVersion = cmTemplateProcessor.getStackVersion();
        if (cdhVersion != null && isVersionNewerOrEqualThanLimited(cdhVersion, CLOUDERA_STACK_VERSION_7_2_11)) {
            Set<String> oozieGroupNames = getOozieGroups(cmTemplateProcessor);
            return stack.getInstanceGroups().stream().filter(ig -> oozieGroupNames.contains(ig.getGroupName())).filter(ig -> ig.getNodeCount() > 1).findFirst();
        }
    }
    return Optional.empty();
}
Also used : Arrays(java.util.Arrays) EntitlementService(com.sequenceiq.cloudbreak.auth.altus.EntitlementService) LoggerFactory(org.slf4j.LoggerFactory) StringUtils(org.apache.commons.lang3.StringUtils) OozieRoles(com.sequenceiq.cloudbreak.cmtemplate.configproviders.oozie.OozieRoles) ThreadBasedUserCrnProvider(com.sequenceiq.cloudbreak.auth.ThreadBasedUserCrnProvider) LoadBalancer(com.sequenceiq.cloudbreak.domain.stack.loadbalancer.LoadBalancer) ProviderParameterCalculator(com.sequenceiq.cloudbreak.common.mappable.ProviderParameterCalculator) PublicEndpointAccessGateway(com.sequenceiq.common.api.type.PublicEndpointAccessGateway) Map(java.util.Map) DetailedEnvironmentResponse(com.sequenceiq.environment.api.v1.environment.model.response.DetailedEnvironmentResponse) SubnetSelector(com.sequenceiq.cloudbreak.converter.v4.environment.network.SubnetSelector) AzureStackV4Parameters(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.base.parameter.stack.AzureStackV4Parameters) LoadBalancerPersistenceService(com.sequenceiq.cloudbreak.service.stack.LoadBalancerPersistenceService) Set(java.util.Set) LoadBalancerSku(com.sequenceiq.common.api.type.LoadBalancerSku) Collectors(java.util.stream.Collectors) KnoxRoles(com.sequenceiq.cloudbreak.cmtemplate.configproviders.knox.KnoxRoles) Json(com.sequenceiq.cloudbreak.common.json.Json) List(java.util.List) Optional(java.util.Optional) GCP(com.sequenceiq.cloudbreak.common.mappable.CloudPlatform.GCP) CmTemplateProcessor(com.sequenceiq.cloudbreak.cmtemplate.CmTemplateProcessor) CLOUDERA_STACK_VERSION_7_2_11(com.sequenceiq.cloudbreak.cmtemplate.CMRepositoryVersionUtil.CLOUDERA_STACK_VERSION_7_2_11) OOZIE_HTTPS_PORT(com.sequenceiq.cloudbreak.cmtemplate.configproviders.oozie.OozieHAConfigProvider.OOZIE_HTTPS_PORT) NetworkConstants(com.sequenceiq.cloudbreak.common.network.NetworkConstants) InstanceGroup(com.sequenceiq.cloudbreak.domain.stack.instance.InstanceGroup) Stack(com.sequenceiq.cloudbreak.domain.stack.Stack) Cluster(com.sequenceiq.cloudbreak.domain.stack.cluster.Cluster) TargetGroupPortPair(com.sequenceiq.cloudbreak.cloud.model.TargetGroupPortPair) TargetGroup(com.sequenceiq.cloudbreak.domain.stack.loadbalancer.TargetGroup) Network(com.sequenceiq.cloudbreak.domain.Network) EnvironmentNetworkResponse(com.sequenceiq.environment.api.v1.environment.model.response.EnvironmentNetworkResponse) CloudPlatform(com.sequenceiq.cloudbreak.common.mappable.CloudPlatform) LoadBalancerType(com.sequenceiq.common.api.type.LoadBalancerType) HashSet(java.util.HashSet) Inject(javax.inject.Inject) Value(org.springframework.beans.factory.annotation.Value) AWS(com.sequenceiq.cloudbreak.common.mappable.CloudPlatform.AWS) Service(org.springframework.stereotype.Service) CMRepositoryVersionUtil.isVersionNewerOrEqualThanLimited(com.sequenceiq.cloudbreak.cmtemplate.CMRepositoryVersionUtil.isVersionNewerOrEqualThanLimited) NetworkV4Base(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.base.NetworkV4Base) Map.entry(java.util.Map.entry) AzureInstanceGroupParameters(com.sequenceiq.cloudbreak.cloud.model.instance.AzureInstanceGroupParameters) LoadBalancerCreation(com.sequenceiq.common.api.type.LoadBalancerCreation) CloudSubnet(com.sequenceiq.cloudbreak.cloud.model.CloudSubnet) Logger(org.slf4j.Logger) AvailabilitySetNameService(com.sequenceiq.cloudbreak.cloud.model.instance.AvailabilitySetNameService) TargetGroupType(com.sequenceiq.common.api.type.TargetGroupType) InstanceGroupType(com.sequenceiq.common.api.type.InstanceGroupType) StackV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.StackV4Request) CloudbreakServiceException(com.sequenceiq.cloudbreak.common.exception.CloudbreakServiceException) StackType(com.sequenceiq.cloudbreak.api.endpoint.v4.common.StackType) Preconditions(com.google.common.base.Preconditions) AZURE(com.sequenceiq.cloudbreak.common.mappable.CloudPlatform.AZURE) Collections(java.util.Collections) Cluster(com.sequenceiq.cloudbreak.domain.stack.cluster.Cluster) CmTemplateProcessor(com.sequenceiq.cloudbreak.cmtemplate.CmTemplateProcessor)

Aggregations

Preconditions (com.google.common.base.Preconditions)1 StackType (com.sequenceiq.cloudbreak.api.endpoint.v4.common.StackType)1 NetworkV4Base (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.base.NetworkV4Base)1 AzureStackV4Parameters (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.base.parameter.stack.AzureStackV4Parameters)1 StackV4Request (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.StackV4Request)1 ThreadBasedUserCrnProvider (com.sequenceiq.cloudbreak.auth.ThreadBasedUserCrnProvider)1 EntitlementService (com.sequenceiq.cloudbreak.auth.altus.EntitlementService)1 CloudSubnet (com.sequenceiq.cloudbreak.cloud.model.CloudSubnet)1 TargetGroupPortPair (com.sequenceiq.cloudbreak.cloud.model.TargetGroupPortPair)1 AvailabilitySetNameService (com.sequenceiq.cloudbreak.cloud.model.instance.AvailabilitySetNameService)1 AzureInstanceGroupParameters (com.sequenceiq.cloudbreak.cloud.model.instance.AzureInstanceGroupParameters)1 CLOUDERA_STACK_VERSION_7_2_11 (com.sequenceiq.cloudbreak.cmtemplate.CMRepositoryVersionUtil.CLOUDERA_STACK_VERSION_7_2_11)1 CMRepositoryVersionUtil.isVersionNewerOrEqualThanLimited (com.sequenceiq.cloudbreak.cmtemplate.CMRepositoryVersionUtil.isVersionNewerOrEqualThanLimited)1 CmTemplateProcessor (com.sequenceiq.cloudbreak.cmtemplate.CmTemplateProcessor)1 KnoxRoles (com.sequenceiq.cloudbreak.cmtemplate.configproviders.knox.KnoxRoles)1 OOZIE_HTTPS_PORT (com.sequenceiq.cloudbreak.cmtemplate.configproviders.oozie.OozieHAConfigProvider.OOZIE_HTTPS_PORT)1 OozieRoles (com.sequenceiq.cloudbreak.cmtemplate.configproviders.oozie.OozieRoles)1 CloudbreakServiceException (com.sequenceiq.cloudbreak.common.exception.CloudbreakServiceException)1 Json (com.sequenceiq.cloudbreak.common.json.Json)1 CloudPlatform (com.sequenceiq.cloudbreak.common.mappable.CloudPlatform)1