use of com.sequenceiq.freeipa.entity.InstanceMetaData in project cloudbreak by hortonworks.
the class FreeIpaScalingService method upscale.
public UpscaleResponse upscale(String accountId, UpscaleRequest request) {
Stack stack = stackService.getByEnvironmentCrnAndAccountIdWithListsAndMdcContext(request.getEnvironmentCrn(), accountId);
Set<InstanceMetaData> allInstances = stack.getNotDeletedInstanceMetaDataSet();
AvailabilityType originalAvailabilityType = AvailabilityType.getByInstanceCount(allInstances.size());
logRequest(OperationType.UPSCALE, request, originalAvailabilityType);
validationService.validateStackForUpscale(allInstances, stack, new ScalingPath(originalAvailabilityType, request.getTargetAvailabilityType()));
return triggerUpscale(request, stack, originalAvailabilityType);
}
use of com.sequenceiq.freeipa.entity.InstanceMetaData in project cloudbreak by hortonworks.
the class FreeIpaInstallService method installFreeIpa.
public void installFreeIpa(Long stackId) throws CloudbreakOrchestratorException {
Stack stack = stackService.getByIdWithListsInTransaction(stackId);
Set<InstanceMetaData> instanceMetaDatas = stack.getNotDeletedInstanceMetaDataSet();
List<GatewayConfig> gatewayConfigs = gatewayConfigService.getGatewayConfigs(stack, instanceMetaDatas);
Set<Node> allNodes = freeIpaNodeUtilService.mapInstancesToNodes(instanceMetaDatas);
installFreeIpa(stackId, stack, gatewayConfigs, allNodes);
}
use of com.sequenceiq.freeipa.entity.InstanceMetaData in project cloudbreak by hortonworks.
the class FreeIpaOrchestrationConfigService method configureOrchestrator.
public void configureOrchestrator(Long stackId) throws CloudbreakOrchestratorException {
Stack stack = stackService.getByIdWithListsInTransaction(stackId);
Set<InstanceMetaData> instanceMetaDatas = stack.getNotDeletedInstanceMetaDataSet();
List<GatewayConfig> gatewayConfigs = gatewayConfigService.getGatewayConfigs(stack, instanceMetaDatas);
Set<Node> allNodes = freeIpaNodeUtilService.mapInstancesToNodes(instanceMetaDatas);
SaltConfig saltConfig = saltConfigProvider.getSaltConfig(stack, allNodes);
hostOrchestrator.initSaltConfig(stack, gatewayConfigs, allNodes, saltConfig, new StackBasedExitCriteriaModel(stackId));
}
use of com.sequenceiq.freeipa.entity.InstanceMetaData in project cloudbreak by hortonworks.
the class FreeIpaClientFactory method getFreeIpaClient.
private FreeIpaClient getFreeIpaClient(Stack stack, boolean withPing, boolean forceCheckUnreachable, Optional<String> freeIpaFqdn) throws FreeIpaClientException {
stack = stackService.getByIdWithListsInTransaction(stack.getId());
Status stackStatus = stack.getStackStatus().getStatus();
if (forceCheckUnreachable || !stackStatus.isFreeIpaUnreachableStatus()) {
try {
Optional<FreeIpaClient> client = Optional.empty();
if (clusterProxyService.isCreateConfigForClusterProxy(stack)) {
return getFreeIpaClientBuilderForClusterProxy(stack, freeIpaFqdn).build(withPing);
} else {
List<InstanceMetaData> instanceMetaDatas = getPriorityOrderedFreeIpaInstances(stack, forceCheckUnreachable).stream().filter(instanceMetaData -> freeIpaFqdn.isEmpty() || freeIpaFqdn.get().equals(instanceMetaData.getDiscoveryFQDN())).collect(Collectors.toList());
for (Iterator<InstanceMetaData> instanceIterator = instanceMetaDatas.iterator(); instanceIterator.hasNext() && client.isEmpty(); ) {
InstanceMetaData instanceMetaData = instanceIterator.next();
client = getFreeIpaClientForDirectConnect(stack, instanceMetaData, withPing, !instanceIterator.hasNext());
}
}
return client.orElseThrow(() -> new FreeIpaHostNotAvailableException("No FreeIPA client was available"));
} catch (RetryableFreeIpaClientException e) {
throw createFreeIpaUnableToBuildClient(e);
} catch (Exception e) {
throw createFreeIpaUnableToBuildClient(e);
}
} else {
throw createFreeIpaStateIsInvalidException(stackStatus);
}
}
use of com.sequenceiq.freeipa.entity.InstanceMetaData in project cloudbreak by hortonworks.
the class KerberosConfigRegisterService method addAddressForLegacy.
/**
* old FreeIPA instance doesn't have kerberos CNAME so we have to create the config differently
*/
private void addAddressForLegacy(Stack stack, KerberosConfig kerberosConfig, Set<InstanceMetaData> allNotDeletedInstances) {
InstanceMetaData master = getMasterInstance(stack);
kerberosConfig.setAdminUrl(master.getDiscoveryFQDN());
String allNotDeletedIpaInstanceFQDNJoined = allNotDeletedInstances.stream().map(InstanceMetaData::getDiscoveryFQDN).collect(Collectors.joining(","));
kerberosConfig.setUrl(allNotDeletedIpaInstanceFQDNJoined);
}
Aggregations