use of io.stackgres.common.crd.sgcluster.StackGresClusterRestorePitr in project stackgres by ongres.
the class ClusterPatroniEnvVarFactory method createResource.
@Override
public List<EnvVar> createResource(StackGresClusterContext context) {
StackGresCluster cluster = context.getSource();
List<EnvVar> additionalEnvVars = Optional.ofNullable(cluster.getSpec()).map(StackGresClusterSpec::getInitData).map(StackGresClusterInitData::getRestore).map(StackGresClusterRestore::getFromBackup).map(StackGresClusterRestoreFromBackup::getPointInTimeRecovery).map(StackGresClusterRestorePitr::getRestoreToTimestamp).map(Instant::parse).map(restoreToTimestamp -> new EnvVarBuilder().withName("RECOVERY_TARGET_TIME").withValue(DateTimeFormatter.ISO_LOCAL_DATE.withZone(ZoneId.from(ZoneOffset.UTC)).format(restoreToTimestamp) + " " + DateTimeFormatter.ISO_LOCAL_TIME.withZone(ZoneId.from(ZoneOffset.UTC)).format(restoreToTimestamp)).build()).map(List::of).orElse(List.of());
List<EnvVar> patroniEnvVars = createPatroniEnvVars(cluster);
return ImmutableList.<EnvVar>builder().add(new EnvVarBuilder().withName("PATRONI_RESTAPI_LISTEN").withValue("0.0.0.0:" + EnvoyUtil.PATRONI_PORT).build()).addAll(patroniEnvVars).addAll(additionalEnvVars).build();
}
use of io.stackgres.common.crd.sgcluster.StackGresClusterRestorePitr in project stackgres by ongres.
the class ClusterTransformer method getResourceRestorePitr.
private ClusterRestorePitr getResourceRestorePitr(StackGresClusterRestorePitr source) {
if (source == null) {
return null;
}
ClusterRestorePitr transformation = new ClusterRestorePitr();
transformation.setRestoreToTimestamp(source.getRestoreToTimestamp());
return transformation;
}
use of io.stackgres.common.crd.sgcluster.StackGresClusterRestorePitr in project stackgres by ongres.
the class ClusterTransformer method getCustomResourceRestorePitr.
private StackGresClusterRestorePitr getCustomResourceRestorePitr(ClusterRestorePitr source) {
if (source == null) {
return null;
}
StackGresClusterRestorePitr transformation = new StackGresClusterRestorePitr();
transformation.setRestoreToTimestamp(source.getRestoreToTimestamp());
return transformation;
}
Aggregations