Skip to content

Commit 5f49e43

Browse files
author
Fly.io CI
committed
Allow setting Patroni failsafe mode
1 parent 3133fcb commit 5f49e43

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

internal/patroni/config.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,11 @@ func DynamicConfiguration(
190190
root["ttl"] = *cluster.Spec.Patroni.LeaderLeaseDurationSeconds
191191
root["loop_wait"] = *cluster.Spec.Patroni.SyncPeriodSeconds
192192

193+
// Set failsafe_mode if enabled
194+
if cluster.Spec.Patroni.FailsafeMode != nil && *cluster.Spec.Patroni.FailsafeMode {
195+
root["failsafe_mode"] = true
196+
}
197+
193198
// Copy the "postgresql" section before making any changes.
194199
postgresql := map[string]any{
195200
// TODO(cbandy): explain this. requires an archive, perhaps.

pkg/apis/postgres-operator.crunchydata.com/v1beta1/patroni_types.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,13 @@ type PatroniSpec struct {
1515
// +kubebuilder:validation:Type=object
1616
DynamicConfiguration SchemalessObject `json:"dynamicConfiguration,omitempty"`
1717

18+
// FailsafeMode enables Patroni's failsafe mode which prevents any automated failovers.
19+
// This is useful when performing dangerous operations like major version upgrades.
20+
// More info: https://patroni.readthedocs.io/en/latest/dcs_failsafe_mode.html
21+
// +optional
22+
// +kubebuilder:default=false
23+
FailsafeMode *bool `json:"failsafeMode,omitempty"`
24+
1825
// TTL of the cluster leader lock. "Think of it as the
1926
// length of time before initiation of the automatic failover process."
2027
// Changing this value causes PostgreSQL to restart.

0 commit comments

Comments
 (0)