use of com.sequenceiq.cloudbreak.template.model.GeneralClusterConfigs in project cloudbreak by hortonworks.
the class RangerUserSyncRoleConfigProviderTest method testAzureWhenCmVersionIs728ShouldReturnWithRangerAsSysAdmin.
@Test
public void testAzureWhenCmVersionIs728ShouldReturnWithRangerAsSysAdmin() {
GeneralClusterConfigs generalClusterConfigs = new GeneralClusterConfigs();
generalClusterConfigs.setEnableRangerRaz(false);
TemplatePreparationObject preparationObject = TemplatePreparationObject.Builder.builder().withCloudPlatform(CloudPlatform.AZURE).withProductDetails(new ClouderaManagerRepo().withVersion("7.2.8"), new ArrayList<>()).withServicePrincipals(null).withGeneralClusterConfigs(generalClusterConfigs).build();
List<ApiClusterTemplateConfig> serviceConfigs = underTest.getRoleConfigs(RANGER_USERSYNC, preparationObject);
assertEquals(2, serviceConfigs.size());
assertEquals("conf/ranger-ugsync-site.xml_role_safety_valve", serviceConfigs.get(0).getName());
assertEquals("<property><name>ranger.usersync.unix.backend</name><value>nss</value></property>", serviceConfigs.get(0).getValue());
assertEquals("ranger.usersync.group.based.role.assignment.rules", serviceConfigs.get(1).getName());
assertEquals("&ROLE_SYS_ADMIN:g:mockAdmin&ROLE_SYS_ADMIN:u:ranger", serviceConfigs.get(1).getValue());
}
use of com.sequenceiq.cloudbreak.template.model.GeneralClusterConfigs in project cloudbreak by hortonworks.
the class RangerUserSyncRoleConfigProviderTest method testAwsWhenCmVersionIs728ShouldReturnWithRangerAsSysAdmin.
@Test
public void testAwsWhenCmVersionIs728ShouldReturnWithRangerAsSysAdmin() {
TemplatePreparationObject preparationObject = TemplatePreparationObject.Builder.builder().withCloudPlatform(CloudPlatform.AWS).withServicePrincipals(null).withProductDetails(new ClouderaManagerRepo().withVersion("7.2.8"), new ArrayList<>()).withGeneralClusterConfigs(new GeneralClusterConfigs()).build();
List<ApiClusterTemplateConfig> serviceConfigs = underTest.getRoleConfigs(RANGER_USERSYNC, preparationObject);
assertEquals(2, serviceConfigs.size());
assertEquals("conf/ranger-ugsync-site.xml_role_safety_valve", serviceConfigs.get(0).getName());
assertEquals("<property><name>ranger.usersync.unix.backend</name><value>nss</value></property>", serviceConfigs.get(0).getValue());
assertEquals("ranger.usersync.group.based.role.assignment.rules", serviceConfigs.get(1).getName());
assertEquals("&ROLE_SYS_ADMIN:g:mockAdmin&ROLE_SYS_ADMIN:u:ranger", serviceConfigs.get(1).getValue());
}
use of com.sequenceiq.cloudbreak.template.model.GeneralClusterConfigs in project cloudbreak by hortonworks.
the class RangerRazBaseConfigProviderTest method getServiceTypesConfigWheAGCPAnd7210ShouldNOTAddProperty.
@Test
public void getServiceTypesConfigWheAGCPAnd7210ShouldNOTAddProperty() {
BlueprintTextProcessor blueprintTextProcessor = mock(BlueprintTextProcessor.class);
when(blueprintTextProcessor.getVersion()).thenReturn(Optional.of("7.2.10"));
TemplatePreparationObject preparationObject = TemplatePreparationObject.Builder.builder().withStackType(StackType.WORKLOAD).withBlueprintView(new BlueprintView("", "7.2.10", "CDH", blueprintTextProcessor)).withCloudPlatform(CloudPlatform.GCP).withGeneralClusterConfigs(new GeneralClusterConfigs()).withDataLakeView(new DatalakeView(false)).build();
List<ApiClusterTemplateConfig> roleConfigs = underTest.getRoleConfigs("", preparationObject);
assertEquals(0, roleConfigs.size());
}
use of com.sequenceiq.cloudbreak.template.model.GeneralClusterConfigs in project cloudbreak by hortonworks.
the class GeneralClusterConfigsProvider method generalClusterConfigs.
public GeneralClusterConfigs generalClusterConfigs(StackV4Request stack, String email, String clusterVariant) {
boolean gatewayInstanceMetadataPresented = false;
int nodeCount = 0;
for (InstanceGroupV4Request instanceGroup : stack.getInstanceGroups()) {
nodeCount += instanceGroup.getNodeCount();
}
GeneralClusterConfigs generalClusterConfigs = new GeneralClusterConfigs();
generalClusterConfigs.setIdentityUserEmail(email);
generalClusterConfigs.setClusterManagerIp(PENDING_DEFAULT_VALUE);
generalClusterConfigs.setInstanceGroupsPresented(false);
generalClusterConfigs.setPassword(stack.getCluster().getPassword());
if (stack.getCluster().getGateway() != null) {
gatewayInstanceMetadataPresented = true;
}
generalClusterConfigs.setGatewayInstanceMetadataPresented(gatewayInstanceMetadataPresented);
generalClusterConfigs.setClusterName(stack.getName());
generalClusterConfigs.setStackName(stack.getName());
generalClusterConfigs.setUuid(PENDING_DEFAULT_VALUE);
generalClusterConfigs.setUserName(stack.getCluster().getUserName());
generalClusterConfigs.setNodeCount(nodeCount);
generalClusterConfigs.setPrimaryGatewayInstanceDiscoveryFQDN(Optional.of(PENDING_DEFAULT_VALUE));
generalClusterConfigs.setVariant(clusterVariant);
Boolean autoTlsEnabled = Optional.ofNullable(stack.getCluster().getCm()).map(ClouderaManagerV4Request::getEnableAutoTls).orElse(Boolean.FALSE);
generalClusterConfigs.setAutoTlsEnabled(autoTlsEnabled);
return generalClusterConfigs;
}
use of com.sequenceiq.cloudbreak.template.model.GeneralClusterConfigs in project cloudbreak by hortonworks.
the class KnoxGatewayConfigProvider method getRoleConfigs.
@Override
protected List<ApiClusterTemplateConfig> getRoleConfigs(String roleType, TemplatePreparationObject source) {
GatewayView gateway = source.getGatewayView();
GeneralClusterConfigs generalClusterConfigs = source.getGeneralClusterConfigs();
String masterSecret = gateway != null ? gateway.getMasterSecret() : generalClusterConfigs.getPassword();
String topologyName = gateway != null && gateway.getExposedServices() != null ? gateway.getTopologyName() : DEFAULT_TOPOLOGY;
VirtualGroupRequest virtualGroupRequest = source.getVirtualGroupRequest();
String adminGroup = virtualGroupService.createOrGetVirtualGroup(virtualGroupRequest, UmsVirtualGroupRight.KNOX_ADMIN);
switch(roleType) {
case KnoxRoles.KNOX_GATEWAY:
List<ApiClusterTemplateConfig> config = new ArrayList<>();
config.add(config(KNOX_MASTER_SECRET, masterSecret));
config.add(config(GATEWAY_DEFAULT_TOPOLOGY_NAME, topologyName));
config.add(config(GATEWAY_ADMIN_GROUPS, adminGroup));
config.add(config(GATEWAY_CM_AUTO_DISCOVERY_ENABLED, "false"));
if (gateway != null) {
config.add(config(GATEWAY_PATH, gateway.getPath()));
config.add(config(GATEWAY_SIGNING_KEYSTORE_NAME, SIGNING_JKS));
config.add(config(GATEWAY_SIGNING_KEYSTORE_TYPE, JKS));
config.add(config(GATEWAY_SIGNING_KEY_ALIAS, SIGNING_IDENTITY));
config.add(getGatewayWhitelistConfig(source));
config.addAll(getDefaultsIfRequired(source));
}
if (source.getProductDetailsView() != null && isKnoxDatabaseSupported(source.getProductDetailsView().getCm(), getCdhProduct(source), getCdhPatchVersion(source))) {
config.add(config(GATEWAY_SERVICE_TOKENSTATE_IMPL, "org.apache.knox.gateway.services.token.impl.JDBCTokenStateService"));
}
return config;
case KnoxRoles.IDBROKER:
return List.of(config(IDBROKER_MASTER_SECRET, source.getIdBroker().getMasterSecret()), config(IDBROKER_GATEWAY_ADMIN_GROUPS, adminGroup), config(IDBROKER_SIGNING_KEYSTORE_NAME, SIGNING_JKS), config(IDBROKER_SIGNING_KEYSTORE_TYPE, JKS), config(IDBROKER_SIGNING_KEY_ALIAS, SIGNING_IDENTITY));
default:
return List.of();
}
}
Aggregations