Allow users to configure any PostgreSQL server parameter via the postgresql.parameters field. All parameter values must be provided as strings (numeric values should be quoted). Security measures: - Block parameters that allow shell command execution (archive_command, restore_command, ssl_passphrase_command, log_destination, event_source) - Validation implemented in templates to prevent security vulnerabilities Generated files updated: - types.go: Add Parameters field with map[string]string type - README.md: Add parameter documentation and warnings - values.schema.json: Update schema for new field - CRD: Update OpenAPI schema with new field and reordered properties CloudNativePG manages certain parameters automatically (archive_mode, primary_conninfo, wal_level). Users should not override these as it may break backup/replication functionality. Signed-off-by: IvanHunters <xorokhotnikov@gmail.com>
181 lines
6 KiB
YAML
181 lines
6 KiB
YAML
##
|
|
## @section Common parameters
|
|
##
|
|
|
|
## @typedef {struct} Resources - Explicit CPU and memory configuration for each PostgreSQL replica.
|
|
## @field {quantity} [cpu] - CPU available to each replica.
|
|
## @field {quantity} [memory] - Memory (RAM) available to each replica.
|
|
|
|
## @enum {string} ResourcesPreset - Default sizing preset.
|
|
## @value nano
|
|
## @value micro
|
|
## @value small
|
|
## @value medium
|
|
## @value large
|
|
## @value xlarge
|
|
## @value 2xlarge
|
|
|
|
## @param {int} replicas - Number of Postgres replicas.
|
|
replicas: 2
|
|
|
|
## @param {Resources} [resources] - Explicit CPU and memory configuration for each PostgreSQL replica. When omitted, the preset defined in `resourcesPreset` is applied.
|
|
resources: {}
|
|
|
|
## @param {ResourcesPreset} resourcesPreset="micro" - Default sizing preset used when `resources` is omitted.
|
|
resourcesPreset: "micro"
|
|
|
|
## @param {quantity} size - Persistent Volume Claim size available for application data.
|
|
size: 10Gi
|
|
|
|
## @param {string} storageClass - StorageClass used to store the data.
|
|
storageClass: ""
|
|
|
|
## @param {bool} external - Enable external access from outside the cluster.
|
|
external: false
|
|
|
|
##
|
|
## @enum {string} Version
|
|
## @value v18
|
|
## @value v17
|
|
## @value v16
|
|
## @value v15
|
|
## @value v14
|
|
## @value v13
|
|
|
|
## @param {Version} version - PostgreSQL major version to deploy
|
|
version: v18
|
|
|
|
## @section Application-specific parameters
|
|
##
|
|
|
|
## @typedef {struct} PostgreSQL - PostgreSQL server configuration.
|
|
## @field {map[string]string} [parameters] - PostgreSQL server parameters. All values must be strings (enclose numbers in quotes). See PostgreSQL documentation for available parameters. WARNING: Some parameters are managed by CloudNativePG and should NOT be overridden (archive_mode, archive_command, restore_command, primary_conninfo, etc.). Incorrect values may break backup/replication or require pod restart.
|
|
|
|
## @param {PostgreSQL} postgresql - PostgreSQL server configuration.
|
|
postgresql:
|
|
parameters:
|
|
max_connections: "100"
|
|
## Additional parameters examples:
|
|
## shared_buffers: "1GB"
|
|
## effective_cache_size: "4GB"
|
|
## bgwriter_delay: "200ms"
|
|
## commit_delay: "100"
|
|
## commit_siblings: "5"
|
|
## work_mem: "256MB"
|
|
##
|
|
## SECURITY: The following parameters are BLOCKED for security reasons
|
|
## (could allow arbitrary shell command execution):
|
|
## archive_command, restore_command, ssl_passphrase_command,
|
|
## log_destination, event_source
|
|
##
|
|
## IMPORTANT: Do NOT override CloudNativePG-managed parameters:
|
|
## archive_mode, primary_conninfo, wal_level, max_replication_slots
|
|
##
|
|
## NOTE: Some parameters require pod restart (not just reload):
|
|
## shared_buffers, max_connections, max_prepared_transactions,
|
|
## wal_buffers, max_wal_senders
|
|
|
|
##
|
|
## @section Quorum-based synchronous replication
|
|
##
|
|
|
|
## @typedef {struct} Quorum - Quorum configuration for synchronous replication.
|
|
## @field {int} minSyncReplicas - Minimum number of synchronous replicas required for commit.
|
|
## @field {int} maxSyncReplicas - Maximum number of synchronous replicas allowed (must be less than total replicas).
|
|
|
|
## @param {Quorum} quorum - Quorum configuration for synchronous replication.
|
|
quorum:
|
|
minSyncReplicas: 0
|
|
maxSyncReplicas: 0
|
|
|
|
##
|
|
## @section Users configuration
|
|
##
|
|
|
|
## @typedef {struct} User - User configuration.
|
|
## @field {string} [password] - Password for the user.
|
|
## @field {bool} [replication] - Whether the user has replication privileges.
|
|
|
|
## @param {map[string]User} users - Users configuration map.
|
|
users: {}
|
|
## Example:
|
|
## users:
|
|
## user1:
|
|
## password: strongpassword
|
|
## user2:
|
|
## password: hackme
|
|
## airflow:
|
|
## password: qwerty123
|
|
## debezium:
|
|
## replication: true
|
|
|
|
##
|
|
## @section Databases configuration
|
|
##
|
|
|
|
## @typedef {struct} DatabaseRoles - Role assignments for a database.
|
|
## @field {[]string} [admin] - List of users with admin privileges.
|
|
## @field {[]string} [readonly] - List of users with read-only privileges.
|
|
|
|
## @typedef {struct} Database - Database configuration.
|
|
## @field {DatabaseRoles} [roles] - Roles assigned to users.
|
|
## @field {[]string} [extensions] - List of enabled PostgreSQL extensions.
|
|
|
|
## @param {map[string]Database} databases - Databases configuration map.
|
|
databases: {}
|
|
## Example:
|
|
## databases:
|
|
## myapp:
|
|
## roles:
|
|
## admin:
|
|
## - user1
|
|
## - debezium
|
|
## readonly:
|
|
## - user2
|
|
## airflow:
|
|
## roles:
|
|
## admin:
|
|
## - airflow
|
|
## extensions:
|
|
## - hstore
|
|
|
|
##
|
|
## @section Backup parameters
|
|
##
|
|
|
|
## @typedef {struct} Backup - Backup configuration.
|
|
## @field {bool} enabled - Enable regular backups.
|
|
## @field {string} [schedule] - Cron schedule for automated backups.
|
|
## @field {string} [retentionPolicy] - Retention policy (e.g. "30d").
|
|
## @field {string} [destinationPath] - Destination path for backups (e.g. s3://bucket/path/).
|
|
## @field {string} [endpointURL] - S3 endpoint URL for uploads.
|
|
## @field {string} [s3AccessKey] - Access key for S3 authentication.
|
|
## @field {string} [s3SecretKey] - Secret key for S3 authentication.
|
|
|
|
## @param {Backup} backup - Backup configuration.
|
|
backup:
|
|
enabled: false
|
|
retentionPolicy: 30d
|
|
destinationPath: "s3://bucket/path/to/folder/"
|
|
endpointURL: "http://minio-gateway-service:9000"
|
|
schedule: "0 2 * * * *"
|
|
s3AccessKey: "<your-access-key>"
|
|
s3SecretKey: "<your-secret-key>"
|
|
|
|
##
|
|
## @section Bootstrap (recovery) parameters
|
|
##
|
|
|
|
## @typedef {struct} Bootstrap - Bootstrap configuration for restoring a database cluster from a backup.
|
|
## @field {bool} enabled - Whether to restore from a backup.
|
|
## @field {string} [recoveryTime] - Timestamp (RFC3339) for point-in-time recovery; empty means latest.
|
|
## @field {string} oldName - Previous cluster name before deletion.
|
|
## @field {string} [serverName] - Barman server name (S3 path prefix) used by the original cluster when writing backups. Set this only when the original cluster had an explicit barmanObjectStore.serverName that differed from its Kubernetes resource name.
|
|
|
|
## @param {Bootstrap} bootstrap - Bootstrap configuration.
|
|
bootstrap:
|
|
enabled: false
|
|
# example: 2020-11-26 15:22:00.00000+00
|
|
recoveryTime: ""
|
|
oldName: ""
|
|
serverName: ""
|