use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.base.parameter.stack.AzureStackV4Parameters in project cloudbreak by hortonworks.
the class DistroXParameterConverter method convert.
public AzureStackV4Parameters convert(AzureDistroXV1Parameters source) {
AzureStackV4Parameters response = new AzureStackV4Parameters();
response.setEncryptStorage(source.isEncryptStorage());
response.setResourceGroupName(source.getResourceGroupName());
response.setLoadBalancerSku(source.getLoadBalancerSku());
return response;
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.base.parameter.stack.AzureStackV4Parameters in project cloudbreak by hortonworks.
the class LoadBalancerConfigServiceTest method testCreateAzureLoadBalancerWithSkuSetToStandard.
@Test
public void testCreateAzureLoadBalancerWithSkuSetToStandard() {
Stack stack = createAzureStack(StackType.DATALAKE, PRIVATE_ID_1, true);
CloudSubnet subnet = getPrivateCloudSubnet(PRIVATE_ID_1, AZ_1);
DetailedEnvironmentResponse environment = createEnvironment(subnet, false, "AZURE");
AzureStackV4Parameters azureParameters = new AzureStackV4Parameters();
azureParameters.setLoadBalancerSku(LoadBalancerSku.STANDARD);
StackV4Request request = new StackV4Request();
request.setEnableLoadBalancer(false);
request.setAzure(azureParameters);
when(entitlementService.azureDatalakeLoadBalancerEnabled(anyString())).thenReturn(true);
when(blueprint.getBlueprintText()).thenReturn(getBlueprintText("input/clouderamanager-knox.bp"));
when(subnetSelector.findSubnetById(any(), anyString())).thenReturn(Optional.of(subnet));
when(availabilitySetNameService.generateName(any(), any())).thenReturn("");
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.OUTBOUND.equals(l.getType()));
InstanceGroup masterInstanceGroup = stack.getInstanceGroups().stream().filter(ig -> "master".equals(ig.getGroupName())).findFirst().get();
assertEquals(1, masterInstanceGroup.getTargetGroups().size());
assertTrue(loadBalancers.stream().allMatch(l -> LoadBalancerSku.STANDARD.equals(l.getSku())));
checkAvailabilitySetAttributes(loadBalancers);
});
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.base.parameter.stack.AzureStackV4Parameters in project cloudbreak by hortonworks.
the class LoadBalancerConfigServiceTest method testAzureLoadBalancerDisabledWithOozieHA.
@Test
public void testAzureLoadBalancerDisabledWithOozieHA() {
Stack stack = createAzureStack(StackType.DATALAKE, PRIVATE_ID_1, true);
CloudSubnet subnet = getPrivateCloudSubnet(PRIVATE_ID_1, AZ_1);
DetailedEnvironmentResponse environment = createEnvironment(subnet, false, "AZURE");
AzureStackV4Parameters azureParameters = new AzureStackV4Parameters();
azureParameters.setLoadBalancerSku(LoadBalancerSku.NONE);
StackV4Request request = new StackV4Request();
request.setEnableLoadBalancer(false);
request.setAzure(azureParameters);
when(entitlementService.azureDatalakeLoadBalancerEnabled(anyString())).thenReturn(false);
when(blueprint.getBlueprintText()).thenReturn(getBlueprintText("input/de-ha.bp"));
when(subnetSelector.findSubnetById(any(), anyString())).thenReturn(Optional.of(subnet));
when(availabilitySetNameService.generateName(any(), any())).thenReturn("");
assertThrows(CloudbreakServiceException.class, () -> underTest.createLoadBalancers(stack, environment, request));
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.base.parameter.stack.AzureStackV4Parameters in project cloudbreak by hortonworks.
the class DistroXParameterConverterTest method testAzureDistroXV1ParametersToAzureStackV4Parameters.
@Test
void testAzureDistroXV1ParametersToAzureStackV4Parameters() {
AzureDistroXV1Parameters input = new AzureDistroXV1Parameters();
input.setEncryptStorage(true);
input.setResourceGroupName("resourceGroupName");
input.setLoadBalancerSku(LoadBalancerSku.STANDARD);
AzureStackV4Parameters result = underTest.convert(input);
assertNotNull(result);
assertEquals(input.isEncryptStorage(), result.isEncryptStorage());
assertEquals(input.getResourceGroupName(), result.getResourceGroupName());
assertEquals(input.getLoadBalancerSku(), result.getLoadBalancerSku());
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.base.parameter.stack.AzureStackV4Parameters in project cloudbreak by hortonworks.
the class SdxService method updateAzureLoadBalancerSkuIfPresent.
private void updateAzureLoadBalancerSkuIfPresent(StackV4Request stackRequest, SdxClusterRequest sdxClusterRequest) {
Optional.ofNullable(sdxClusterRequest.getAzure()).map(SdxAzureBase::getLoadBalancerSku).ifPresent(sku -> {
AzureStackV4Parameters azureParameters = stackRequest.createAzure();
azureParameters.setLoadBalancerSku(sku);
stackRequest.setAzure(azureParameters);
});
}
Aggregations