use of io.stackgres.common.crd.sgdbops.StackGresDbOpsSecurityUpgradeStatus in project stackgres by ongres.
the class SecurityUpgradeJob 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().getSecurityUpgrade() == null) {
savedDbOps.getStatus().setSecurityUpgrade(new StackGresDbOpsSecurityUpgradeStatus());
}
savedDbOps.getStatus().getSecurityUpgrade().setFailure(message);
dbOpsScheduler.update(savedDbOps);
});
}
use of io.stackgres.common.crd.sgdbops.StackGresDbOpsSecurityUpgradeStatus in project stackgres by ongres.
the class DbOpsTransformer method getResourceSecurityUpgradeStatus.
private DbOpsSecurityUpgradeStatus getResourceSecurityUpgradeStatus(StackGresDbOpsSecurityUpgradeStatus source) {
if (source == null) {
return null;
}
DbOpsSecurityUpgradeStatus transformation = new DbOpsSecurityUpgradeStatus();
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;
}
use of io.stackgres.common.crd.sgdbops.StackGresDbOpsSecurityUpgradeStatus in project stackgres by ongres.
the class ClusterRestartStateHandlerImplTest method initializeDbOpsStatus.
public void initializeDbOpsStatus(StackGresDbOps dbOps, List<Pod> pods) {
final StackGresDbOpsSecurityUpgradeStatus securityUpgrade = new StackGresDbOpsSecurityUpgradeStatus();
securityUpgrade.setInitialInstances(pods.stream().map(Pod::getMetadata).map(ObjectMeta::getName).collect(Collectors.toList()));
securityUpgrade.setPrimaryInstance(getPrimaryInstance(pods).getMetadata().getName());
securityUpgrade.setPendingToRestartInstances(pods.stream().map(Pod::getMetadata).map(ObjectMeta::getName).collect(Collectors.toList()));
securityUpgrade.setSwitchoverInitiated(Boolean.FALSE.toString());
dbOps.getStatus().setSecurityUpgrade(securityUpgrade);
}
Aggregations