use of io.stackgres.common.crd.sgpooling.StackGresPoolingConfigStatus 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;
}
use of io.stackgres.common.crd.sgpooling.StackGresPoolingConfigStatus in project stackgres by ongres.
the class PoolingConfigTransformer method getResourceStatus.
private PoolingConfigStatus getResourceStatus(List<String> clusters, StackGresPoolingConfigStatus source, StackGresPoolingConfigSpec sourceSpec) {
PoolingConfigStatus transformation = new PoolingConfigStatus();
transformation.setClusters(clusters);
transformation.setPgBouncer(new PoolingConfigPgBouncerStatus());
transformation.getPgBouncer().setParameters(Seq.seq(sourceSpec.getPgBouncer().getPgbouncerIni().getParameters()).map(t -> t.concat(new PgBouncerIniParameter())).peek(t -> t.v3.setParameter(t.v1)).peek(t -> t.v3.setValue(t.v2)).map(Tuple3::v3).toList());
if (source != null && source.getPgBouncer() != null) {
transformation.getPgBouncer().setDefaultParameters(source.getPgBouncer().getDefaultParameters());
}
return transformation;
}
use of io.stackgres.common.crd.sgpooling.StackGresPoolingConfigStatus 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);
}
Aggregations