Search in sources :

Example 6 with ApiClusterTemplateVariable

use of com.cloudera.api.swagger.model.ApiClusterTemplateVariable in project cloudbreak by hortonworks.

the class HueConfigProvider method getServiceConfigVariables.

@Override
public List<ApiClusterTemplateVariable> getServiceConfigVariables(TemplatePreparationObject source) {
    List<ApiClusterTemplateVariable> result = new ArrayList<>();
    RdsView hueRdsView = getRdsView(source);
    result.add(new ApiClusterTemplateVariable().name(HUE_DATABASE_HOST).value(hueRdsView.getHost()));
    result.add(new ApiClusterTemplateVariable().name(HUE_DATABASE_PORT).value(hueRdsView.getPort()));
    result.add(new ApiClusterTemplateVariable().name(HUE_DATABASE_NAME).value(hueRdsView.getDatabaseName()));
    result.add(new ApiClusterTemplateVariable().name(HUE_HUE_DATABASE_TYPE).value(hueRdsView.getSubprotocol()));
    result.add(new ApiClusterTemplateVariable().name(HUE_HUE_DATABASE_USER).value(hueRdsView.getConnectionUserName()));
    result.add(new ApiClusterTemplateVariable().name(HUE_DATABASE_PASSWORD).value(hueRdsView.getConnectionPassword()));
    configureKnoxProxyHostsConfigVariables(source, result);
    return result;
}
Also used : RdsView(com.sequenceiq.cloudbreak.template.views.RdsView) ArrayList(java.util.ArrayList) ApiClusterTemplateVariable(com.cloudera.api.swagger.model.ApiClusterTemplateVariable)

Example 7 with ApiClusterTemplateVariable

use of com.cloudera.api.swagger.model.ApiClusterTemplateVariable 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

ApiClusterTemplateVariable (com.cloudera.api.swagger.model.ApiClusterTemplateVariable)7 RDSConfig (com.sequenceiq.cloudbreak.domain.RDSConfig)5 TemplatePreparationObject (com.sequenceiq.cloudbreak.template.TemplatePreparationObject)5 Builder (com.sequenceiq.cloudbreak.template.TemplatePreparationObject.Builder)5 GeneralClusterConfigs (com.sequenceiq.cloudbreak.template.model.GeneralClusterConfigs)5 BlueprintView (com.sequenceiq.cloudbreak.template.views.BlueprintView)5 HashSet (java.util.HashSet)5 Test (org.junit.Test)5 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)5 Gateway (com.sequenceiq.cloudbreak.domain.stack.cluster.gateway.Gateway)4 CmTemplateProcessor (com.sequenceiq.cloudbreak.cmtemplate.CmTemplateProcessor)1 GatewayView (com.sequenceiq.cloudbreak.template.views.GatewayView)1 RdsView (com.sequenceiq.cloudbreak.template.views.RdsView)1 ArrayList (java.util.ArrayList)1