generated from onedr0p/cluster-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(cloudnative-pg): upgrade cluster to postgres 17
- Loading branch information
Showing
3 changed files
with
106 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
101 changes: 101 additions & 0 deletions
101
kubernetes/main/apps/database/cloudnative-pg/cluster/postgres17.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
--- | ||
# yaml-language-server: $schema=https://kubernetes-schemas.pages.dev/postgresql.cnpg.io/cluster_v1.json | ||
apiVersion: postgresql.cnpg.io/v1 | ||
kind: Cluster | ||
metadata: | ||
name: postgres17 | ||
spec: | ||
instances: 3 | ||
imageName: ghcr.io/cloudnative-pg/postgresql:17.2-26 | ||
primaryUpdateMethod: switchover | ||
primaryUpdateStrategy: unsupervised | ||
storage: | ||
size: 15Gi | ||
storageClass: local-database | ||
superuserSecret: | ||
name: postgres-cluster-secret | ||
enableSuperuserAccess: true | ||
postgresql: | ||
parameters: | ||
max_wal_size: "4096" # See walSegmentSize: 1024 in bootstrap.initdb | ||
shared_buffers: "256MB" | ||
# ZFS tuning | ||
# https://openzfs.github.io/openzfs-docs/Performance%20and%20Tuning/Workload%20Tuning.html#postgresql | ||
# https://vadosware.io/post/everything-ive-seen-on-optimizing-postgres-on-zfs-on-linux/ | ||
# https://kubeblocks.io/blog/A-testing-report-for-optimizing-PG-performance-on-Kubernetes | ||
full_page_writes: "off" | ||
recovery_prefetch: "try" | ||
wal_init_zero: "off" | ||
wal_recycle: "off" | ||
nodeMaintenanceWindow: | ||
inProgress: false | ||
reusePVC: true | ||
resources: | ||
requests: | ||
cpu: 20m | ||
limits: | ||
memory: 4Gi | ||
monitoring: | ||
enablePodMonitor: true | ||
# https://github.com/cloudnative-pg/cloudnative-pg/issues/2501 | ||
podMonitorMetricRelabelings: | ||
- { sourceLabels: ["cluster"], targetLabel: cnpg_cluster, action: replace } | ||
- { regex: cluster, action: labeldrop } | ||
backup: | ||
retentionPolicy: 30d | ||
barmanObjectStore: &barmanObjectStore | ||
data: | ||
compression: bzip2 | ||
encryption: AES256 | ||
wal: | ||
compression: bzip2 | ||
encryption: AES256 | ||
destinationPath: s3://home-ops-postgresql | ||
endpointURL: https://s3.${STORAGE_DOMAIN} | ||
# Note: serverName version needs to be incremented | ||
# when recovering from an existing cnpg cluster | ||
serverName: ¤tCluster postgres17-v0 | ||
s3Credentials: | ||
accessKeyId: | ||
name: postgres-cluster-secret | ||
key: MINIO_ACCESS_KEY | ||
secretAccessKey: | ||
name: postgres-cluster-secret | ||
key: MINIO_SECRET_KEY | ||
bootstrap: | ||
initdb: | ||
# The postgres-db-manager user will be used to create databases using onedr0p/postgres-init | ||
database: postgres-db-manager | ||
owner: postgres-db-manager | ||
secret: | ||
name: postgres-secret | ||
postInitApplicationSQL: | ||
- ALTER USER "postgres-db-manager" WITH SUPERUSER; | ||
# Import databases from previous major version cluster | ||
import: | ||
type: monolith | ||
databases: | ||
- '*' | ||
roles: | ||
- '*' | ||
source: | ||
externalCluster: &previousCluster postgres16 | ||
# ZFS tuning | ||
walSegmentSize: 1024 | ||
# # Recover from previous cluster barman backup | ||
# recovery: | ||
# source: &previousCluster postgres16 | ||
externalClusters: | ||
- name: *previousCluster | ||
connectionParameters: | ||
host: postgres16-rw.database.svc.cluster.local | ||
user: postgres | ||
dbname: postgres | ||
password: | ||
name: postgres-cluster-secret | ||
key: password | ||
# # Note: serverName version needs to be set to the version of the | ||
# # previous cluster when recovering from an existing cnpg cluster | ||
# barmanObjectStore: | ||
# <<: *barmanObjectStore | ||
# serverName: postgres16-v0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters