Search in sources :

Example 1 with LoadBalancerSku

use of com.sequenceiq.common.api.type.LoadBalancerSku in project cloudbreak by hortonworks.

the class LoadBalancerConfigService method createLoadBalancers.

public Set<LoadBalancer> createLoadBalancers(Stack stack, DetailedEnvironmentResponse environment, StackV4Request source) {
    LoadBalancerSku sku = getLoadBalancerSku(source);
    boolean azureLoadBalancerDisabled = CloudPlatform.AZURE.toString().equalsIgnoreCase(stack.getCloudPlatform()) && LoadBalancerSku.NONE.equals(sku);
    if (azureLoadBalancerDisabled) {
        Optional<TargetGroup> oozieTargetGroup = setupOozieHATargetGroup(stack, true);
        if (oozieTargetGroup.isPresent()) {
            throw new CloudbreakServiceException("Unsupported setup: Load balancers are disabled, but Oozie HA is configured. " + "Either enable Azure load balancers, or use a non-HA Oozie setup.");
        }
        LOGGER.debug("Azure load balancers have been explicitly disabled.");
        return Collections.emptySet();
    }
    boolean loadBalancerFlagEnabled = source != null && source.isEnableLoadBalancer();
    Set<LoadBalancer> loadBalancers = setupLoadBalancers(stack, environment, false, loadBalancerFlagEnabled, sku);
    if (stack.getCloudPlatform().equalsIgnoreCase(CloudPlatform.AZURE.toString())) {
        configureLoadBalancerAvailabilitySets(stack.getName(), loadBalancers);
        configureLoadBalancerSku(source, loadBalancers);
    }
    return loadBalancers;
}
Also used : LoadBalancerSku(com.sequenceiq.common.api.type.LoadBalancerSku) CloudbreakServiceException(com.sequenceiq.cloudbreak.common.exception.CloudbreakServiceException) TargetGroup(com.sequenceiq.cloudbreak.domain.stack.loadbalancer.TargetGroup) LoadBalancer(com.sequenceiq.cloudbreak.domain.stack.loadbalancer.LoadBalancer)

Aggregations

CloudbreakServiceException (com.sequenceiq.cloudbreak.common.exception.CloudbreakServiceException)1 LoadBalancer (com.sequenceiq.cloudbreak.domain.stack.loadbalancer.LoadBalancer)1 TargetGroup (com.sequenceiq.cloudbreak.domain.stack.loadbalancer.TargetGroup)1 LoadBalancerSku (com.sequenceiq.common.api.type.LoadBalancerSku)1