Skip to content

Custom Resource options

The Cluster is configured via the deploy/cr.yaml file.

The metadata part of this file contains the following keys:

  • name (cluster1 by default) sets the name of your Percona Distribution for PostgreSQL Cluster; it should include only URL-compatible characters, not exceed 22 characters, start with an alphabetic character, and end with an alphanumeric character;

  • finalizers.percona.com/delete-ssl if present, activates the Finalizer which deletes objects, created for SSL (Secret, certificate, and issuer) after the cluster deletion event (off by default).

  • finalizers.percona.com/delete-pvc if present, activates the Finalizer which deletes Persistent Volume Claims for the database cluster Pods after the deletion event (off by default).

The spec part of the deploy/cr.yaml file contains the following:

Key crVersion
Value string
Example 2.3.1
Description Version of the Operator the Custom Resource belongs to
Key standby.enabled
Value boolean
Example false
Description Enables or disables running the cluster in a standby mode (read-only copy of an existing cluster, useful for disaster recovery, etc)
Key standby.host
Value string
Example "<primary-ip>"
Description Host address of the primary cluster this standby cluster connects to
Key standby.port
Value string
Example "<primary-port>"
Description Port number used by a standby copy to connect to the primary cluster
Key openshift
Value boolean
Example true
Description Set to true if the cluster is being deployed on OpenShift, set to false otherwise, or unset it for autodetection
Key standby.repoName
Value string
Example repo1
Description Name of the pgBackRest repository in the primary cluster this standby cluster connects to
Key secrets.customTLSSecret.name
Value string
Example cluster1-cert
Description A secret with TLS certificate generated for external communications, see Transport Layer Security (TLS) for details
Key secrets.customReplicationTLSSecret.name
Value string
Example replication1-cert
Description A secret with TLS certificate generated for internal communications, see Transport Layer Security (TLS) for details
Key users.name
Value string
Example rhino
Description The name of the PostgreSQL user
Key users.databases
Value string
Example zoo
Description Databases accessible by a specific PostgreSQL user with rights to create objects in them (the option is ignored for postgres user; also, modifying it can’t be used to revoke the already given access)
Key users.password.type
Value string
Example ASCII
Description The set of characters used for password generation: can be either ASCII (default) or AlphaNumeric
Key users.options
Value string
Example "SUPERUSER"
Description The ALTER ROLE options other than password (the option is ignored for postgres user)
Key users.secretName
Value string
Example "rhino-credentials"
Description The custom name of the user’s Secret; if not specified, the default <clusterName>-pguser-<userName> variant will be used
Key databaseInitSQL.key
Value string
Example init.sql
Description Data key for the Custom configuration options ConfigMap with the init SQL file, which will be executed at cluster creation time
Key databaseInitSQL.name
Value string
Example cluster1-init-sql
Description Name of the ConfigMap with the init SQL file, which will be executed at cluster creation time
Key pause
Value string
Example false
Description Setting it to true gracefully stops the cluster, scaling workloads to zero and suspending CronJobs; setting it to false after shut down starts the cluster back
Key unmanaged
Value string
Example false
Description Setting it to true stops the Operator’s activity including the rollout and reconciliation of changes made in the Custom Resource; setting it to false starts the Operator’s activity back
Key dataSource.postgresCluster.clusterName
Value string
Example cluster1
Description Name of an existing cluster to use as the data source when restoring backup to a new cluster
Key dataSource.postgresCluster.repoName
Value string
Example repo1
Description Name of the pgBackRest repository in the source cluster that contains the backup to be restored to a new cluster
Key dataSource.postgresCluster.options
Value string
Example
Description The pgBackRest command-line options for the pgBackRest restore command
Key dataSource.pgbackrest.stanza
Value string
Example db
Description Name of the pgBackRest stanza to use as the data source when restoring backup to a new cluster
Key dataSource.pgbackrest.configuration.secret.name
Value string
Example pgo-s3-creds
Description Name of the Kubernetes Secret object with custom pgBackRest configuration, which will be added to the pgBackRest configuration generated by the Operator
Key dataSource.pgbackrest.global
Value subdoc
Example /pgbackrest/postgres-operator/hippo/repo1
Description Settings, which are to be included in the global section of the pgBackRest configuration generated by the Operator
Key dataSource.pgbackrest.repo.name
Value string
Example repo1
Description Name of the pgBackRest repository
Key dataSource.pgbackrest.repo.s3.bucket
Value string
Example "my-bucket"
Description The Amazon S3 bucket or Google Cloud Storage bucket
name used for backups
Key dataSource.pgbackrest.repo.s3.endpoint
Value string
Example "s3.ca-central-1.amazonaws.com"
Description The endpoint URL of the S3-compatible storage to be used for backups (not needed for the original Amazon S3 cloud)
Key dataSource.pgbackrest.repo.s3.region
Value boolean
Example "ca-central-1"
Description The AWS region to use for Amazon and all S3-compatible storages
Key image
Value string
Example perconalab/percona-postgresql-operator:2.3.1-ppg16-postgres
Description The PostgreSQL Docker image to use
Key imagePullPolicy
Value string
Example Always
Description This option is used to set the policy for updating PostgreSQL images
Key postgresVersion
Value int
Example 14
Description The major version of PostgreSQL to use
Key port
Value int
Example 5432
Description The port number for PostgreSQL
Key expose.annotations
Value label
Example my-annotation: value1
Description The Kubernetes annotations metadata for PostgreSQL
Key expose.labels
Value label
Example my-label: value2
Description Set labels for the PostgreSQL Service
Key expose.type
Value string
Example LoadBalancer
Description Specifies the type of Kubernetes Service for PostgreSQL
Key expose.loadBalancerSourceRanges
Value string
Example "10.0.0.0/8"
Description The range of client IP addresses from which the load balancer should be reachable (if not set, there is no limitations)

