Skip to content

Commit f62c485

Browse files
authored
Merge branch 'main' into K8SPG-613
2 parents ca136b8 + 9d8b028 commit f62c485

22 files changed

Lines changed: 223 additions & 31 deletions

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ uninstall: ## Delete the postgrescluster CRD
120120
deploy: ## Deploy the PostgreSQL Operator (enables the postgrescluster controller)
121121
yq eval '(.spec.template.spec.containers[] | select(.name=="operator")).image = "$(IMAGE)"' ./deploy/operator.yaml \
122122
| yq eval '(.spec.template.spec.containers[] | select(.name=="operator") | .env[] | select(.name=="DISABLE_TELEMETRY") | .value) = "true"' - \
123+
| yq eval '(.spec.template.spec.containers[] | select(.name=="operator") | .env[] | select(.name=="LOG_LEVEL") | .value) = "DEBUG"' - \
123124
| kubectl apply -f -
124125

125126
.PHONY: undeploy

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14540,6 +14540,15 @@ spec:
1454014540
type: boolean
1454114541
patroni:
1454214542
properties:
14543+
createReplicaMethods:
14544+
description: CreateReplicaMethods allows overriding create_replica_methods
14545+
for all instances.
14546+
items:
14547+
enum:
14548+
- basebackup
14549+
- pgbackrest
14550+
type: string
14551+
type: array
1454314552
dynamicConfiguration:
1454414553
description: |-
1454514554
Patroni dynamic configuration settings. Changes to this value will be

build/crd/percona/generated/pgv2.percona.com_perconapgclusters.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13872,6 +13872,15 @@ spec:
1387213872
type: boolean
1387313873
patroni:
1387413874
properties:
13875+
createReplicaMethods:
13876+
description: CreateReplicaMethods allows overriding create_replica_methods
13877+
for all instances.
13878+
items:
13879+
enum:
13880+
- basebackup
13881+
- pgbackrest
13882+
type: string
13883+
type: array
1387513884
dynamicConfiguration:
1387613885
description: |-
1387713886
Patroni dynamic configuration settings. Changes to this value will be

config/crd/bases/pgv2.percona.com_perconapgclusters.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14277,6 +14277,15 @@ spec:
1427714277
type: boolean
1427814278
patroni:
1427914279
properties:
14280+
createReplicaMethods:
14281+
description: CreateReplicaMethods allows overriding create_replica_methods
14282+
for all instances.
14283+
items:
14284+
enum:
14285+
- basebackup
14286+
- pgbackrest
14287+
type: string
14288+
type: array
1428014289
dynamicConfiguration:
1428114290
description: |-
1428214291
Patroni dynamic configuration settings. Changes to this value will be

config/crd/bases/postgres-operator.crunchydata.com_postgresclusters.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14482,6 +14482,15 @@ spec:
1448214482
type: boolean
1448314483
patroni:
1448414484
properties:
14485+
createReplicaMethods:
14486+
description: CreateReplicaMethods allows overriding create_replica_methods
14487+
for all instances.
14488+
items:
14489+
enum:
14490+
- basebackup
14491+
- pgbackrest
14492+
type: string
14493+
type: array
1448514494
dynamicConfiguration:
1448614495
description: |-
1448714496
Patroni dynamic configuration settings. Changes to this value will be

deploy/bundle.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14574,6 +14574,15 @@ spec:
1457414574
type: boolean
1457514575
patroni:
1457614576
properties:
14577+
createReplicaMethods:
14578+
description: CreateReplicaMethods allows overriding create_replica_methods
14579+
for all instances.
14580+
items:
14581+
enum:
14582+
- basebackup
14583+
- pgbackrest
14584+
type: string
14585+
type: array
1457714586
dynamicConfiguration:
1457814587
description: |-
1457914588
Patroni dynamic configuration settings. Changes to this value will be
@@ -40697,6 +40706,15 @@ spec:
4069740706
type: boolean
4069840707
patroni:
4069940708
properties:
40709+
createReplicaMethods:
40710+
description: CreateReplicaMethods allows overriding create_replica_methods
40711+
for all instances.
40712+
items:
40713+
enum:
40714+
- basebackup
40715+
- pgbackrest
40716+
type: string
40717+
type: array
4070040718
dynamicConfiguration:
4070140719
description: |-
4070240720
Patroni dynamic configuration settings. Changes to this value will be

deploy/cr.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -542,6 +542,9 @@ spec:
542542
# max_worker_processes: 2
543543
# shared_buffers: 1GB
544544
# work_mem: 2MB
545+
# createReplicaMethods:
546+
# - pgbackrest
547+
# - basebackup
545548

