use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.StackV4Request in project cloudbreak by hortonworks.
the class GatewayManifester method configureGatewayForSdxCluster.
public StackV4Request configureGatewayForSdxCluster(StackV4Request stackV4Request) {
if (stackV4Request.getCluster().getGateway() == null) {
GatewayV4Request gatewayV4Request = new GatewayV4Request();
gatewayV4Request.setTopologies(List.of(getGatewayTopologyV4Request()));
gatewayV4Request.setSsoType(defaultSsoType);
stackV4Request.getCluster().setGateway(gatewayV4Request);
LOGGER.info("Configured gateway for SDX {}", stackV4Request.getName());
}
return stackV4Request;
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.StackV4Request in project cloudbreak by hortonworks.
the class StackV4RequestToStackConverter method setInstanceGroupNetworkIfApplicable.
private void setInstanceGroupNetworkIfApplicable(StackV4Request source, Stack stack, DetailedEnvironmentResponse environment) {
String subnetId = getStackSubnetIdIfExists(stack);
List<InstanceGroupV4Request> instanceGroups = source.getInstanceGroups();
for (InstanceGroupV4Request instanceGroup : instanceGroups) {
if (instanceGroup.getNetwork() == null) {
InstanceGroupNetworkV4Request instanceGroupNetworkV4Request = new InstanceGroupNetworkV4Request();
setNetworkByProvider(source, instanceGroup, instanceGroupNetworkV4Request, subnetId);
}
setupEndpointGatewayNetwork(instanceGroup.getNetwork(), stack, instanceGroup.getName(), environment);
}
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.StackV4Request in project cloudbreak by hortonworks.
the class ClusterTemplateToClusterTemplateV4ResponseConverter method convert.
public ClusterTemplateV4Response convert(ClusterTemplate source) {
ClusterTemplateV4Response clusterTemplateV4Response = new ClusterTemplateV4Response();
clusterTemplateV4Response.setName(source.getName());
clusterTemplateV4Response.setDescription(source.getDescription());
if (source.getStatus().isNonDefault()) {
Optional<Stack> stack = stackTemplateService.getByIdWithLists(source.getStackTemplate().getId());
if (stack.isPresent()) {
StackV4Request stackV4Request;
try {
stackV4Request = stackToStackV4RequestConverter.convert(stack.get());
} catch (Exception e) {
stackV4Request = null;
}
clusterTemplateV4Response.setDistroXTemplate(getIfNotNull(stackV4Request, stackV4RequestConverter::convert));
clusterTemplateV4Response.setNodeCount(stack.get().getFullNodeCount());
}
} else {
try {
DefaultClusterTemplateV4Request clusterTemplateV4Request = new Json(getTemplateString(source)).get(DefaultClusterTemplateV4Request.class);
clusterTemplateV4Response.setDistroXTemplate(clusterTemplateV4Request.getDistroXTemplate());
clusterTemplateV4Response.setNodeCount(getFullNodeCount(clusterTemplateV4Request.getDistroXTemplate()));
} catch (IOException e) {
LOGGER.info("There is no Data Hub template (stack entity missing) for cluster defintion {}", source.getName());
clusterTemplateV4Response.setDistroXTemplate(null);
}
}
clusterTemplateV4Response.setCloudPlatform(source.getCloudPlatform());
clusterTemplateV4Response.setStatus(source.getStatus());
clusterTemplateV4Response.setId(source.getId());
clusterTemplateV4Response.setDatalakeRequired(source.getDatalakeRequired());
clusterTemplateV4Response.setCrn(source.getResourceCrn());
clusterTemplateV4Response.setStatus(source.getStatus());
clusterTemplateV4Response.setType(source.getType());
clusterTemplateV4Response.setFeatureState(source.getFeatureState());
if (source.getStackTemplate() != null) {
Stack stackTemplate = source.getStackTemplate();
if (stackTemplate.getEnvironmentCrn() != null) {
clusterTemplateV4Response.setEnvironmentCrn(stackTemplate.getEnvironmentCrn());
}
if (source.getStackTemplate().getCluster() != null && source.getStackTemplate().getCluster().getBlueprint() != null) {
clusterTemplateV4Response.setStackType(source.getStackTemplate().getCluster().getBlueprint().getStackType());
clusterTemplateV4Response.setStackVersion(source.getStackTemplate().getCluster().getBlueprint().getStackVersion());
}
} else {
clusterTemplateV4Response.setStackType("CDH");
clusterTemplateV4Response.setStackVersion(source.getClouderaRuntimeVersion());
}
clusterTemplateV4Response.setCreated(source.getCreated());
return clusterTemplateV4Response;
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.StackV4Request in project cloudbreak by hortonworks.
the class ClusterTemplateToDefaultClusterTemplateV4Request method convert.
public DefaultClusterTemplateV4Request convert(ClusterTemplate source) {
DefaultClusterTemplateV4Request ret = new DefaultClusterTemplateV4Request();
ret.setCloudPlatform(source.getCloudPlatform());
ret.setDatalakeRequired(source.getDatalakeRequired());
ret.setDescription(source.getDescription());
ret.setName(source.getName());
ret.setType(source.getType());
StackV4Request stackV4Request = stackToStackV4RequestConverter.convert(source.getStackTemplate());
ret.setDistroXTemplate(stackV4RequestConverter.convert(stackV4Request));
return ret;
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.StackV4Request in project cloudbreak by hortonworks.
the class LoadBalancerConfigServiceTest method testCreateLoadBalancersForEndpointGatewayDatalake.
@Test
public void testCreateLoadBalancersForEndpointGatewayDatalake() {
Stack stack = createAwsStack(StackType.DATALAKE, PRIVATE_ID_1);
CloudSubnet subnet = getPrivateCloudSubnet(PRIVATE_ID_1, AZ_1);
DetailedEnvironmentResponse environment = createEnvironment(subnet, true, "AWS");
StackV4Request request = new StackV4Request();
request.setEnableLoadBalancer(false);
when(blueprint.getBlueprintText()).thenReturn(getBlueprintText("input/clouderamanager-knox.bp"));
when(subnetSelector.findSubnetById(any(), anyString())).thenReturn(Optional.of(subnet));
ThreadBasedUserCrnProvider.doAs(USER_CRN, () -> {
Set<LoadBalancer> loadBalancers = underTest.createLoadBalancers(stack, environment, request);
assertEquals(2, loadBalancers.size());
assert loadBalancers.stream().anyMatch(l -> LoadBalancerType.PRIVATE.equals(l.getType()));
assert loadBalancers.stream().anyMatch(l -> LoadBalancerType.PUBLIC.equals(l.getType()));
});
}
Aggregations