Search in sources :

Example 1 with StackGresPoolingConfigPgBouncerStatus

use of io.stackgres.common.crd.sgpooling.StackGresPoolingConfigPgBouncerStatus in project stackgres by ongres.

the class PgBouncerDefaultStateMutator method mutate.

@Override
public List<JsonPatchOperation> mutate(PoolingReview review) {
    List<JsonPatchOperation> operations = new ArrayList<>();
    StackGresPoolingConfig pgBouncerConfig = review.getRequest().getObject();
    if (pgBouncerConfig.getStatus() == null) {
        pgBouncerConfig.setStatus(new StackGresPoolingConfigStatus());
        operations.add(buildAddOperation(PG_BOUNCER_DEFAULT_PARAMETERS_POINTER.parent().parent(), MAPPER.createObjectNode()));
    }
    if (pgBouncerConfig.getStatus().getPgBouncer() == null) {
        pgBouncerConfig.getStatus().setPgBouncer(new StackGresPoolingConfigPgBouncerStatus());
        operations.add(buildAddOperation(PG_BOUNCER_DEFAULT_PARAMETERS_POINTER.parent(), MAPPER.createObjectNode()));
    }
    operations.addAll(mutate(PG_BOUNCER_DEFAULT_PARAMETERS_POINTER, pgBouncerConfig));
    return operations;
}
Also used : StackGresPoolingConfig(io.stackgres.common.crd.sgpooling.StackGresPoolingConfig) ArrayList(java.util.ArrayList) StackGresPoolingConfigPgBouncerStatus(io.stackgres.common.crd.sgpooling.StackGresPoolingConfigPgBouncerStatus) JsonPatchOperation(com.github.fge.jsonpatch.JsonPatchOperation) StackGresPoolingConfigStatus(io.stackgres.common.crd.sgpooling.StackGresPoolingConfigStatus)

Example 2 with StackGresPoolingConfigPgBouncerStatus

use of io.stackgres.common.crd.sgpooling.StackGresPoolingConfigPgBouncerStatus in project stackgres by ongres.

the class ClusterRequiredResourcesGeneratorTest method setUp.

@BeforeEach
void setUp() {
    cluster = JsonUtil.readFromJson("stackgres_cluster/default.json", StackGresCluster.class);
    cluster.getSpec().getPostgres().setVersion(StackGresComponent.POSTGRESQL.findLatestVersion());
    final String namespace = cluster.getMetadata().getNamespace();
    backupConfig = JsonUtil.readFromJson("backup_config/default.json", StackGresBackupConfig.class);
    setNamespace(backupConfig);
    postgresConfig = JsonUtil.readFromJson("postgres_config/default_postgres.json", StackGresPostgresConfig.class);
    postgresConfig.getSpec().setPostgresVersion(StackGresComponent.POSTGRESQL.findLatestMajorVersion());
    setNamespace(postgresConfig);
    postgresConfig.setStatus(new StackGresPostgresConfigStatus());
    postgresConfig.getStatus().setDefaultParameters(PostgresDefaultValues.getDefaultValues());
    poolingConfig = JsonUtil.readFromJson("pooling_config/default.json", StackGresPoolingConfig.class);
    setNamespace(poolingConfig);
    poolingConfig.setStatus(new StackGresPoolingConfigStatus());
    poolingConfig.getStatus().setPgBouncer(new StackGresPoolingConfigPgBouncerStatus());
    poolingConfig.getStatus().getPgBouncer().setDefaultParameters(PgBouncerDefaultValues.getDefaultValues());
    instanceProfile = JsonUtil.readFromJson("stackgres_profiles/size-s.json", StackGresProfile.class);
    instanceProfile.getMetadata().setNamespace(namespace);
    setNamespace(instanceProfile);
    backups = JsonUtil.readFromJson("backup/list.json", StackGresBackupList.class).getItems();
    backups.forEach(this::setNamespace);
    minioSecret = JsonUtil.readFromJson("secret/minio.json", Secret.class);
}
Also used : Secret(io.fabric8.kubernetes.api.model.Secret) StackGresCluster(io.stackgres.common.crd.sgcluster.StackGresCluster) StackGresPoolingConfig(io.stackgres.common.crd.sgpooling.StackGresPoolingConfig) StackGresProfile(io.stackgres.common.crd.sgprofile.StackGresProfile) StackGresPoolingConfigPgBouncerStatus(io.stackgres.common.crd.sgpooling.StackGresPoolingConfigPgBouncerStatus) StackGresBackupConfig(io.stackgres.common.crd.sgbackupconfig.StackGresBackupConfig) StackGresPostgresConfig(io.stackgres.common.crd.sgpgconfig.StackGresPostgresConfig) StackGresPostgresConfigStatus(io.stackgres.common.crd.sgpgconfig.StackGresPostgresConfigStatus) StackGresPoolingConfigStatus(io.stackgres.common.crd.sgpooling.StackGresPoolingConfigStatus) BeforeEach(org.junit.jupiter.api.BeforeEach)

Aggregations

StackGresPoolingConfig (io.stackgres.common.crd.sgpooling.StackGresPoolingConfig)2 StackGresPoolingConfigPgBouncerStatus (io.stackgres.common.crd.sgpooling.StackGresPoolingConfigPgBouncerStatus)2 StackGresPoolingConfigStatus (io.stackgres.common.crd.sgpooling.StackGresPoolingConfigStatus)2 JsonPatchOperation (com.github.fge.jsonpatch.JsonPatchOperation)1 Secret (io.fabric8.kubernetes.api.model.Secret)1 StackGresBackupConfig (io.stackgres.common.crd.sgbackupconfig.StackGresBackupConfig)1 StackGresCluster (io.stackgres.common.crd.sgcluster.StackGresCluster)1 StackGresPostgresConfig (io.stackgres.common.crd.sgpgconfig.StackGresPostgresConfig)1 StackGresPostgresConfigStatus (io.stackgres.common.crd.sgpgconfig.StackGresPostgresConfigStatus)1 StackGresProfile (io.stackgres.common.crd.sgprofile.StackGresProfile)1 ArrayList (java.util.ArrayList)1 BeforeEach (org.junit.jupiter.api.BeforeEach)1