use of io.stackgres.apiweb.dto.distributedlogs.DistributedLogsSpec in project stackgres by ongres.
the class DistributedLogsTransformer method getResourceSpec.
private DistributedLogsSpec getResourceSpec(StackGresDistributedLogsSpec source) {
DistributedLogsSpec transformation = new DistributedLogsSpec();
transformation.setPersistentVolume(getResourcePersistentVolume(source.getPersistentVolume()));
transformation.setNonProduction(getResourceNonProduction(source.getNonProduction()));
transformation.setPostgresServices(new DistributedLogsPostgresServicesConverter().from(source.getPostgresServices()));
transformation.setScheduling(Optional.ofNullable(source.getScheduling()).map(sourcePodScheduling -> {
DistributedLogsPodScheduling podScheduling = new DistributedLogsPodScheduling();
podScheduling.setNodeSelector(sourcePodScheduling.getNodeSelector());
podScheduling.setTolerations(sourcePodScheduling.getTolerations());
return podScheduling;
}).orElse(null));
Optional.ofNullable(source.getMetadata()).map(StackGresDistributedLogsSpecMetadata::getAnnotations).ifPresent(sourceAnnotations -> {
transformation.setMetadata(new DistributedLogsSpecMetadata());
final DistributedLogsSpecAnnotations targetAnnotations = new DistributedLogsSpecAnnotations();
transformation.getMetadata().setAnnotations(targetAnnotations);
if (sourceAnnotations.getAllResources() != null) {
targetAnnotations.setAllResources(sourceAnnotations.getAllResources());
}
if (sourceAnnotations.getPods() != null) {
targetAnnotations.setPods(sourceAnnotations.getPods());
}
if (sourceAnnotations.getServices() != null) {
targetAnnotations.setServices(sourceAnnotations.getServices());
}
});
if (source.getToInstallPostgresExtensions() != null) {
transformation.setToInstallPostgresExtensions(source.getToInstallPostgresExtensions().stream().map(this::getClusterInstalledExtension).collect(ImmutableList.toImmutableList()));
}
return transformation;
}
use of io.stackgres.apiweb.dto.distributedlogs.DistributedLogsSpec in project stackgres by ongres.
the class DistributedLogsTransformer method toCustomResource.
@Override
public StackGresDistributedLogs toCustomResource(DistributedLogsDto source, StackGresDistributedLogs original) {
StackGresDistributedLogs transformation = Optional.ofNullable(original).orElseGet(StackGresDistributedLogs::new);
transformation.setMetadata(getCustomResourceMetadata(source, original));
final DistributedLogsSpec spec = source.getSpec();
if (spec != null) {
transformation.setSpec(getCustomResourceSpec(spec));
}
return transformation;
}
Aggregations