Search in sources :

Example 1 with CustomDomainSettingsV4Request

use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.customdomain.CustomDomainSettingsV4Request in project cloudbreak by hortonworks.

the class StackToStackV4RequestConverter method getCustomDomainSettings.

private CustomDomainSettingsV4Request getCustomDomainSettings(Stack stack) {
    CustomDomainSettingsV4Request cd = new CustomDomainSettingsV4Request();
    cd.setDomainName(stack.getCustomDomain());
    cd.setHostname(stack.getCustomHostname());
    cd.setHostgroupNameAsHostname(stack.isHostgroupNameAsHostname());
    cd.setClusterNameAsSubdomain(stack.isClusterNameAsSubdomain());
    return cd;
}
Also used : CustomDomainSettingsV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.customdomain.CustomDomainSettingsV4Request)

Example 2 with CustomDomainSettingsV4Request

use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.customdomain.CustomDomainSettingsV4Request in project cloudbreak by hortonworks.

the class StackTestDtoBase method withDomainName.

public StackTestDtoBase<T> withDomainName(String domainName) {
    CustomDomainSettingsV4Request request = Optional.ofNullable(getRequest().getCustomDomain()).orElse(new CustomDomainSettingsV4Request());
    request.setDomainName(domainName);
    getRequest().setCustomDomain(request);
    return this;
}
Also used : CustomDomainSettingsV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.customdomain.CustomDomainSettingsV4Request)

Example 3 with CustomDomainSettingsV4Request

use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.customdomain.CustomDomainSettingsV4Request in project cloudbreak by hortonworks.

the class SdxService method resizeSdx.

public Pair<SdxCluster, FlowIdentifier> resizeSdx(final String userCrn, final String clusterName, final SdxClusterResizeRequest sdxClusterResizeRequest) {
    LOGGER.info("Re-sizing SDX cluster with name {}", clusterName);
    String accountIdFromCrn = getAccountIdFromCrn(userCrn);
    String environmentName = sdxClusterResizeRequest.getEnvironment();
    SdxClusterShape shape = sdxClusterResizeRequest.getClusterShape();
    final SdxCluster sdxCluster = sdxClusterRepository.findByAccountIdAndClusterNameAndDeletedIsNullAndDetachedIsFalse(accountIdFromCrn, clusterName).orElseThrow(() -> notFound("SDX cluster", clusterName).get());
    MDCBuilder.buildMdcContext(sdxCluster);
    validateSdxResizeRequest(sdxCluster, accountIdFromCrn, shape);
    StackV4Response stackV4Response = getDetail(clusterName, Set.of(StackResponseEntries.HARDWARE_INFO.getEntryName(), StackResponseEntries.EVENTS.getEntryName()), accountIdFromCrn);
    DetailedEnvironmentResponse environment = validateAndGetEnvironment(environmentName);
    SdxCluster newSdxCluster = validateAndCreateNewSdxCluster(userCrn, clusterName, sdxCluster.getRuntime(), shape, sdxCluster.isRangerRazEnabled(), sdxCluster.isEnableMultiAz(), environment);
    newSdxCluster.setTags(sdxCluster.getTags());
    newSdxCluster.setCrn(sdxCluster.getCrn());
    CloudPlatform cloudPlatform = CloudPlatform.valueOf(environment.getCloudPlatform());
    if (!StringUtils.isBlank(sdxCluster.getCloudStorageBaseLocation())) {
        newSdxCluster.setCloudStorageBaseLocation(sdxCluster.getCloudStorageBaseLocation());
        newSdxCluster.setCloudStorageFileSystemType(sdxCluster.getCloudStorageFileSystemType());
    } else if (!CloudPlatform.YARN.equalsIgnoreCase(cloudPlatform.name()) && !CloudPlatform.GCP.equalsIgnoreCase(cloudPlatform.name()) && !CloudPlatform.MOCK.equalsIgnoreCase(cloudPlatform.name())) {
        throw new BadRequestException("Cloud storage parameter is required.");
    }
    newSdxCluster.setDatabaseAvailabilityType(sdxCluster.getDatabaseAvailabilityType());
    newSdxCluster.setDatabaseEngineVersion(sdxCluster.getDatabaseEngineVersion());
    StackV4Request stackRequest = getStackRequest(shape, sdxCluster.isRangerRazEnabled(), null, cloudPlatform, sdxCluster.getRuntime(), null);
    if (shape == SdxClusterShape.MEDIUM_DUTY_HA) {
        // This is added to make sure the host name used by Light and Medium duty are not the same.
        CustomDomainSettingsV4Request customDomainSettingsV4Request = new CustomDomainSettingsV4Request();
        customDomainSettingsV4Request.setHostname(sdxCluster.getClusterName() + SDX_RESIZE_NAME_SUFFIX);
        stackRequest.setCustomDomain(customDomainSettingsV4Request);
    }
    prepareCloudStorageForStack(stackRequest, stackV4Response, newSdxCluster, environment);
    prepareDefaultSecurityConfigs(null, stackRequest, cloudPlatform);
    try {
        if (!StringUtils.isBlank(sdxCluster.getStackRequestToCloudbreak())) {
            StackV4Request stackV4RequestOrig = JsonUtil.readValue(sdxCluster.getStackRequestToCloudbreak(), StackV4Request.class);
            stackRequest.setImage(stackV4RequestOrig.getImage());
        }
    } catch (IOException ioException) {
        LOGGER.error("Failed to re-use the image catalog. Will use default catalog", ioException);
    }
    stackRequest.setResourceCrn(newSdxCluster.getCrn());
    newSdxCluster.setStackRequest(stackRequest);
    FlowIdentifier flowIdentifier = sdxReactorFlowManager.triggerSdxResize(sdxCluster.getId(), newSdxCluster);
    return Pair.of(sdxCluster, flowIdentifier);
}
Also used : CloudPlatform(com.sequenceiq.cloudbreak.common.mappable.CloudPlatform) StackV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.StackV4Response) StackV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.StackV4Request) CustomDomainSettingsV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.customdomain.CustomDomainSettingsV4Request) SdxCluster(com.sequenceiq.datalake.entity.SdxCluster) DetailedEnvironmentResponse(com.sequenceiq.environment.api.v1.environment.model.response.DetailedEnvironmentResponse) BadRequestException(com.sequenceiq.cloudbreak.common.exception.BadRequestException) IOException(java.io.IOException) FlowIdentifier(com.sequenceiq.flow.api.model.FlowIdentifier) SdxClusterShape(com.sequenceiq.sdx.api.model.SdxClusterShape)

