use of io.stackgres.common.crd.sgpgconfig.StackGresPostgresConfigStatus in project stackgres by ongres.
the class PostgresConfigTransformerTest method createEmptyConfig.
StackGresPostgresConfig createEmptyConfig() {
StackGresPostgresConfig source = new StackGresPostgresConfig();
source.setMetadata(new ObjectMeta());
source.getMetadata().setNamespace("default");
source.getMetadata().setName("test");
source.getMetadata().setUid("test");
source.setSpec(new StackGresPostgresConfigSpec());
source.getSpec().setPostgresVersion("11");
source.getSpec().setPostgresqlConf(ImmutableMap.of());
source.setStatus(new StackGresPostgresConfigStatus());
source.getStatus().setDefaultParameters(ImmutableMap.of());
return source;
}
use of io.stackgres.common.crd.sgpgconfig.StackGresPostgresConfigStatus in project stackgres by ongres.
the class PatroniConfigEndpointsTest method setUp.
@BeforeEach
void setUp() {
generator = new PatroniConfigEndpoints(MAPPER, labelFactory);
cluster = JsonUtil.readFromJson("stackgres_cluster/default.json", StackGresCluster.class);
backupConfig = JsonUtil.readFromJson("backup_config/default.json", StackGresBackupConfig.class);
postgresConfig = JsonUtil.readFromJson("postgres_config/default_postgres.json", StackGresPostgresConfig.class);
postgresConfig.setStatus(new StackGresPostgresConfigStatus());
postgresConfig.getStatus().setDefaultParameters(PostgresDefaultValues.getDefaultValues());
lenient().when(context.getBackupConfig()).thenReturn(Optional.of(backupConfig));
lenient().when(context.getPostgresConfig()).thenReturn(postgresConfig);
}
use of io.stackgres.common.crd.sgpgconfig.StackGresPostgresConfigStatus in project stackgres by ongres.
the class PgConfigDefaultStateMutator method mutate.
@Override
public List<JsonPatchOperation> mutate(PgConfigReview review) {
List<JsonPatchOperation> operations = new ArrayList<>();
StackGresPostgresConfig pgConfig = review.getRequest().getObject();
if (pgConfig.getStatus() == null) {
pgConfig.setStatus(new StackGresPostgresConfigStatus());
operations.add(buildAddOperation(PG_CONFIG_DEFAULT_PARAMETERS_POINTER.parent(), MAPPER.createObjectNode()));
}
operations.addAll(mutate(PG_CONFIG_DEFAULT_PARAMETERS_POINTER, pgConfig));
return operations;
}
use of io.stackgres.common.crd.sgpgconfig.StackGresPostgresConfigStatus in project stackgres by ongres.
the class PostgresConfigTransformer method getResourceStatus.
private PostgresConfigStatus getResourceStatus(List<String> clusters, StackGresPostgresConfigStatus source, StackGresPostgresConfigSpec sourceSpec) {
PostgresConfigStatus transformation = new PostgresConfigStatus();
transformation.setClusters(clusters);
if (sourceSpec != null) {
transformation.setPostgresqlConf(Seq.seq(sourceSpec.getPostgresqlConf()).map(t -> t.concat(new PostgresqlConfParameter())).peek(t -> t.v3.setParameter(t.v1)).peek(t -> t.v3.setValue(t.v2)).peek(t -> {
if (!t.v1.contains(".")) {
t.v3.setDocumentationLink(String.format(POSTGRESQLCO_NF_URL, t.v1, sourceSpec.getPostgresVersion()));
}
}).map(Tuple3::v3).toList());
}
if (source != null) {
transformation.setDefaultParameters(source.getDefaultParameters());
}
return transformation;
}
use of io.stackgres.common.crd.sgpgconfig.StackGresPostgresConfigStatus 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