use of io.stackgres.common.crd.sgdbops.StackGresDbOpsRestartStatus in project stackgres by ongres.
the class ClusterRestartStateHandlerImplTest method initializeDbOpsStatus.
@Override
protected void initializeDbOpsStatus(StackGresDbOps dbOps, List<Pod> pods) {
final StackGresDbOpsRestartStatus restartStatus = new StackGresDbOpsRestartStatus();
restartStatus.setInitialInstances(pods.stream().map(Pod::getMetadata).map(ObjectMeta::getName).collect(Collectors.toList()));
restartStatus.setPrimaryInstance(getPrimaryInstance(pods).getMetadata().getName());
restartStatus.setPendingToRestartInstances(pods.stream().map(Pod::getMetadata).map(ObjectMeta::getName).collect(Collectors.toList()));
restartStatus.setSwitchoverInitiated(Boolean.FALSE.toString());
dbOps.getStatus().setRestart(restartStatus);
}
use of io.stackgres.common.crd.sgdbops.StackGresDbOpsRestartStatus in project stackgres by ongres.
the class RestartJob method reportFailure.
private void reportFailure(StackGresDbOps dbOps, Throwable ex) {
String message = ex.getMessage();
String dbOpsName = dbOps.getMetadata().getName();
String namespace = dbOps.getMetadata().getNamespace();
dbOpsFinder.findByNameAndNamespace(dbOpsName, namespace).ifPresent(savedDbOps -> {
if (savedDbOps.getStatus() == null) {
savedDbOps.setStatus(new StackGresDbOpsStatus());
}
if (savedDbOps.getStatus().getRestart() == null) {
savedDbOps.getStatus().setRestart(new StackGresDbOpsRestartStatus());
}
savedDbOps.getStatus().getRestart().setFailure(message);
dbOpsScheduler.update(savedDbOps);
});
}
use of io.stackgres.common.crd.sgdbops.StackGresDbOpsRestartStatus in project stackgres by ongres.
the class DbOpsTransformer method getResourceRestartStatus.
private DbOpsRestartStatus getResourceRestartStatus(StackGresDbOpsRestartStatus source) {
if (source == null) {
return null;
}
DbOpsRestartStatus transformation = new DbOpsRestartStatus();
transformation.setPrimaryInstance(source.getPrimaryInstance());
transformation.setInitialInstances(source.getInitialInstances());
transformation.setPendingToRestartInstances(source.getPendingToRestartInstances());
transformation.setRestartedInstances(source.getRestartedInstances());
transformation.setSwitchoverInitiated(source.getSwitchoverInitiated());
transformation.setSwitchoverFinalized(source.getSwitchoverFinalized());
transformation.setFailure(source.getFailure());
return transformation;
}
Aggregations