546549
# extensions:
547550
# image: perconalab/percona-postgresql-operator:main
@@ -555,6 +558,7 @@ spec:
555558
# name: cluster1-extensions-secret
556559
# builtin:
557560
# pg_stat_monitor: true
561+
# pg_stat_statements: false
558562
# pg_audit: true
559563
# pgvector: false
560564
# pg_repack: false

deploy/crd.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14574,6 +14574,15 @@ spec:
1457414574
type: boolean
1457514575
patroni:
1457614576
properties:
14577+
createReplicaMethods:
14578+
description: CreateReplicaMethods allows overriding create_replica_methods
14579+
for all instances.
14580+
items:
14581+
enum:
14582+
- basebackup
14583+
- pgbackrest
14584+
type: string
14585+
type: array
1457714586
dynamicConfiguration:
1457814587
description: |-
1457914588
Patroni dynamic configuration settings. Changes to this value will be
@@ -40697,6 +40706,15 @@ spec:
4069740706
type: boolean
4069840707
patroni:
4069940708
properties:
40709+
createReplicaMethods:
40710+
description: CreateReplicaMethods allows overriding create_replica_methods
40711+
for all instances.
40712+
items:
40713+
enum:
40714+
- basebackup
40715+
- pgbackrest
40716+
type: string
40717+
type: array
4070040718
dynamicConfiguration:
4070140719
description: |-
4070240720
Patroni dynamic configuration settings. Changes to this value will be

deploy/cw-bundle.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14574,6 +14574,15 @@ spec:
1457414574
type: boolean
1457514575
patroni:
1457614576
properties:
14577+
createReplicaMethods:
14578+
description: CreateReplicaMethods allows overriding create_replica_methods
14579+
for all instances.
14580+
items:
14581+
enum:
14582+
- basebackup
14583+
- pgbackrest
14584+
type: string
14585+
type: array
1457714586
dynamicConfiguration:
1457814587
description: |-
1457914588
Patroni dynamic configuration settings. Changes to this value will be
@@ -40697,6 +40706,15 @@ spec:
4069740706
type: boolean
4069840707
patroni:
4069940708
properties:
40709+
createReplicaMethods:
40710+
description: CreateReplicaMethods allows overriding create_replica_methods
40711+
for all instances.
40712+
items:
40713+
enum:
40714+
- basebackup
40715+
- pgbackrest
40716+
type: string
40717+
type: array
4070040718
dynamicConfiguration:
4070140719
description: |-
4070240720
Patroni dynamic configuration settings. Changes to this value will be

internal/controller/postgrescluster/controller.go

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,16 @@ import (
2727
"sigs.k8s.io/controller-runtime/pkg/builder"
2828
"sigs.k8s.io/controller-runtime/pkg/client"
2929
"sigs.k8s.io/controller-runtime/pkg/controller/controllerutil"
30+
"sigs.k8s.io/controller-runtime/pkg/event"
3031
"sigs.k8s.io/controller-runtime/pkg/manager"
32+
"sigs.k8s.io/controller-runtime/pkg/predicate"
3133
"sigs.k8s.io/controller-runtime/pkg/reconcile"
3234

3335
"github.com/percona/percona-postgresql-operator/internal/config"
3436
"github.com/percona/percona-postgresql-operator/internal/controller/runtime"
3537
"github.com/percona/percona-postgresql-operator/internal/initialize"
3638
"github.com/percona/percona-postgresql-operator/internal/logging"
39+
"github.com/percona/percona-postgresql-operator/internal/naming"
3740
"github.com/percona/percona-postgresql-operator/internal/pgaudit"
3841
"github.com/percona/percona-postgresql-operator/internal/pgbackrest"
3942
"github.com/percona/percona-postgresql-operator/internal/pgbouncer"
@@ -504,9 +507,22 @@ func (r *Reconciler) SetupWithManager(mgr manager.Manager) error {
504507
}
505508
}
506509

510+
// K8SPG-712: Allow overriding default configurations
511+
configMapPredicate := builder.WithPredicates(predicate.Funcs{
512+
UpdateFunc: func(e event.UpdateEvent) bool {
513+
configMap, ok := e.ObjectNew.(*corev1.ConfigMap)
514+
if !ok {
515+
return true
516+
}
517+
// Skip reconciliation if the ConfigMap has the specified annotation
518+
_, hasAnnotation := configMap.Annotations[naming.OverrideConfigAnnotation]
519+
return !hasAnnotation
520+
},
521+
})
522+
507523
return builder.ControllerManagedBy(mgr).
508524
For(&v1beta1.PostgresCluster{}).
509-
Owns(&corev1.ConfigMap{}).
525+
Owns(&corev1.ConfigMap{}, configMapPredicate). // K8SPG-712
510526
Owns(&corev1.Endpoints{}).
511527
Owns(&corev1.PersistentVolumeClaim{}).
512528
Owns(&corev1.Secret{}).

0 commit comments

Comments
 (0)