Skip to content

Commit 2170dad

Browse files
committed
K8SPG-704: Allow configuring create_replica_methods
1 parent 25a8189 commit 2170dad

File tree

11 files changed

+113
-0
lines changed

11 files changed

+113
-0
lines changed

Diff for: build/crd/crunchy/generated/postgres-operator.crunchydata.com_postgresclusters.yaml

+9
Original file line numberDiff line numberDiff line change
@@ -14017,6 +14017,15 @@ spec:
1401714017
type: boolean
1401814018
patroni:
1401914019
properties:
14020+
createReplicaMethods:
14021+
description: CreateReplicaMethods allows overriding create_replica_methods
14022+
for all instances.
14023+
items:
14024+
enum:
14025+
- basebackup
14026+
- pgbackrest
14027+
type: string
14028+
type: array
1402014029
dynamicConfiguration:
1402114030
description: |-
1402214031
Patroni dynamic configuration settings. Changes to this value will be

Diff for: build/crd/percona/generated/pgv2.percona.com_perconapgclusters.yaml

+9
Original file line numberDiff line numberDiff line change
@@ -13347,6 +13347,15 @@ spec:
1334713347
type: boolean
1334813348
patroni:
1334913349
properties:
13350+
createReplicaMethods:
13351+
description: CreateReplicaMethods allows overriding create_replica_methods
13352+
for all instances.
13353+
items:
13354+
enum:
13355+
- basebackup
13356+
- pgbackrest
13357+
type: string
13358+
type: array
1335013359
dynamicConfiguration:
1335113360
description: |-
1335213361
Patroni dynamic configuration settings. Changes to this value will be

Diff for: config/crd/bases/pgv2.percona.com_perconapgclusters.yaml

+9
Original file line numberDiff line numberDiff line change
@@ -13752,6 +13752,15 @@ spec:
1375213752
type: boolean
1375313753
patroni:
1375413754
properties:
13755+
createReplicaMethods:
13756+
description: CreateReplicaMethods allows overriding create_replica_methods
13757+
for all instances.
13758+
items:
13759+
enum:
13760+
- basebackup
13761+
- pgbackrest
13762+
type: string
13763+
type: array
1375513764
dynamicConfiguration:
1375613765
description: |-
1375713766
Patroni dynamic configuration settings. Changes to this value will be

Diff for: config/crd/bases/postgres-operator.crunchydata.com_postgresclusters.yaml

+9
Original file line numberDiff line numberDiff line change
@@ -13959,6 +13959,15 @@ spec:
1395913959
type: boolean
1396013960
patroni:
1396113961
properties:
13962+
createReplicaMethods:
13963+
description: CreateReplicaMethods allows overriding create_replica_methods
13964+
for all instances.
13965+
items:
13966+
enum:
13967+
- basebackup
13968+
- pgbackrest
13969+
type: string
13970+
type: array
1396213971
dynamicConfiguration:
1396313972
description: |-
1396413973
Patroni dynamic configuration settings. Changes to this value will be

Diff for: deploy/bundle.yaml

+18
Original file line numberDiff line numberDiff line change
@@ -14045,6 +14045,15 @@ spec:
1404514045
type: boolean
1404614046
patroni:
1404714047
properties:
14048+
createReplicaMethods:
14049+
description: CreateReplicaMethods allows overriding create_replica_methods
14050+
for all instances.
14051+
items:
14052+
enum:
14053+
- basebackup
14054+
- pgbackrest
14055+
type: string
14056+
type: array
1404814057
dynamicConfiguration:
1404914058
description: |-
1405014059
Patroni dynamic configuration settings. Changes to this value will be
@@ -39639,6 +39648,15 @@ spec:
3963939648
type: boolean
3964039649
patroni:
3964139650
properties:
39651+
createReplicaMethods:
39652+
description: CreateReplicaMethods allows overriding create_replica_methods
39653+
for all instances.
39654+
items:
39655+
enum:
39656+
- basebackup
39657+
- pgbackrest
39658+
type: string
39659+
type: array
3964239660
dynamicConfiguration:
3964339661
description: |-
3964439662
Patroni dynamic configuration settings. Changes to this value will be

Diff for: deploy/cr.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -487,6 +487,9 @@ spec:
487487
# max_worker_processes: 2
488488
# shared_buffers: 1GB
489489
# work_mem: 2MB
490+
# createReplicaMethods:
491+
# - pgbackrest
492+
# - basebackup
490493

