use of com.sequenceiq.cloudbreak.orchestrator.salt.poller.SaltBootstrap in project cloudbreak by hortonworks.
the class SaltOrchestrator method bootstrapNewNodes.
@Override
public void bootstrapNewNodes(List<GatewayConfig> allGatewayConfigs, Set<Node> targets, Set<Node> allNodes, byte[] stateConfigZip, ExitCriteriaModel exitModel) throws CloudbreakOrchestratorException {
GatewayConfig primaryGateway = getPrimaryGatewayConfig(allGatewayConfigs);
Set<String> gatewayTargets = allGatewayConfigs.stream().filter(gc -> targets.stream().anyMatch(n -> gc.getPrivateAddress().equals(n.getPrivateIp()))).map(GatewayConfig::getPrivateAddress).collect(Collectors.toSet());
try (SaltConnector sc = new SaltConnector(primaryGateway, restDebug)) {
if (!gatewayTargets.isEmpty()) {
uploadSaltConfig(sc, gatewayTargets, stateConfigZip, exitModel);
}
uploadSignKey(sc, primaryGateway, gatewayTargets, targets.stream().map(Node::getPrivateIp).collect(Collectors.toSet()), exitModel);
// if there is a new salt master then re-bootstrap all nodes
Set<Node> nodes = gatewayTargets.isEmpty() ? targets : allNodes;
OrchestratorBootstrap saltBootstrap = new SaltBootstrap(sc, allGatewayConfigs, nodes);
Callable<Boolean> saltBootstrapRunner = runner(saltBootstrap, exitCriteria, exitModel);
Future<Boolean> saltBootstrapRunnerFuture = parallelOrchestratorComponentRunner.submit(saltBootstrapRunner);
saltBootstrapRunnerFuture.get();
} catch (Exception e) {
LOGGER.error("Error occurred during salt upscale", e);
throw new CloudbreakOrchestratorFailedException(e);
}
}
use of com.sequenceiq.cloudbreak.orchestrator.salt.poller.SaltBootstrap in project cloudbreak by hortonworks.
the class SaltOrchestrator method bootstrap.
@Override
public void bootstrap(List<GatewayConfig> allGatewayConfigs, Set<Node> targets, ExitCriteriaModel exitModel) throws CloudbreakOrchestratorException {
LOGGER.info("Start SaltBootstrap on nodes: {}", targets);
GatewayConfig primaryGateway = getPrimaryGatewayConfig(allGatewayConfigs);
Set<String> gatewayTargets = getGatewayPrivateIps(allGatewayConfigs);
try (SaltConnector sc = new SaltConnector(primaryGateway, restDebug)) {
uploadSaltConfig(sc, gatewayTargets, exitModel);
uploadSignKey(sc, primaryGateway, gatewayTargets, targets.stream().map(Node::getPrivateIp).collect(Collectors.toSet()), exitModel);
OrchestratorBootstrap saltBootstrap = new SaltBootstrap(sc, allGatewayConfigs, targets);
Callable<Boolean> saltBootstrapRunner = runner(saltBootstrap, exitCriteria, exitModel);
Future<Boolean> saltBootstrapRunnerFuture = parallelOrchestratorComponentRunner.submit(saltBootstrapRunner);
saltBootstrapRunnerFuture.get();
} catch (Exception e) {
LOGGER.error("Error occurred during the salt bootstrap", e);
throw new CloudbreakOrchestratorFailedException(e);
}
LOGGER.info("SaltBootstrap finished");
}
Aggregations