use of com.sequenceiq.cloudbreak.telemetry.common.TelemetryCommonConfigView in project cloudbreak by hortonworks.
the class TelemetryDecoratorTest method testDecorateWithMonitoring.
@Test
public void testDecorateWithMonitoring() {
// GIVEN
Map<String, SaltPillarProperties> servicePillar = new HashMap<>();
TelemetryClusterDetails clusterDetails = TelemetryClusterDetails.Builder.builder().withCrn("myClusterCrn").withType("datahub").withVersion("1.0.0").build();
MonitoringConfigView monitoringConfigView = new MonitoringConfigView.Builder().withEnabled(true).withClusterDetails(clusterDetails).build();
NodeStatusConfigView nodeStatusConfigView = new NodeStatusConfigView.Builder().withServerUsername("admin").withServerPassword("admin".toCharArray()).build();
DatabusConfigView dataConfigView = new DatabusConfigView.Builder().build();
TelemetryCommonConfigView telemetryCommonConfigView = new TelemetryCommonConfigView.Builder().withClusterDetails(clusterDetails).build();
MeteringConfigView meteringConfigView = new MeteringConfigView.Builder().build();
mockConfigServiceResults(dataConfigView, new FluentConfigView.Builder().build(), meteringConfigView, monitoringConfigView, nodeStatusConfigView, telemetryCommonConfigView);
// WHEN
Map<String, SaltPillarProperties> result = underTest.decoratePillar(servicePillar, createStack(), new Telemetry());
// THEN
Map<String, Object> results = createMapFromFluentPillars(result, "monitoring");
assertEquals(results.get("clusterType"), "datahub");
assertEquals(results.get("clusterVersion"), "1.0.0");
assertEquals(results.get("clusterCrn"), "myClusterCrn");
assertEquals(results.get("enabled"), true);
}
use of com.sequenceiq.cloudbreak.telemetry.common.TelemetryCommonConfigView in project cloudbreak by hortonworks.
the class TelemetryDecorator method decoratePillar.
public Map<String, SaltPillarProperties> decoratePillar(Map<String, SaltPillarProperties> servicePillar, Stack stack, Telemetry telemetry, DataBusCredential dataBusCredential) {
AltusCredential dbusCredential = getAltusCredentialForDataBus(stack, telemetry, dataBusCredential);
String clusterType = StackType.DATALAKE.equals(stack.getType()) ? FluentClusterType.DATALAKE.value() : FluentClusterType.DATAHUB.value();
String serviceType = StackType.WORKLOAD.equals(stack.getType()) ? FluentClusterType.DATAHUB.value() : "";
String accountId = Crn.safeFromString(stack.getResourceCrn()).getAccountId();
boolean useDbusCnameEndpoint = entitlementService.useDataBusCNameEndpointEnabled(accountId);
String databusEndpoint = dataBusEndpointProvider.getDataBusEndpoint(telemetry.getDatabusEndpoint(), useDbusCnameEndpoint);
String databusS3Endpoint = dataBusEndpointProvider.getDatabusS3Endpoint(databusEndpoint);
DatabusConfigView databusConfigView = databusConfigService.createDatabusConfigs(dbusCredential.getAccessKey(), dbusCredential.getPrivateKey(), null, databusEndpoint);
if (databusConfigView.isEnabled()) {
Map<String, Object> databusConfig = databusConfigView.toMap();
servicePillar.put("databus", new SaltPillarProperties("/databus/init.sls", singletonMap("databus", databusConfig)));
}
boolean datalakeCluster = StackType.DATALAKE.equals(stack.getType());
boolean meteringFeatureEnabled = telemetry.isMeteringFeatureEnabled();
// for datalake - metering is not enabled yet
boolean meteringEnabled = meteringFeatureEnabled && !datalakeCluster;
boolean databusEndpointValidationEnabled = !datalakeCluster && entitlementService.isDatahubDatabusEndpointValidationEnabled(accountId);
String clusterCrn = datalakeCluster ? getDatalakeCrn(telemetry, stack.getResourceCrn()) : stack.getResourceCrn();
final TelemetryClusterDetails clusterDetails = TelemetryClusterDetails.Builder.builder().withOwner(stack.getCreator().getUserCrn()).withName(stack.getName()).withType(clusterType).withCrn(clusterCrn).withPlatform(stack.getCloudPlatform()).withVersion(version).withDatabusEndpoint(databusEndpoint).withDatabusS3Endpoint(databusS3Endpoint).withDatabusEndpointValidation(databusEndpointValidationEnabled).build();
final TelemetryCommonConfigView telemetryCommonConfigs = telemetryCommonConfigService.createTelemetryCommonConfigs(telemetry, vmLogsService.getVmLogs(), clusterDetails);
servicePillar.put("telemetry", new SaltPillarProperties("/telemetry/init.sls", Collections.singletonMap("telemetry", telemetryCommonConfigs.toMap())));
FluentConfigView fluentConfigView = fluentConfigService.createFluentConfigs(clusterDetails, databusConfigView.isEnabled(), meteringEnabled, stack.getRegion(), telemetry);
if (fluentConfigView.isEnabled()) {
Map<String, Object> fluentConfig = fluentConfigView.toMap();
servicePillar.put("fluent", new SaltPillarProperties("/fluent/init.sls", singletonMap("fluent", fluentConfig)));
}
boolean cdpSaasEnabled = entitlementService.isCdpSaasEnabled(accountId);
setupMetering(servicePillar, stack, serviceType, meteringEnabled);
char[] nodePasswordInput = null;
if (StringUtils.isNotBlank(stack.getCluster().getCdpNodeStatusMonitorPassword())) {
nodePasswordInput = stack.getCluster().getCdpNodeStatusMonitorPassword().toCharArray();
}
setupMonitoring(servicePillar, cdpSaasEnabled, stack, telemetry, nodePasswordInput);
setupNodeStatusMonitor(servicePillar, stack, nodePasswordInput);
return servicePillar;
}
use of com.sequenceiq.cloudbreak.telemetry.common.TelemetryCommonConfigView in project cloudbreak by hortonworks.
the class TelemetryConfigService method getTelemetryCommonPillarConfig.
private Map<String, SaltPillarProperties> getTelemetryCommonPillarConfig(Stack stack, Telemetry telemetry, String databusEndpoint, boolean databusEndpointValidation) {
TelemetryClusterDetails clusterDetails = TelemetryClusterDetails.Builder.builder().withVersion(version).withPlatform(stack.getCloudPlatform()).withCrn(stack.getResourceCrn()).withName(stack.getName()).withType(FluentClusterType.FREEIPA.value()).withOwner(stack.getOwner()).withDatabusEndpoint(databusEndpoint).withDatabusS3Endpoint(dataBusEndpointProvider.getDatabusS3Endpoint(databusEndpoint)).withDatabusEndpointValidation(databusEndpointValidation).build();
TelemetryCommonConfigView telemetryCommonConfigs = telemetryCommonConfigService.createTelemetryCommonConfigs(telemetry, vmLogsService.getVmLogs(), clusterDetails);
return Map.of("telemetry", new SaltPillarProperties("/telemetry/init.sls", Map.of("telemetry", telemetryCommonConfigs.toMap(), "cloudera-manager", getPaywallConfigs(stack))));
}
use of com.sequenceiq.cloudbreak.telemetry.common.TelemetryCommonConfigView in project cloudbreak by hortonworks.
the class TelemetryDecoratorTest method testDecorateWithSaasMonitoring.
@Test
public void testDecorateWithSaasMonitoring() {
// GIVEN
Map<String, SaltPillarProperties> servicePillar = new HashMap<>();
TelemetryClusterDetails clusterDetails = TelemetryClusterDetails.Builder.builder().withCrn("myClusterCrn").withType("datahub").withVersion("1.0.0").build();
MonitoringConfigView monitoringConfigView = new MonitoringConfigView.Builder().withEnabled(true).withClusterDetails(clusterDetails).build();
NodeStatusConfigView nodeStatusConfigView = new NodeStatusConfigView.Builder().withServerUsername("admin").withServerPassword("admin".toCharArray()).build();
DatabusConfigView dataConfigView = new DatabusConfigView.Builder().build();
TelemetryCommonConfigView telemetryCommonConfigView = new TelemetryCommonConfigView.Builder().withClusterDetails(clusterDetails).build();
MeteringConfigView meteringConfigView = new MeteringConfigView.Builder().build();
mockConfigServiceResults(dataConfigView, new FluentConfigView.Builder().build(), meteringConfigView, monitoringConfigView, nodeStatusConfigView, telemetryCommonConfigView);
given(entitlementService.isCdpSaasEnabled(anyString())).willReturn(true);
// WHEN
Map<String, SaltPillarProperties> result = underTest.decoratePillar(servicePillar, createStack(), new Telemetry());
// THEN
Map<String, Object> results = createMapFromFluentPillars(result, "monitoring");
assertEquals(results.get("clusterType"), "datahub");
assertEquals(results.get("clusterVersion"), "1.0.0");
assertEquals(results.get("clusterCrn"), "myClusterCrn");
assertEquals(results.get("enabled"), true);
}
Aggregations