Instances section

The instances section in the deploy/cr.yaml file contains configuration options for PostgreSQL instances.

Key instances.metadata.labels
Value label
Example pg-cluster-label: cluster1
Description Set labels for PostgreSQL Pods
Key instances.name
Value string
Example rs 0
Description The name of the PostgreSQL instance
Key instances.replicas
Value int
Example 3
Description The number of Replicas to create for the PostgreSQL instance
Key instances.resources.limits.cpu
Value string
Example 2.0
Description Kubernetes CPU limits for a PostgreSQL instance
Key instances.resources.limits.memory
Value string
Example 4Gi
Description The Kubernetes memory limits for a PostgreSQL instance
Key instances.topologySpreadConstraints.maxSkew
Value int
Example 1
Description The degree to which Pods may be unevenly distributed under the Kubernetes Pod Topology Spread Constraints
Key instances.topologySpreadConstraints.topologyKey
Value string
Example my-node-label
Description The key of node labels for the Kubernetes Pod Topology Spread Constraints
Key instances.topologySpreadConstraints.whenUnsatisfiable
Value string
Example DoNotSchedule
Description What to do with a Pod if it doesn’t satisfy the Kubernetes Pod Topology Spread Constraints
Key instances.topologySpreadConstraints.labelSelector.matchLabels
Value label
Example postgres-operator.crunchydata.com/instance-set: instance1
Description The Label selector for the Kubernetes Pod Topology Spread Constraints
Key instances.tolerations.effect
Value string
Example NoSchedule
Description The Kubernetes Pod tolerations effect for the PostgreSQL instance
Key instances.tolerations.key
Value string
Example role
Description The Kubernetes Pod tolerations key for the PostgreSQL instance
Key instances.tolerations.operator
Value string
Example Equal
Description The Kubernetes Pod tolerations operator for the PostgreSQL instance
Key instances.tolerations.value
Value string
Example connection-poolers
Description The Kubernetes Pod tolerations value for the PostgreSQL instance
Key instances.priorityClassName
Value string
Example high-priority
Description The Kuberentes Pod priority class for PostgreSQL instance Pods
Key instances.walVolumeClaimSpec.accessModes
Value string
Example ReadWriteOnce
Description The Kubernetes PersistentVolumeClaim access modes for the PostgreSQL Write-ahead Log storage
Key instances.walVolumeClaimSpec.resources.requests.storage
Value string
Example 1Gi
Description The Kubernetes storage requests for the storage the PostgreSQL instance will use
Key instances.dataVolumeClaimSpec.accessModes
Value string
Example ReadWriteOnce
Description The Kubernetes PersistentVolumeClaim access modes for the PostgreSQL Write-ahead Log storage
Key instances.dataVolumeClaimSpec.resources.requests.storage
Value string
Example 1Gi
Description The Kubernetes storage requests for the storage the PostgreSQL instance will use

