Search in sources :

Example 6 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
    Stack stack = new Stack();
    stack.setId(STACK_ID);
    given(stackService.getByIdWithListsInTransaction(STACK_ID)).willReturn(stack);
    given(gatewayConfigService.getNotDeletedGatewayConfigs(any())).willReturn(new ArrayList<>());
    // WHEN
    OrchestratorMetadata result = underTest.getOrchestratorMetadata(STACK_ID);
    // THEN
    assertNotNull(result);
    verify(gatewayConfigService, times(1)).getNotDeletedGatewayConfigs(any());
}
Also used : OrchestratorMetadata(com.sequenceiq.cloudbreak.orchestrator.metadata.OrchestratorMetadata) Stack(com.sequenceiq.freeipa.entity.Stack) Test(org.junit.jupiter.api.Test)

Example 7 with OrchestratorMetadata

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

the class DiagnosticsOperationsService method executeDiagnosticsOperation.

private void executeDiagnosticsOperation(Long stackId, DiagnosticParameters parameters, String operationName, DiagnosticsOperationFunction func) throws CloudbreakOrchestratorFailedException {
    OrchestratorMetadata orchestratorMetadata = orchestratorMetadataProvider.getOrchestratorMetadata(stackId);
    OrchestratorMetadataFilter filter = createMetadataFilter(parameters);
    OrchestratorMetadata updatedOrchestratorMetadata = filter.apply(orchestratorMetadata);
    LOGGER.debug("Starting diagnostics {}. stackId: '{}'", operationName, stackId);
    if (CollectionUtils.isEmpty(updatedOrchestratorMetadata.getNodes())) {
        LOGGER.debug("Diagnostics {} has been skipped. (no target minions)", operationName);
    } else {
        func.apply(updatedOrchestratorMetadata, parameters);
    }
}
Also used : OrchestratorMetadataFilter(com.sequenceiq.cloudbreak.orchestrator.metadata.OrchestratorMetadataFilter) OrchestratorMetadata(com.sequenceiq.cloudbreak.orchestrator.metadata.OrchestratorMetadata)

Example 8 with OrchestratorMetadata

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

the class TelemetryUpgradeService method upgradeTelemetryComponent.

public void upgradeTelemetryComponent(Long stackId, TelemetryComponentType componentType, OrchestratorMetadataFilter filter) throws CloudbreakOrchestratorFailedException {
    OrchestratorMetadata metadata = orchestratorMetadataProvider.getOrchestratorMetadata(stackId);
    Set<Node> nodes = filter != null ? filter.apply(metadata).getNodes() : metadata.getNodes();
    if (TelemetryComponentType.METERING.equals(componentType)) {
        LOGGER.debug("Starting metering component upgrade");
        telemetryOrchestrator.upgradeMetering(metadata.getGatewayConfigs(), nodes, metadata.getExitCriteriaModel(), telemetryUpgradeConfiguration.getMeteringAgent().getDesiredDate(), null);
    } else if (TelemetryComponentType.CDP_LOGGING_AGENT.equals(componentType)) {
        LOGGER.debug("Starting cdp-logging-agent upgrade");
        telemetryOrchestrator.updateTelemetryComponent(metadata.getGatewayConfigs(), nodes, metadata.getExitCriteriaModel(), Map.of("telemetry", Map.of(DESIRED_CDP_LOGGING_AGENT_VERSION, telemetryUpgradeConfiguration.getCdpLoggingAgent().getDesiredVersion(), DESIRED_CDP_TELEMETRY_VERSION, EMPTY_VERSION)));
    } else {
        LOGGER.debug("Starting cdp-telemetry upgrade");
        telemetryOrchestrator.updateTelemetryComponent(metadata.getGatewayConfigs(), nodes, metadata.getExitCriteriaModel(), Map.of("telemetry", Map.of(DESIRED_CDP_LOGGING_AGENT_VERSION, EMPTY_VERSION, DESIRED_CDP_TELEMETRY_VERSION, telemetryUpgradeConfiguration.getCdpTelemetry().getDesiredVersion())));
    }
}
Also used : OrchestratorMetadata(com.sequenceiq.cloudbreak.orchestrator.metadata.OrchestratorMetadata) Node(com.sequenceiq.cloudbreak.common.orchestration.Node)

Example 9 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.getNotDeletedGatewayConfigs(stack);
    StackBasedExitCriteriaModel exitCriteriaModel = new StackBasedExitCriteriaModel(stackId);
    return new OrchestratorMetadata(gatewayConfigs, stack.getAllNodes(), exitCriteriaModel, stack);
}
Also used : OrchestratorMetadata(com.sequenceiq.cloudbreak.orchestrator.metadata.OrchestratorMetadata) StackBasedExitCriteriaModel(com.sequenceiq.freeipa.orchestrator.StackBasedExitCriteriaModel) Stack(com.sequenceiq.freeipa.entity.Stack) GatewayConfig(com.sequenceiq.cloudbreak.orchestrator.model.GatewayConfig)

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