Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

revert change where we have ha enabled all the time #689

Merged
merged 1 commit into from
Mar 29, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 19 additions & 27 deletions tembo-operator/src/cloudnativepg/cnpg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -601,32 +601,24 @@ fn cnpg_cluster_storage_class(cdb: &CoreDB) -> Option<String> {
}

// Check replica count to enable HA
fn cnpg_high_availability() -> Option<ClusterReplicationSlots> {
// if cdb.spec.replicas > 1 {
// Some(ClusterReplicationSlots {
// high_availability: Some(ClusterReplicationSlotsHighAvailability {
// enabled: Some(true),
// ..ClusterReplicationSlotsHighAvailability::default()
// }),
// update_interval: Some(30),
// })
// } else {
// Some(ClusterReplicationSlots {
// high_availability: Some(ClusterReplicationSlotsHighAvailability {
// enabled: Some(false),
// ..ClusterReplicationSlotsHighAvailability::default()
// }),
// update_interval: Some(30),
// })
// }
// Since CNPG 1.21, replication slots are always enabled
Some(ClusterReplicationSlots {
high_availability: Some(ClusterReplicationSlotsHighAvailability {
enabled: Some(true),
..ClusterReplicationSlotsHighAvailability::default()
}),
update_interval: Some(30),
})
fn cnpg_high_availability(cdb: &CoreDB) -> Option<ClusterReplicationSlots> {
if cdb.spec.replicas > 1 {
Some(ClusterReplicationSlots {
high_availability: Some(ClusterReplicationSlotsHighAvailability {
enabled: Some(true),
..ClusterReplicationSlotsHighAvailability::default()
}),
update_interval: Some(30),
})
} else {
Some(ClusterReplicationSlots {
high_availability: Some(ClusterReplicationSlotsHighAvailability {
enabled: Some(false),
..ClusterReplicationSlotsHighAvailability::default()
}),
update_interval: Some(30),
})
}
}

fn default_cluster_annotations(cdb: &CoreDB) -> BTreeMap<String, String> {
Expand Down Expand Up @@ -655,7 +647,7 @@ pub fn cnpg_cluster_from_cdb(
let (bootstrap, external_clusters, superuser_secret) = cnpg_cluster_bootstrap_from_cdb(cdb);
let (backup, service_account_template) = cnpg_backup_configuration(cdb, &cfg);
let storage = cnpg_cluster_storage(cdb);
let replication = cnpg_high_availability();
let replication = cnpg_high_availability(cdb);

let PostgresConfig {
postgres_parameters,
Expand Down
Loading