instances.sidecars subsection

The instances.sidecars subsection in the deploy/cr.yaml file contains configuration options for custom sidecar containers which can be added to PostgreSQL Pods.

Key instances.sidecars.image
Value string
Example mycontainer1:latest
Description Image for the custom sidecar container for PostgreSQL Pods
Key instances.sidecars.name
Value string
Example testcontainer
Description Name of the custom sidecar container for PostgreSQL Pods
Key instances.sidecars.imagePullPolicy
Value string
Example Always
Description This option is used to set the policy for the PostgreSQL Pod sidecar container
Key instances.sidecars.env
Value subdoc
Example
Description The environment variables set as key-value pairs for the custom sidecar container for PostgreSQL Pods
Key instances.sidecars.envFrom
Value subdoc
Example
Description The environment variables set as key-value pairs in ConfigMaps for the custom sidecar container for PostgreSQL Pods
Key instances.sidecars.command
Value array
Example ["/bin/sh"]
Description Command for the custom sidecar container for PostgreSQL Pods
Key instances.sidecars.args
Value array
Example ["-c", "while true; do trap 'exit 0' SIGINT SIGTERM SIGQUIT SIGKILL; done;"]
Description Command arguments for the custom sidecar container for PostgreSQL Pods

Backup section

The backup section in the deploy/cr.yaml file contains the following configuration options for the regular Percona Distribution for PostgreSQL backups.

Key backups.pgbackrest.metadata.labels
Value label
Example pg-cluster-label: cluster1
Description Set labels for pgBackRest Pods
Key backups.pgbackrest.image
Value string
Example perconalab/percona-postgresql-operator:2.3.1-ppg16-pgbackrest
Description The Docker image for pgBackRest
Key backups.pgbackrest.configuration.secret.name
Value string
Example cluster1-pgbackrest-secrets
Description Name of the Kubernetes Secret object with custom pgBackRest configuration, which will be added to the pgBackRest configuration generated by the Operator
Key backups.pgbackrest.jobs.priorityClassName
Value string
Example high-priority
Description The Kuberentes Pod priority class for pgBackRest jobs
Key backups.pgbackrest.jobs.resources.limits.cpu
Value int
Example 200
Description Kubernetes CPU limits for a pgBackRest job
Key backups.pgbackrest.jobs.resources.limits.memory
Value int
Example 128Mi
Description The Kubernetes memory limits for a pgBackRest job
Key backups.pgbackrest.jobs.tolerations.effect
Value string
Example NoSchedule
Description The Kubernetes Pod tolerations effect for a pgBackRest job
Key backups.pgbackrest.jobs.tolerations.key
Value string
Example role
Description The Kubernetes Pod tolerations key for a pgBackRest job
Key backups.pgbackrest.jobs.tolerations.operator
Value string
Example Equal
Description The Kubernetes Pod tolerations operator for a pgBackRest job
Key backups.pgbackrest.jobs.tolerations.value
Value string
Example connection-poolers
Description The Kubernetes Pod tolerations value for a pgBackRest job
Key backups.pgbackrest.global
Value subdoc
Example /pgbackrest/postgres-operator/hippo/repo1
Description Settings, which are to be included in the global section of the pgBackRest configuration generated by the Operator
Key backups.pgbackrest.repoHost.priorityClassName
Value string
Example high-priority
Description The Kuberentes Pod priority class for pgBackRest repo
Key backups.pgbackrest.repoHost.topologySpreadConstraints.maxSkew
Value int
Example 1
Description The degree to which Pods may be unevenly distributed under the Kubernetes Pod Topology Spread Constraints
Key backups.pgbackrest.repoHost.topologySpreadConstraints.topologyKey
Value string
Example my-node-label
Description The key of node labels for the Kubernetes Pod Topology Spread Constraints
Key backups.pgbackrest.repoHost.topologySpreadConstraints.whenUnsatisfiable
Value string
Example ScheduleAnyway
Description What to do with a Pod if it doesn’t satisfy the Kubernetes Pod Topology Spread Constraints
Key backups.pgbackrest.repoHost.topologySpreadConstraints.labelSelector.matchLabels
Value label
Example postgres-operator.crunchydata.com/pgbackrest: ""
Description The Label selector for the Kubernetes Pod Topology Spread Constraints
Key backups.pgbackrest.repoHost.affinity.podAntiAffinity
Value subdoc
Example
Description Pod anti-affinity, allows setting the standard Kubernetes affinity constraints of any complexity
Key backups.pgbackrest.manual.repoName
Value string
Example repo1
Description Name of the pgBackRest repository for on-demand backups
Key backups.pgbackrest.manual.options
Value string
Example --type=full
Description The on-demand backup command-line options which will be passed to pgBackRest for on-demand backups
Key backups.pgbackrest.repos.name
Value string
Example repo1
Description Name of the pgBackRest repository for backups
Key backups.pgbackrest.repos.schedules.full
Value string
Example 0 0 \* \* 6
Description Scheduled time to make a full backup specified in the crontab format
Key backups.pgbackrest.repos.schedules.differential
Value string
Example 0 0 \* \* 6
Description Scheduled time to make a differential backup specified in the crontab format
Key backups.pgbackrest.repos.volume.volumeClaimSpec.accessModes
Value string
Example ReadWriteOnce
Description The Kubernetes PersistentVolumeClaim access modes for the pgBackRest Storage
Key backups.pgbackrest.repos.volume.volumeClaimSpec.resources.requests.storage
Value string
Example 1Gi
Description The Kubernetes storage requests for the pgBackRest storage
Key backups.pgbackrest.repos.s3.bucket
Value string
Example "my-bucket"
Description The Amazon S3 bucket
name used for backups
Key backups.pgbackrest.repos.s3.endpoint
Value string
Example "s3.ca-central-1.amazonaws.com"
Description The endpoint URL of the S3-compatible storage to be used for backups (not needed for the original Amazon S3 cloud)
Key backups.pgbackrest.repos.s3.region
Value boolean
Example "ca-central-1"
Description The AWS region to use for Amazon and all S3-compatible storages
Key backups.pgbackrest.repos.gcs.bucket
Value string
Example "my-bucket"
Description The Google Cloud Storage bucket
name used for backups
Key backups.pgbackrest.repos.azure.container
Value string
Example my-container
Description Name of the Azure Blob Storage container for backups

