Skip to content

Commit 7735b30

Browse files
committed
chore: add more options to example Postgres clusters (#10)
Closes #9 Signed-off-by: Gabriele Bartolini <[email protected]>
1 parent 4818263 commit 7735b30

File tree

2 files changed

+72
-24
lines changed

2 files changed

+72
-24
lines changed

examples/eu/cluster-dc-eu.yaml renamed to examples/eu/pg-eu.yaml

Lines changed: 36 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,18 @@
11
apiVersion: postgresql.cnpg.io/v1
22
kind: Cluster
33
metadata:
4-
name: cluster-dc-eu
4+
name: pg-eu
55
spec:
66
instances: 3
77

88
storage:
99
size: 1Gi
1010

11+
# See https://cloudnative-pg.io/documentation/current/storage/#volume-for-wal
12+
walStorage:
13+
size: 1Gi
14+
15+
# See https://cloudnative-pg.io/documentation/current/scheduling/#isolating-postgresql-workloads
1116
affinity:
1217
nodeSelector:
1318
node-role.kubernetes.io/postgres: ""
@@ -19,6 +24,25 @@ spec:
1924
topologyKey: kubernetes.io/hostname
2025
podAntiAffinityType: required
2126

27+
# See https://cloudnative-pg.io/documentation/current/bootstrap/#bootstrap-an-empty-cluster-initdb
28+
bootstrap:
29+
initdb:
30+
dataChecksums: true
31+
32+
postgresql:
33+
# See https://cloudnative-pg.io/documentation/current/postgresql_conf/#the-postgresql-section
34+
parameters:
35+
# Some very basic Postgres settings
36+
max_connections: '100'
37+
log_checkpoints: 'on'
38+
log_lock_waits: 'on'
39+
pg_stat_statements.max: '10000'
40+
pg_stat_statements.track: 'all'
41+
hot_standby_feedback: 'on'
42+
# Container images work fine with sysv shared memory
43+
shared_memory_type: 'sysv'
44+
dynamic_shared_memory_type: 'sysv'
45+
2246
backup:
2347
barmanObjectStore:
2448
destinationPath: s3://backups/
@@ -33,15 +57,16 @@ spec:
3357
wal:
3458
compression: gzip
3559

60+
# See https://cloudnative-pg.io/documentation/current/replica_cluster/#distributed-topology
3661
replica:
37-
self: cluster-dc-eu
38-
primary: cluster-dc-eu
39-
source: cluster-dc-us
62+
self: pg-eu
63+
primary: pg-eu
64+
source: pg-us
4065

4166
externalClusters:
42-
- name: cluster-dc-eu
67+
- name: pg-eu
4368
barmanObjectStore:
44-
serverName: cluster-dc-eu
69+
serverName: pg-eu
4570
destinationPath: s3://backups/
4671
endpointURL: http://minio-eu:9000
4772
s3Credentials:
@@ -53,9 +78,9 @@ spec:
5378
key: ACCESS_SECRET_KEY
5479
wal:
5580
compression: gzip
56-
- name: cluster-dc-us
81+
- name: pg-us
5782
barmanObjectStore:
58-
serverName: cluster-dc-us
83+
serverName: pg-us
5984
destinationPath: s3://backups/
6085
endpointURL: http://minio-us:9000
6186
s3Credentials:
@@ -68,13 +93,14 @@ spec:
6893
wal:
6994
compression: gzip
7095
---
96+
# See https://cloudnative-pg.io/documentation/current/backup/#scheduled-backups
7197
apiVersion: postgresql.cnpg.io/v1
7298
kind: ScheduledBackup
7399
metadata:
74-
name: cluster-dc-eu-backup
100+
name: pg-eu-backup
75101
spec:
76102
schedule: '0 0 0 * * *'
77103
backupOwnerReference: self
78104
cluster:
79-
name: cluster-dc-eu
105+
name: pg-eu
80106
immediate: true

examples/us/cluster-dc-us.yaml renamed to examples/us/pg-us.yaml

Lines changed: 36 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,18 @@
11
apiVersion: postgresql.cnpg.io/v1
22
kind: Cluster
33
metadata:
4-
name: cluster-dc-us
4+
name: pg-us
55
spec:
66
instances: 3
77

88
storage:
99
size: 1Gi
1010

11+
# See https://cloudnative-pg.io/documentation/current/storage/#volume-for-wal
12+
walStorage:
13+
size: 1Gi
14+
15+
# See https://cloudnative-pg.io/documentation/current/scheduling/#isolating-postgresql-workloads
1116
affinity:
1217
nodeSelector:
1318
node-role.kubernetes.io/postgres: ""
@@ -19,6 +24,25 @@ spec:
1924
topologyKey: kubernetes.io/hostname
2025
podAntiAffinityType: required
2126

27+
# See https://cloudnative-pg.io/documentation/current/recovery/
28+
bootstrap:
29+
recovery:
30+
source: pg-eu
31+
32+
postgresql:
33+
# See https://cloudnative-pg.io/documentation/current/postgresql_conf/#the-postgresql-section
34+
parameters:
35+
# Some very basic Postgres settings
36+
max_connections: '100'
37+
log_checkpoints: 'on'
38+
log_lock_waits: 'on'
39+
pg_stat_statements.max: '10000'
40+
pg_stat_statements.track: 'all'
41+
hot_standby_feedback: 'on'
42+
# Container images work fine with sysv shared memory
43+
shared_memory_type: 'sysv'
44+
dynamic_shared_memory_type: 'sysv'
45+
2246
backup:
2347
barmanObjectStore:
2448
destinationPath: s3://backups/
@@ -33,19 +57,16 @@ spec:
3357
wal:
3458
compression: gzip
3559

36-
bootstrap:
37-
recovery:
38-
source: cluster-dc-eu
39-
60+
# See https://cloudnative-pg.io/documentation/current/replica_cluster/#distributed-topology
4061
replica:
41-
self: cluster-dc-us
42-
primary: cluster-dc-eu
43-
source: cluster-dc-eu
62+
self: pg-us
63+
primary: pg-eu
64+
source: pg-eu
4465

4566
externalClusters:
46-
- name: cluster-dc-eu
67+
- name: pg-eu
4768
barmanObjectStore:
48-
serverName: cluster-dc-eu
69+
serverName: pg-eu
4970
destinationPath: s3://backups/
5071
endpointURL: http://minio-eu:9000
5172
s3Credentials:
@@ -57,9 +78,9 @@ spec:
5778
key: ACCESS_SECRET_KEY
5879
wal:
5980
compression: gzip
60-
- name: cluster-dc-us
81+
- name: pg-us
6182
barmanObjectStore:
62-
serverName: cluster-dc-us
83+
serverName: pg-us
6384
destinationPath: s3://backups/
6485
endpointURL: http://minio-us:9000
6586
s3Credentials:
@@ -72,13 +93,14 @@ spec:
7293
wal:
7394
compression: gzip
7495
---
96+
# See https://cloudnative-pg.io/documentation/current/backup/#scheduled-backups
7597
apiVersion: postgresql.cnpg.io/v1
7698
kind: ScheduledBackup
7799
metadata:
78-
name: cluster-dc-us-backup
100+
name: pg-us-backup
79101
spec:
80102
schedule: '0 0 0 * * *'
81103
backupOwnerReference: self
82104
cluster:
83-
name: cluster-dc-us
105+
name: pg-us
84106
immediate: true

0 commit comments

Comments
 (0)