Skip to content
Open
Show file tree
Hide file tree
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
6 changes: 6 additions & 0 deletions manifests/postgresql.crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,12 @@ spec:
properties:
failsafe_mode:
type: boolean
ignore_slots:
type: array
items:
type: object
additionalProperties:
type: string
initdb:
type: object
additionalProperties:
Expand Down
1 change: 1 addition & 0 deletions pkg/apis/acid.zalan.do/v1/postgresql_type.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ type Patroni struct {
SynchronousModeStrict bool `json:"synchronous_mode_strict,omitempty"`
SynchronousNodeCount uint32 `json:"synchronous_node_count,omitempty" defaults:"1"`
FailsafeMode *bool `json:"failsafe_mode,omitempty"`
IgnoreSlots []map[string]string `json:"ignore_slots,omitempty"`
}

// StandbyDescription contains remote primary config or s3/gs wal path
Expand Down
13 changes: 13 additions & 0 deletions pkg/apis/acid.zalan.do/v1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions pkg/cluster/k8sres.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ type patroniDCS struct {
PGBootstrapConfiguration map[string]interface{} `json:"postgresql,omitempty"`
Slots map[string]map[string]string `json:"slots,omitempty"`
FailsafeMode *bool `json:"failsafe_mode,omitempty"`
IgnoreSlots []map[string]string `json:"ignore_slots,omitempty"`
}

type pgBootstrap struct {
Expand Down Expand Up @@ -441,6 +442,10 @@ PatroniInitDBParams:
config.Bootstrap.DCS.FailsafeMode = opConfig.EnablePatroniFailsafeMode
}


if patroni.IgnoreSlots != nil {
config.Bootstrap.DCS.IgnoreSlots = patroni.IgnoreSlots
}
config.PgLocalConfiguration = make(map[string]interface{})

// the newer and preferred way to specify the PG version is to use the `PGVERSION` env variable
Expand Down
11 changes: 11 additions & 0 deletions pkg/cluster/k8sres_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,17 @@ func TestGenerateSpiloJSONConfiguration(t *testing.T) {
},
result: `{"postgresql":{"bin_dir":"/usr/lib/postgresql/17/bin"},"bootstrap":{"initdb":[{"auth-host":"md5"},{"auth-local":"trust"}],"dcs":{"failsafe_mode":true}}}`,
},
{
subtest: "Patroni ignore_slots configured for PostgreSQL 17 slot sync",
pgParam: &acidv1.PostgresqlParam{PgVersion: "17"},
patroni: &acidv1.Patroni{
IgnoreSlots: []map[string]string{
{"type": "logical"},
},
},
opConfig: &config.Config{},
result: `{"postgresql":{"bin_dir":"/usr/lib/postgresql/17/bin"},"bootstrap":{"initdb":[{"auth-host":"md5"},{"auth-local":"trust"}],"dcs":{"ignore_slots":[{"type":"logical"}]}}}`,
},
}
for _, tt := range tests {
cluster.OpConfig = *tt.opConfig
Expand Down