Search in sources :

Example 66 with GeneralClusterConfigs

use of com.sequenceiq.cloudbreak.template.model.GeneralClusterConfigs in project cloudbreak by hortonworks.

the class HueConfigProvider method configureKnoxProxyHostsServiceConfig.

private void configureKnoxProxyHostsServiceConfig(TemplatePreparationObject source, List<ApiClusterTemplateConfig> result) {
    GatewayView gateway = source.getGatewayView();
    String cdhVersion = getCdhVersionString(source);
    GeneralClusterConfigs generalClusterConfigs = source.getGeneralClusterConfigs();
    if (externalFQDNShouldConfigured(gateway, generalClusterConfigs)) {
        // CDPD version 7.1.0 and above have a dedicated knox_proxyhosts property to set the knox proxy hosts.
        if (isVersionNewerOrEqualThanLimited(cdhVersion, CLOUDERAMANAGER_VERSION_7_1_0)) {
            result.add(new ApiClusterTemplateConfig().name(KNOX_PROXYHOSTS).variable(HUE_KNOX_PROXYHOSTS));
        } else {
            result.add(new ApiClusterTemplateConfig().name("hue_service_safety_valve").variable(HUE_SAFETY_VALVE));
        }
    }
}
Also used : GeneralClusterConfigs(com.sequenceiq.cloudbreak.template.model.GeneralClusterConfigs) ApiClusterTemplateConfig(com.cloudera.api.swagger.model.ApiClusterTemplateConfig) GatewayView(com.sequenceiq.cloudbreak.template.views.GatewayView)

Example 67 with GeneralClusterConfigs

use of com.sequenceiq.cloudbreak.template.model.GeneralClusterConfigs in project cloudbreak by hortonworks.

the class HueConfigProvider method configureKnoxProxyHostsConfigVariables.

private void configureKnoxProxyHostsConfigVariables(TemplatePreparationObject source, List<ApiClusterTemplateVariable> result) {
    GatewayView gateway = source.getGatewayView();
    String cdhVersion = getCdhVersionString(source);
    GeneralClusterConfigs generalClusterConfigs = source.getGeneralClusterConfigs();
    if (externalFQDNShouldConfigured(gateway, generalClusterConfigs)) {
        Set<String> proxyHosts = new HashSet<>();
        if (generalClusterConfigs.getPrimaryGatewayInstanceDiscoveryFQDN().isPresent()) {
            proxyHosts.add(generalClusterConfigs.getPrimaryGatewayInstanceDiscoveryFQDN().get());
        }
        if (StringUtils.isNotEmpty(generalClusterConfigs.getExternalFQDN())) {
            proxyHosts.add(generalClusterConfigs.getExternalFQDN());
        }
        if (generalClusterConfigs.getLoadBalancerGatewayFqdn().isPresent()) {
            proxyHosts.add(generalClusterConfigs.getLoadBalancerGatewayFqdn().get());
        }
        if (!proxyHosts.isEmpty()) {
            String proxyHostsString = String.join(",", proxyHosts);
            if (isVersionNewerOrEqualThanLimited(cdhVersion, CLOUDERAMANAGER_VERSION_7_1_0)) {
                LOGGER.debug("Using {} settings of [{}]", HUE_KNOX_PROXYHOSTS, proxyHostsString);
                result.add(new ApiClusterTemplateVariable().name(HUE_KNOX_PROXYHOSTS).value(proxyHostsString));
            } else {
                LOGGER.debug("Adding knox proxy hosts [{}] to {}", proxyHostsString, HUE_SAFETY_VALVE);
                String valveValue = SAFETY_VALVE_KNOX_PROXYHOSTS_KEY_PATTERN.concat(proxyHostsString);
                result.add(new ApiClusterTemplateVariable().name(HUE_SAFETY_VALVE).value(valveValue));
            }
        }
    }
}
Also used : GeneralClusterConfigs(com.sequenceiq.cloudbreak.template.model.GeneralClusterConfigs) ApiClusterTemplateVariable(com.cloudera.api.swagger.model.ApiClusterTemplateVariable) GatewayView(com.sequenceiq.cloudbreak.template.views.GatewayView) HashSet(java.util.HashSet)

Aggregations

GeneralClusterConfigs (com.sequenceiq.cloudbreak.template.model.GeneralClusterConfigs)67 TemplatePreparationObject (com.sequenceiq.cloudbreak.template.TemplatePreparationObject)52 ClouderaManagerRepo (com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerRepo)28 HostgroupView (com.sequenceiq.cloudbreak.template.views.HostgroupView)21 Test (org.junit.jupiter.api.Test)20 BlueprintView (com.sequenceiq.cloudbreak.template.views.BlueprintView)19 Test (org.junit.Test)18 ApiClusterTemplateService (com.cloudera.api.swagger.model.ApiClusterTemplateService)16 DisplayName (org.junit.jupiter.api.DisplayName)16 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)16 ApiClusterTemplateConfig (com.cloudera.api.swagger.model.ApiClusterTemplateConfig)15 MethodSource (org.junit.jupiter.params.provider.MethodSource)13 DatalakeView (com.sequenceiq.cloudbreak.template.views.DatalakeView)12 BlueprintTextProcessor (com.sequenceiq.cloudbreak.template.processor.BlueprintTextProcessor)11 Gateway (com.sequenceiq.cloudbreak.domain.stack.cluster.gateway.Gateway)10 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)10 HashSet (java.util.HashSet)8 VirtualGroupRequest (com.sequenceiq.cloudbreak.auth.altus.VirtualGroupRequest)7 ArrayList (java.util.ArrayList)7 HostsResourceApi (com.cloudera.api.swagger.HostsResourceApi)6