Search in sources :

Example 1 with OrchestratorMetadata

use of com.sequenceiq.cloudbreak.orchestrator.metadata.OrchestratorMetadata in project cloudbreak by hortonworks.

the class OrchestratorService method getOrchestratorMetadata.

@Override
public OrchestratorMetadata getOrchestratorMetadata(Long stackId) {
    Stack stack = stackService.getByIdWithListsInTransaction(stackId);
    List<GatewayConfig> gatewayConfigs = gatewayConfigService.getAllGatewayConfigs(stack);
    ClusterDeletionBasedExitCriteriaModel exitModel = new ClusterDeletionBasedExitCriteriaModel(stackId, stack.getCluster().getId());
    return new OrchestratorMetadata(gatewayConfigs, stack.getAllNodes(), exitModel, stack);
}
Also used : OrchestratorMetadata(com.sequenceiq.cloudbreak.orchestrator.metadata.OrchestratorMetadata) ClusterDeletionBasedExitCriteriaModel(com.sequenceiq.cloudbreak.core.bootstrap.service.ClusterDeletionBasedExitCriteriaModel) Stack(com.sequenceiq.cloudbreak.domain.stack.Stack) GatewayConfig(com.sequenceiq.cloudbreak.orchestrator.model.GatewayConfig)

Example 2 with OrchestratorMetadata

use of com.sequenceiq.cloudbreak.orchestrator.metadata.OrchestratorMetadata in project cloudbreak by hortonworks.

the class TelemetryUpgradeService method updateSaltStateForComponents.

private void updateSaltStateForComponents(Long stackId, Set<TelemetryOrchestratorModule> components, byte[] telemetrySaltStateConfigs) throws CloudbreakOrchestratorFailedException {
    List<String> componentNames = components.stream().map(TelemetryOrchestratorModule::getValue).collect(Collectors.toList());
    OrchestratorMetadata metadata = orchestratorMetadataProvider.getOrchestratorMetadata(stackId);
    telemetryOrchestrator.updatePartialSaltDefinition(telemetrySaltStateConfigs, componentNames, metadata.getGatewayConfigs(), metadata.getExitCriteriaModel());
}
Also used : OrchestratorMetadata(com.sequenceiq.cloudbreak.orchestrator.metadata.OrchestratorMetadata)

Example 3 with OrchestratorMetadata

use of com.sequenceiq.cloudbreak.orchestrator.metadata.OrchestratorMetadata in project cloudbreak by hortonworks.

the class TelemetryUpgradeService method upgradeTelemetrySaltPillars.

public void upgradeTelemetrySaltPillars(Long stackId, Set<TelemetryComponentType> components) throws CloudbreakOrchestratorFailedException {
    OrchestratorMetadata metadata = orchestratorMetadataProvider.getOrchestratorMetadata(stackId);
    Set<Node> availableNodes = collectAvailableNodes(metadata);
    if (CollectionUtils.isEmpty(availableNodes)) {
        String message = "Not found any available nodes for stack: " + stackId;
        LOGGER.info(message);
        throw new CloudbreakOrchestratorFailedException(message);
    } else {
        Map<String, SaltPillarProperties> pillarPropMap = telemetryConfigProvider.createTelemetryConfigs(stackId, components);
        SaltConfig saltConfig = new SaltConfig(pillarPropMap);
        hostOrchestrator.initSaltConfig(metadata.getStack(), metadata.getGatewayConfigs(), availableNodes, saltConfig, metadata.getExitCriteriaModel());
    }
}
Also used : CloudbreakOrchestratorFailedException(com.sequenceiq.cloudbreak.orchestrator.exception.CloudbreakOrchestratorFailedException) OrchestratorMetadata(com.sequenceiq.cloudbreak.orchestrator.metadata.OrchestratorMetadata) Node(com.sequenceiq.cloudbreak.common.orchestration.Node) SaltConfig(com.sequenceiq.cloudbreak.orchestrator.model.SaltConfig) SaltPillarProperties(com.sequenceiq.cloudbreak.orchestrator.model.SaltPillarProperties)

Example 4 with OrchestratorMetadata

use of com.sequenceiq.cloudbreak.orchestrator.metadata.OrchestratorMetadata in project cloudbreak by hortonworks.

the class DiagnosticsFlowService method collectNodeStatusTelemetry.

public void collectNodeStatusTelemetry(Long stackId) throws CloudbreakOrchestratorFailedException {
    OrchestratorMetadata metadata = orchestratorMetadataProvider.getOrchestratorMetadata(stackId);
    Set<Node> allNodes = metadata.getNodes();
    if (allNodes.isEmpty()) {
        LOGGER.debug("Nodestatus telemetry collection has been skipped. (no target minions)");
    } else {
        telemetryOrchestrator.executeNodeStatusCollection(metadata.getGatewayConfigs(), allNodes, metadata.getExitCriteriaModel());
    }
}
Also used : OrchestratorMetadata(com.sequenceiq.cloudbreak.orchestrator.metadata.OrchestratorMetadata) Node(com.sequenceiq.cloudbreak.common.orchestration.Node)

Example 5 with OrchestratorMetadata

use of com.sequenceiq.cloudbreak.orchestrator.metadata.OrchestratorMetadata in project cloudbreak by hortonworks.

the class OrchestratorServiceTest method testGetOrchestratorMetadata.

@Test
public void testGetOrchestratorMetadata() {
    // GIVEN
    given(stackService.getByIdWithListsInTransaction(STACK_ID)).willReturn(stack());
    given(gatewayConfigService.getAllGatewayConfigs(any())).willReturn(new ArrayList<>());
    // WHEN
    OrchestratorMetadata result = underTest.getOrchestratorMetadata(STACK_ID);
    // THEN
    assertNotNull(result);
    verify(gatewayConfigService, times(1)).getAllGatewayConfigs(any());
}
Also used : OrchestratorMetadata(com.sequenceiq.cloudbreak.orchestrator.metadata.OrchestratorMetadata) Test(org.junit.jupiter.api.Test)

Aggregations

OrchestratorMetadata (com.sequenceiq.cloudbreak.orchestrator.metadata.OrchestratorMetadata)9 Node (com.sequenceiq.cloudbreak.common.orchestration.Node)3 GatewayConfig (com.sequenceiq.cloudbreak.orchestrator.model.GatewayConfig)2 Stack (com.sequenceiq.freeipa.entity.Stack)2 Test (org.junit.jupiter.api.Test)2 ClusterDeletionBasedExitCriteriaModel (com.sequenceiq.cloudbreak.core.bootstrap.service.ClusterDeletionBasedExitCriteriaModel)1 Stack (com.sequenceiq.cloudbreak.domain.stack.Stack)1 CloudbreakOrchestratorFailedException (com.sequenceiq.cloudbreak.orchestrator.exception.CloudbreakOrchestratorFailedException)1 OrchestratorMetadataFilter (com.sequenceiq.cloudbreak.orchestrator.metadata.OrchestratorMetadataFilter)1 SaltConfig (com.sequenceiq.cloudbreak.orchestrator.model.SaltConfig)1 SaltPillarProperties (com.sequenceiq.cloudbreak.orchestrator.model.SaltPillarProperties)1 StackBasedExitCriteriaModel (com.sequenceiq.freeipa.orchestrator.StackBasedExitCriteriaModel)1