Example 4 with CustomDomainSettingsV4Request

use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.customdomain.CustomDomainSettingsV4Request in project cloudbreak by hortonworks.

the class StackTestDtoBase method withHostgroupNameAsHostname.

public StackTestDtoBase<T> withHostgroupNameAsHostname(Boolean hostgroupNameAsHostname) {
    CustomDomainSettingsV4Request request = Optional.ofNullable(getRequest().getCustomDomain()).orElse(new CustomDomainSettingsV4Request());
    request.setHostgroupNameAsHostname(hostgroupNameAsHostname);
    getRequest().setCustomDomain(request);
    return this;
}
Also used : CustomDomainSettingsV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.customdomain.CustomDomainSettingsV4Request)

Example 5 with CustomDomainSettingsV4Request

use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.customdomain.CustomDomainSettingsV4Request in project cloudbreak by hortonworks.

the class StackTestDtoBase method withClusterNameAsSubdomain.

public StackTestDtoBase<T> withClusterNameAsSubdomain(Boolean clusterNameAsSubdomain) {
    CustomDomainSettingsV4Request request = Optional.ofNullable(getRequest().getCustomDomain()).orElse(new CustomDomainSettingsV4Request());
    request.setClusterNameAsSubdomain(clusterNameAsSubdomain);
    getRequest().setCustomDomain(request);
    return this;
}
Also used : CustomDomainSettingsV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.customdomain.CustomDomainSettingsV4Request)

Aggregations

CustomDomainSettingsV4Request (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.customdomain.CustomDomainSettingsV4Request)7 EnvironmentNetworkMockParams (com.sequenceiq.environment.api.v1.environment.model.EnvironmentNetworkMockParams)2 HostGroupType (com.sequenceiq.it.cloudbreak.cloud.HostGroupType)2 SdxInternalTestDto (com.sequenceiq.it.cloudbreak.dto.sdx.SdxInternalTestDto)2 SdxDatabaseRequest (com.sequenceiq.sdx.api.model.SdxDatabaseRequest)2 ArrayList (java.util.ArrayList)2 StackV4Request (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.StackV4Request)1 StackV4Response (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.StackV4Response)1 BadRequestException (com.sequenceiq.cloudbreak.common.exception.BadRequestException)1 CloudPlatform (com.sequenceiq.cloudbreak.common.mappable.CloudPlatform)1 SdxCluster (com.sequenceiq.datalake.entity.SdxCluster)1 DetailedEnvironmentResponse (com.sequenceiq.environment.api.v1.environment.model.response.DetailedEnvironmentResponse)1 EnvironmentStatus (com.sequenceiq.environment.api.v1.environment.model.response.EnvironmentStatus)1 FlowIdentifier (com.sequenceiq.flow.api.model.FlowIdentifier)1 FreeIpaTestClient (com.sequenceiq.it.cloudbreak.client.FreeIpaTestClient)1 SdxTestClient (com.sequenceiq.it.cloudbreak.client.SdxTestClient)1 IDBROKER (com.sequenceiq.it.cloudbreak.cloud.HostGroupType.IDBROKER)1 MASTER (com.sequenceiq.it.cloudbreak.cloud.HostGroupType.MASTER)1 Description (com.sequenceiq.it.cloudbreak.context.Description)1 MockedTestContext (com.sequenceiq.it.cloudbreak.context.MockedTestContext)1