Search in sources :

Example 1 with StackGresDbOpsSecurityUpgradeStatus

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);
    });
}
Also used : StackGresDbOpsStatus(io.stackgres.common.crd.sgdbops.StackGresDbOpsStatus) StackGresDbOpsSecurityUpgradeStatus(io.stackgres.common.crd.sgdbops.StackGresDbOpsSecurityUpgradeStatus)

Example 2 with StackGresDbOpsSecurityUpgradeStatus

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;
}
Also used : DbOpsSecurityUpgradeStatus(io.stackgres.apiweb.dto.dbops.DbOpsSecurityUpgradeStatus) StackGresDbOpsSecurityUpgradeStatus(io.stackgres.common.crd.sgdbops.StackGresDbOpsSecurityUpgradeStatus)

Example 3 with StackGresDbOpsSecurityUpgradeStatus

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);
}
Also used : ObjectMeta(io.fabric8.kubernetes.api.model.ObjectMeta) StackGresDbOpsSecurityUpgradeStatus(io.stackgres.common.crd.sgdbops.StackGresDbOpsSecurityUpgradeStatus)

Aggregations

StackGresDbOpsSecurityUpgradeStatus (io.stackgres.common.crd.sgdbops.StackGresDbOpsSecurityUpgradeStatus)3 ObjectMeta (io.fabric8.kubernetes.api.model.ObjectMeta)1 DbOpsSecurityUpgradeStatus (io.stackgres.apiweb.dto.dbops.DbOpsSecurityUpgradeStatus)1 StackGresDbOpsStatus (io.stackgres.common.crd.sgdbops.StackGresDbOpsStatus)1