use of com.sequenceiq.cloudbreak.orchestrator.model.GatewayConfig in project cloudbreak by hortonworks.
the class ClusterHostServiceRunner method addAmbariServices.
@Transactional
public Map<String, String> addAmbariServices(Long stackId, String hostGroupName, Integer scalingAdjustment) throws CloudbreakException {
Map<String, String> candidates;
try {
Stack stack = stackRepository.findOneWithLists(stackId);
Cluster cluster = stack.getCluster();
candidates = collectUpscaleCandidates(cluster.getId(), hostGroupName, scalingAdjustment);
Set<Node> allNodes = collectNodes(stack);
HostOrchestrator hostOrchestrator = hostOrchestratorResolver.get(stack.getOrchestrator().getType());
List<GatewayConfig> gatewayConfigs = gatewayConfigService.getAllGatewayConfigs(stack);
SaltConfig saltConfig = createSaltConfig(stack, cluster, gatewayConfigService.getPrimaryGatewayConfig(stack), gatewayConfigs);
hostOrchestrator.runService(gatewayConfigs, allNodes, saltConfig, clusterDeletionBasedModel(stack.getId(), cluster.getId()));
} catch (CloudbreakOrchestratorCancelledException e) {
throw new CancellationException(e.getMessage());
} catch (CloudbreakOrchestratorException | IOException e) {
throw new CloudbreakException(e);
}
return candidates;
}
use of com.sequenceiq.cloudbreak.orchestrator.model.GatewayConfig in project cloudbreak by hortonworks.
the class OrchestratorRecipeExecutor method postInstall.
public void postInstall(Stack stack) throws CloudbreakException {
HostOrchestrator hostOrchestrator = hostOrchestratorResolver.get(stack.getOrchestrator().getType());
GatewayConfig gatewayConfig = gatewayConfigService.getPrimaryGatewayConfig(stack);
try {
hostOrchestrator.postInstallRecipes(gatewayConfig, collectNodes(stack), clusterDeletionBasedModel(stack.getId(), stack.getCluster().getId()));
} catch (CloudbreakOrchestratorFailedException e) {
throw new CloudbreakException(e);
}
}
use of com.sequenceiq.cloudbreak.orchestrator.model.GatewayConfig in project cloudbreak by hortonworks.
the class OrchestratorRecipeExecutor method preTerminationRecipesOnNodes.
public void preTerminationRecipesOnNodes(Stack stack, Set<Node> nodes) throws CloudbreakException {
if (stack.getCluster() == null) {
throw new NotFoundException("Cluster does not found, pre-termination will not be run.");
}
HostOrchestrator hostOrchestrator = hostOrchestratorResolver.get(stack.getOrchestrator().getType());
GatewayConfig gatewayConfig = gatewayConfigService.getPrimaryGatewayConfig(stack);
try {
hostOrchestrator.preTerminationRecipes(gatewayConfig, nodes, clusterDeletionBasedModel(stack.getId(), stack.getCluster().getId()));
} catch (CloudbreakOrchestratorFailedException e) {
throw new CloudbreakException(e);
}
}
use of com.sequenceiq.cloudbreak.orchestrator.model.GatewayConfig in project cloudbreak by hortonworks.
the class TlsSecurityService method buildGatewayConfig.
public GatewayConfig buildGatewayConfig(Long stackId, InstanceMetaData gatewayInstance, Integer gatewayPort, SaltClientConfig saltClientConfig, Boolean knoxGatewayEnabled) {
SecurityConfig securityConfig = securityConfigRepository.findOneByStackId(stackId);
String connectionIp = getGatewayIp(securityConfig, gatewayInstance);
HttpClientConfig conf = buildTLSClientConfig(stackId, connectionIp, gatewayInstance);
return new GatewayConfig(connectionIp, gatewayInstance.getPublicIpWrapper(), gatewayInstance.getPrivateIp(), gatewayInstance.getDiscoveryFQDN(), gatewayPort, conf.getServerCert(), conf.getClientCert(), conf.getClientKey(), saltClientConfig.getSaltPassword(), saltClientConfig.getSaltBootPassword(), saltClientConfig.getSignatureKeyPem(), knoxGatewayEnabled, InstanceMetadataType.GATEWAY_PRIMARY.equals(gatewayInstance.getInstanceMetadataType()), securityConfig.getSaltSignPrivateKeyDecoded(), securityConfig.getSaltSignPublicKeyDecoded());
}
use of com.sequenceiq.cloudbreak.orchestrator.model.GatewayConfig in project cloudbreak by hortonworks.
the class SaltBootstrapTest method setUp.
@Before
public void setUp() {
saltConnector = mock(SaltConnector.class);
gatewayConfig = new GatewayConfig("1.1.1.1", "10.0.0.1", "172.16.252.43", "10-0-0-1.example.com", 9443, "serverCert", "clientCert", "clientKey", "saltpasswd", "saltbootpassword", "signkey", false, true, null, null);
GenericResponse response = new GenericResponse();
response.setStatusCode(HttpStatus.OK.value());
GenericResponses genericResponses = new GenericResponses();
genericResponses.setResponses(Collections.singletonList(response));
when(saltConnector.action(Mockito.any(SaltAction.class))).thenReturn(genericResponses);
when(saltConnector.run(Mockito.any(), Mockito.eq("network.default_route"), Mockito.any(), Mockito.any())).thenReturn(new DefaultRouteResponse(Collections.emptyList()));
NetworkInterfaceResponse networkInterfaceResponse = new NetworkInterfaceResponse();
List<Map<String, String>> networkResultList = new ArrayList<>();
networkMap = new HashMap<>();
networkMap.put("host-10-0-0-1.example.com", "10.0.0.1");
networkMap.put("host-10-0-0-2.example.com", "10.0.0.2");
networkMap.put("host-10-0-0-3.example.com", "10.0.0.3");
networkResultList.add(networkMap);
networkInterfaceResponse.setResult(networkResultList);
when(saltConnector.run(Mockito.any(), Mockito.eq("network.interface_ip"), Mockito.any(), Mockito.any(), Mockito.any())).thenReturn(networkInterfaceResponse);
}
Aggregations