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());
}
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);
}
}
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())));
}
}
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);
}
Aggregations