PMM section

The pmm section in the deploy/cr.yaml file contains configuration options for Percona Monitoring and Management.

Key pmm.enabled
Value boolean
Example false
Description Enables or disables monitoring Percona Distribution for PostgreSQL cluster with PMM
Key pmm.image
Value string
Example percona/pmm-client:2.41.0
Description Percona Monitoring and Management (PMM) Client Docker image
Key pmm.imagePullPolicy
Value string
Example IfNotPresent
Description This option is used to set the policy for updating PMM Client images
Key pmm.pmmSecret
Value string
Example cluster1-pmm-secret
Description Name of the Kubernetes Secret object for the PMM Server password
Key pmm.serverHost
Value string
Example monitoring-service
Description Address of the PMM Server to collect data from the cluster

Proxy section

The proxy section in the deploy/cr.yaml file contains configuration options for the pgBouncer connection pooler for PostgreSQL.

Key proxy.pgBouncer.metadata.labels
Value label
Example pg-cluster-label: cluster1
Description Set labels for pgBouncer Pods
Key proxy.pgBouncer.replicas
Value int
Example 3
Description The number of the pgBouncer Pods to provide connection pooling
Key proxy.pgBouncer.image
Value string
Example perconalab/percona-postgresql-operator:2.3.1-ppg16-pgbouncer
Description Docker image for the pgBouncer connection pooler
Key proxy.pgBouncer.exposeSuperusers
Value boolean
Example false
Description Enables or disables exposing superuser user through pgBouncer
Key proxy.pgBouncer.resources.limits.cpu
Value int
Example 200m
Description Kubernetes CPU limits for a pgBouncer container
Key proxy.pgBouncer.resources.limits.memory
Value int
Example 128Mi
Description The Kubernetes memory limits for a pgBouncer container
Key proxy.pgBouncer.expose.type
Value string
Example ClusterIP
Description Specifies the type of Kubernetes Service for pgBouncer
Key proxy.pgBouncer.expose.annotations
Value label
Example pg-cluster-annot: cluster1
Description The Kubernetes annotations metadata for pgBouncer
Key proxy.pgBouncer.expose.labels
Value label
Example pg-cluster-label: cluster1
Description Set labels for the pgBouncer Service
Key proxy.pgBouncer.expose.loadBalancerSourceRanges
Value string
Example "10.0.0.0/8"
Description The range of client IP addresses from which the load balancer should be reachable (if not set, there is no limitations)
Value string
Example preferred
Description Pod anti-affinity type, can be either preferred or required
Key proxy.pgBouncer.config
Value subdoc
Example
global:
pool_mode: transaction
Description Custom configuration options for pgBouncer. Please note that configuration changes are automatically applied to the running instances without validation, so having an invalid config can make the cluster unavailable