491494
# extensions:
492495
# image: perconalab/percona-postgresql-operator:main

Diff for: deploy/crd.yaml

+18
Original file line numberDiff line numberDiff line change
@@ -14045,6 +14045,15 @@ spec:
1404514045
type: boolean
1404614046
patroni:
1404714047
properties:
14048+
createReplicaMethods:
14049+
description: CreateReplicaMethods allows overriding create_replica_methods
14050+
for all instances.
14051+
items:
14052+
enum:
14053+
- basebackup
14054+
- pgbackrest
14055+
type: string
14056+
type: array
1404814057
dynamicConfiguration:
1404914058
description: |-
1405014059
Patroni dynamic configuration settings. Changes to this value will be
@@ -39639,6 +39648,15 @@ spec:
3963939648
type: boolean
3964039649
patroni:
3964139650
properties:
39651+
createReplicaMethods:
39652+
description: CreateReplicaMethods allows overriding create_replica_methods
39653+
for all instances.
39654+
items:
39655+
enum:
39656+
- basebackup
39657+
- pgbackrest
39658+
type: string
39659+
type: array
3964239660
dynamicConfiguration:
3964339661
description: |-
3964439662
Patroni dynamic configuration settings. Changes to this value will be

Diff for: deploy/cw-bundle.yaml

+18
Original file line numberDiff line numberDiff line change
@@ -14045,6 +14045,15 @@ spec:
1404514045
type: boolean
1404614046
patroni:
1404714047
properties:
14048+
createReplicaMethods:
14049+
description: CreateReplicaMethods allows overriding create_replica_methods
14050+
for all instances.
14051+
items:
14052+
enum:
14053+
- basebackup
14054+
- pgbackrest
14055+
type: string
14056+
type: array
1404814057
dynamicConfiguration:
1404914058
description: |-
1405014059
Patroni dynamic configuration settings. Changes to this value will be
@@ -39639,6 +39648,15 @@ spec:
3963939648
type: boolean
3964039649
patroni:
3964139650
properties:
39651+
createReplicaMethods:
39652+
description: CreateReplicaMethods allows overriding create_replica_methods
39653+
for all instances.
39654+
items:
39655+
enum:
39656+
- basebackup
39657+
- pgbackrest
39658+
type: string
39659+
type: array
3964239660
dynamicConfiguration:
3964339661
description: |-
3964439662
Patroni dynamic configuration settings. Changes to this value will be

Diff for: internal/patroni/config.go

+8
Original file line numberDiff line numberDiff line change
@@ -585,6 +585,14 @@ func instanceYAML(
585585
methods = append([]string{pgBackRestCreateReplicaMethod}, methods...)
586586
}
587587

588+
// K8SPG-704: Allow overriding create replica methods list
589+
if cluster.Spec.Patroni != nil && len(cluster.Spec.Patroni.CreateReplicaMethods) > 0 {
590+
methods = []string{}
591+
for _, m := range cluster.Spec.Patroni.CreateReplicaMethods {
592+
methods = append(methods, string(m))
593+
}
594+
}
595+
588596
// NOTE(cbandy): Is there any chance a user might want to specify their own
589597
// method? This is a list and cannot be merged.
590598
postgresql["create_replica_methods"] = methods

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

+7
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,19 @@ type PatroniSpec struct {
4242
// +optional
4343
Switchover *PatroniSwitchover `json:"switchover,omitempty"`
4444

45+
// CreateReplicaMethods allows overriding create_replica_methods for all instances.
46+
// +optional
47+
CreateReplicaMethods []CreateReplicaMethod `json:"createReplicaMethods,omitempty"`
48+
4549
// TODO(cbandy): Add UseConfigMaps bool, default false.
4650
// TODO(cbandy): Allow other DCS: etcd, raft, etc?
4751
// N.B. changing this will cause downtime.
4852
// - https://patroni.readthedocs.io/en/latest/kubernetes.html
4953
}
5054

55+
// +kubebuilder:validation:Enum={basebackup,pgbackrest}
56+
type CreateReplicaMethod string
57+
5158
type PatroniSwitchover struct {
5259

5360
// Whether or not the operator should allow switchovers in a PostgresCluster

Diff for: pkg/apis/postgres-operator.crunchydata.com/v1beta1/zz_generated.deepcopy.go

+5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)