proxy.pgBouncer.sidecars subsection

The proxy.pgBouncer.sidecars subsection in the deploy/cr.yaml file contains configuration options for custom sidecar containers which can be added to pgBouncer Pods.

Key proxy.pgBouncer.sidecars.image
Value string
Example mycontainer1:latest
Description Image for the custom sidecar container for pgBouncer Pods
Key proxy.pgBouncer.sidecars.name
Value string
Example testcontainer
Description Name of the custom sidecar container for pgBouncer Pods
Key proxy.pgBouncer.sidecars.imagePullPolicy
Value string
Example Always
Description This option is used to set the policy for the pgBouncer Pod sidecar container
Key proxy.pgBouncer.sidecars.env
Value subdoc
Example
Description The environment variables set as key-value pairs for the custom sidecar container for pgBouncer Pods
Key proxy.pgBouncer.sidecars.envFrom
Value subdoc
Example
Description The environment variables set as key-value pairs in ConfigMaps for the custom sidecar container for pgBouncer Pods
Key proxy.pgBouncer.sidecars.command
Value array
Example ["/bin/sh"]
Description Command for the custom sidecar container for pgBouncer Pods
Key proxy.pgBouncer.sidecars.args
Value array
Example ["-c", "while true; do trap 'exit 0' SIGINT SIGTERM SIGQUIT SIGKILL; done;"]
Description Command arguments for the custom sidecar container for pgBouncer Pods

Patroni Section

The patroni section in the deploy/cr.yaml file contains configuration options to customize the PostgreSQL high-availability implementation based on Patroni.

Key patroni.dynamicConfiguration
Value subdoc
Example
postgresql:
parameters:
max_parallel_workers: 2
max_worker_processes: 2
shared_buffers: 1GB
work_mem: 2MB
Description Custom PostgreSQL configuration options. Please note that configuration changes are automatically applied to the running instances without validation, so having an invalid config can make the cluster unavailable

Custom extensions Section

The extensions section in the deploy/cr.yaml file contains configuration options to manage PostgreSQL extensions.

Key extensions.image
Value string
Example percona/percona-postgresql-operator:2.3.1
Description Image for the custom PostgreSQL extension loader sidecar container
Key extensions.imagePullPolicy
Value string
Example Always
Description Policy for the custom extension sidecar container
Key extensions.storage.type
Value string
Example s3
Description The cloud storage type used for backups. Only s3 type is currently supported
Key extensions.storage.bucket
Value string
Example pg-extensions
Description The Amazon S3 bucket name for prepackaged PostgreSQL custom extensions
Key extensions.storage.region
Value string
Example eu-central-1
Description The AWS region to use
Key extensions.storage.secret.name
Value string
Example cluster1-extensions-secret
Description The Kubernetes secret for the custom extensions storage. It should contain AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY keys.
Key extensions.builtin
Value label
Example pg_stat_monitor: true
Description The key-value pairs which enable or disable Percona Distribution for PostgreSQL builtin extensions
Key extensions.custom.name
Value string
Example pg_cron
Description Name of the PostgreSQL custom extension
Key extensions.custom.version
Value string
Example 1.6.1
Description Version of the PostgreSQL custom extension

Get expert help

If you need assistance, visit the community forum for comprehensive and free database knowledge, or contact our Percona Database Experts for professional support and services. Join K8S Squad to benefit from early access to features and “ask me anything” sessions with the Experts.


Last update: 2024-02-19