Skip to content

Custom Resource options

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

metadata

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).

Toplevel spec elements

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

crVersion

Version of the Operator the Custom Resource belongs to.

Value type Example
string 2.3.1

standby.enabled

Enables or disables running the cluster in a standby mode (read-only copy of an existing cluster, useful for disaster recovery, etc).

Value type Example
boolean false

standby.host

Host address of the primary cluster this standby cluster connects to.

Value type Example
string "<primary-ip>"

standby.port

Port number used by a standby copy to connect to the primary cluster.

Value type Example
string "<primary-port>"

openshift

Set to true if the cluster is being deployed on OpenShift, set to false otherwise, or unset it for autodetection.

Value type Example
boolean true

standby.repoName

Name of the pgBackRest repository in the primary cluster this standby cluster connects to.

Value type Example
string repo1

secrets.customTLSSecret.name

A secret with TLS certificate generated for external communications, see Transport Layer Security (TLS) for details.

Value type Example
string cluster1-cert

secrets.customReplicationTLSSecret.name

A secret with TLS certificate generated for internal communications, see Transport Layer Security (TLS) for details.

Value type Example
string replication1-cert

users.name

The name of the PostgreSQL user.

Value type Example
string rhino

users.databases

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).

Value type Example
string zoo

users.password.type

The set of characters used for password generation: can be either ASCII (default) or AlphaNumeric.

Value type Example
string ASCII

users.options

The ALTER ROLE options other than password (the option is ignored for postgres user).

Value type Example
string "SUPERUSER"

users.secretName

The custom name of the user’s Secret; if not specified, the default <clusterName>-pguser-<userName> variant will be used.

Value type Example
string "rhino-credentials"

databaseInitSQL.key

Data key for the Custom configuration options ConfigMap with the init SQL file, which will be executed at cluster creation time.

Value type Example
string init.sql

databaseInitSQL.name

Name of the ConfigMap with the init SQL file, which will be executed at cluster creation time.

Value type Example
string cluster1-init-sql

pause

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.

Value type Example
string false

unmanaged

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.

Value type Example
string false

dataSource.postgresCluster.clusterName

Name of an existing cluster to use as the data source when restoring backup to a new cluster.

Value type Example
string cluster1

dataSource.postgresCluster.repoName

Name of the pgBackRest repository in the source cluster that contains the backup to be restored to a new cluster.

Value type Example
string repo1

dataSource.postgresCluster.options

The pgBackRest command-line options for the pgBackRest restore command.

Value type Example
string

dataSource.pgbackrest.stanza

Name of the pgBackRest stanza to use as the data source when restoring backup to a new cluster.

Value type Example
string db

dataSource.pgbackrest.configuration.secret.name

Name of the Kubernetes Secret object with custom pgBackRest configuration, which will be added to the pgBackRest configuration generated by the Operator.

Value type Example
string pgo-s3-creds

dataSource.pgbackrest.global

Settings, which are to be included in the global section of the pgBackRest configuration generated by the Operator.

Value type Example
subdoc /pgbackrest/postgres-operator/hippo/repo1

dataSource.pgbackrest.repo.name

Name of the pgBackRest repository.

Value type Example
string repo1

dataSource.pgbackrest.repo.s3.bucket

The Amazon S3 bucket or Google Cloud Storage bucket name used for backups.

Value type Example
string "my-bucket"

dataSource.pgbackrest.repo.s3.endpoint

The endpoint URL of the S3-compatible storage to be used for backups (not needed for the original Amazon S3 cloud).

Value type Example
string "s3.ca-central-1.amazonaws.com"

dataSource.pgbackrest.repo.s3.region

The AWS region to use for Amazon and all S3-compatible storages.

Value type Example
boolean "ca-central-1"

image

The PostgreSQL Docker image to use.

Value type Example
string perconalab/percona-postgresql-operator:2.3.1-ppg16-postgres

imagePullPolicy

This option is used to set the policy for updating PostgreSQL images.

Value type Example
string Always

postgresVersion

The major version of PostgreSQL to use.

Value type Example
int 14

port

The port number for PostgreSQL.

Value type Example
int 5432

expose.annotations

The Kubernetes annotations metadata for PostgreSQL.

Value type Example
label my-annotation: value1

expose.labels

Set labels for the PostgreSQL Service.

Value type Example
label my-label: value2

expose.type

Specifies the type of Kubernetes Service for PostgreSQL.

Value type Example
string LoadBalancer

expose.loadBalancerSourceRanges

The range of client IP addresses from which the load balancer should be reachable (if not set, there is no limitations).

Value type Example
string "10.0.0.0/8"

Instances section

The instances section in the deploy/cr.yaml file contains configuration options for PostgreSQL instances. This section contains at least one cluster instance with a number of PostgreSQL instances in it (cluster instances are groups of PostgreSQL instances used for fine-grained resources assignment).

instances.metadata.labels

Set labels for PostgreSQL Pods.

Value type Example
label pg-cluster-label: cluster1

instances.name

The name of the PostgreSQL instance.

Value type Example
string rs 0

instances.replicas

The number of Replicas to create for the PostgreSQL instance.

Value type Example
int 3

instances.resources.limits.cpu

Kubernetes CPU limits for a PostgreSQL instance.

Value type Example
string 2.0

instances.resources.limits.memory

The Kubernetes memory limits for a PostgreSQL instance.

Value type Example
string 4Gi

instances.topologySpreadConstraints.maxSkew

The degree to which Pods may be unevenly distributed under the Kubernetes Pod Topology Spread Constraints .

Value type Example
int 1

instances.topologySpreadConstraints.topologyKey

The key of node labels for the Kubernetes Pod Topology Spread Constraints .

Value type Example
string my-node-label

instances.topologySpreadConstraints.whenUnsatisfiable

What to do with a Pod if it doesn’t satisfy the Kubernetes Pod Topology Spread Constraints .

Value type Example
string DoNotSchedule

instances.topologySpreadConstraints.labelSelector.matchLabels

The Label selector for the Kubernetes Pod Topology Spread Constraints .

Value type Example
label postgres-operator.crunchydata.com/instance-set: instance1

instances.tolerations.effect

The Kubernetes Pod tolerations effect for the PostgreSQL instance.

Value type Example
string NoSchedule

instances.tolerations.key

The Kubernetes Pod tolerations key for the PostgreSQL instance.

Value type Example
string role

instances.tolerations.operator

The Kubernetes Pod tolerations operator for the PostgreSQL instance.

Value type Example
string Equal

instances.tolerations.value

The Kubernetes Pod tolerations value for the PostgreSQL instance.

Value type Example
string connection-poolers

instances.priorityClassName

The Kuberentes Pod priority class for PostgreSQL instance Pods.

Value type Example
string high-priority

instances.walVolumeClaimSpec.accessModes

The Kubernetes PersistentVolumeClaim access modes for the PostgreSQL Write-ahead Log storage.

Value type Example
string ReadWriteOnce

instances.walVolumeClaimSpec.resources.requests.storage

The Kubernetes storage requests for the storage the PostgreSQL instance will use.

Value type Example
string 1Gi

instances.dataVolumeClaimSpec.accessModes

The Kubernetes PersistentVolumeClaim access modes for the PostgreSQL Write-ahead Log storage.

Value type Example
string ReadWriteOnce

instances.dataVolumeClaimSpec.resources.requests.storage

The Kubernetes storage requests for the storage the PostgreSQL instance will use.

Value type Example
string 1Gi

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.

instances.sidecars.image

Image for the custom sidecar container for PostgreSQL Pods.

Value type Example
string mycontainer1:latest

instances.sidecars.name

Name of the custom sidecar container for PostgreSQL Pods.

Value type Example
string testcontainer

instances.sidecars.imagePullPolicy

This option is used to set the policy for the PostgreSQL Pod sidecar container.

Value type Example
string Always

instances.sidecars.env

The environment variables set as key-value pairs for the custom sidecar container for PostgreSQL Pods.

Value type Example
subdoc

instances.sidecars.envFrom

The environment variables set as key-value pairs in ConfigMaps for the custom sidecar container for PostgreSQL Pods.

Value type Example
subdoc

instances.sidecars.command

Command for the custom sidecar container for PostgreSQL Pods.

Value type Example
array ["/bin/sh"]

instances.sidecars.args

Command arguments for the custom sidecar container for PostgreSQL Pods.

Value type Example
array ["-c", "while true; do trap 'exit 0' SIGINT SIGTERM SIGQUIT SIGKILL; done;"]

Backup section

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

backups.pgbackrest.metadata.labels

Set labels for pgBackRest Pods.

Value type Example
label pg-cluster-label: cluster1

backups.pgbackrest.image

The Docker image for pgBackRest.

Value type Example
string perconalab/percona-postgresql-operator:2.3.1-ppg16-pgbackrest

backups.pgbackrest.configuration.secret.name

Name of the Kubernetes Secret object with custom pgBackRest configuration, which will be added to the pgBackRest configuration generated by the Operator.

Value type Example
string cluster1-pgbackrest-secrets

backups.pgbackrest.jobs.priorityClassName

The Kuberentes Pod priority class for pgBackRest jobs.

Value type Example
string high-priority

backups.pgbackrest.jobs.resources.limits.cpu

Kubernetes CPU limits for a pgBackRest job.

Value type Example
int 200

backups.pgbackrest.jobs.resources.limits.memory

The Kubernetes memory limits for a pgBackRest job.

Value type Example
string 128Mi

backups.pgbackrest.jobs.tolerations.effect

The Kubernetes Pod tolerations effect for a pgBackRest job.

Value type Example
string NoSchedule

backups.pgbackrest.jobs.tolerations.key

The Kubernetes Pod tolerations key for a pgBackRest job.

Value type Example
string role

backups.pgbackrest.jobs.tolerations.operator

The Kubernetes Pod tolerations operator for a pgBackRest job.

Value type Example
string Equal

backups.pgbackrest.jobs.tolerations.value

The Kubernetes Pod tolerations value for a pgBackRest job.

Value type Example
string connection-poolers

backups.pgbackrest.global

Settings, which are to be included in the global section of the pgBackRest configuration generated by the Operator.

Value type Example
subdoc /pgbackrest/postgres-operator/hippo/repo1

backups.pgbackrest.repoHost.priorityClassName

The Kuberentes Pod priority class for pgBackRest repo.

Value type Example
string high-priority

backups.pgbackrest.repoHost.topologySpreadConstraints.maxSkew

The degree to which Pods may be unevenly distributed under the Kubernetes Pod Topology Spread Constraints .

Value type Example
int 1

backups.pgbackrest.repoHost.topologySpreadConstraints.topologyKey

The key of node labels for the Kubernetes Pod Topology Spread Constraints .

Value type Example
string my-node-label

backups.pgbackrest.repoHost.topologySpreadConstraints.whenUnsatisfiable

What to do with a Pod if it doesn’t satisfy the Kubernetes Pod Topology Spread Constraints .

Value type Example
string ScheduleAnyway

backups.pgbackrest.repoHost.topologySpreadConstraints.labelSelector.matchLabels

The Label selector for the Kubernetes Pod Topology Spread Constraints .

Value type Example
label postgres-operator.crunchydata.com/pgbackrest: ""

backups.pgbackrest.repoHost.affinity.podAntiAffinity

Pod anti-affinity, allows setting the standard Kubernetes affinity constraints of any complexity.

Value type Example
subdoc

backups.pgbackrest.manual.repoName

Name of the pgBackRest repository for on-demand backups.

Value type Example
string repo1

backups.pgbackrest.manual.options

The on-demand backup command-line options which will be passed to pgBackRest for on-demand backups.

Value type Example
string --type=full

backups.pgbackrest.repos.name

Name of the pgBackRest repository for backups.

Value type Example
string repo1

backups.pgbackrest.repos.schedules.full

Scheduled time to make a full backup specified in the crontab format .

Value type Example
string 0 0 \* \* 6

backups.pgbackrest.repos.schedules.differential

Scheduled time to make a differential backup specified in the crontab format .

Value type Example
string 0 0 \* \* 6

backups.pgbackrest.repos.volume.volumeClaimSpec.accessModes

The Kubernetes PersistentVolumeClaim access modes for the pgBackRest Storage.

Value type Example
string ReadWriteOnce

backups.pgbackrest.repos.volume.volumeClaimSpec.resources.requests.storage

The Kubernetes storage requests for the pgBackRest storage.

Value type Example
string 1Gi

backups.pgbackrest.repos.s3.bucket

The Amazon S3 bucket name used for backups

Value type Example
string "my-bucket"
.

backups.pgbackrest.repos.s3.endpoint

The endpoint URL of the S3-compatible storage to be used for backups (not needed for the original Amazon S3 cloud).

Value type Example
string "s3.ca-central-1.amazonaws.com"

backups.pgbackrest.repos.s3.region

The AWS region to use for Amazon and all S3-compatible storages.

Value type Example
boolean "ca-central-1"

backups.pgbackrest.repos.gcs.bucket

The Google Cloud Storage bucket name used for backups.

Value type Example
string "my-bucket"

backups.pgbackrest.repos.azure.container

Name of the Azure Blob Storage container for backups.

Value type Example
string my-container

PMM section

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

pmm.enabled

Enables or disables monitoring Percona Distribution for PostgreSQL cluster with PMM .

Value type Example
boolean false

pmm.image

Percona Monitoring and Management (PMM) Client Docker image.

Value type Example
string percona/pmm-client:2.41.0

pmm.imagePullPolicy

This option is used to set the policy for updating PMM Client images.

Value type Example
string IfNotPresent

pmm.pmmSecret

Name of the Kubernetes Secret object for the PMM Server password.

Value type Example
string cluster1-pmm-secret

pmm.serverHost

Address of the PMM Server to collect data from the cluster.

Value type Example
string monitoring-service

Proxy section

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

proxy.pgBouncer.metadata.labels

Set labels for pgBouncer Pods.

Value type Example
label pg-cluster-label: cluster1

proxy.pgBouncer.replicas

The number of the pgBouncer Pods to provide connection pooling.

Value type Example
int 3

proxy.pgBouncer.image

Docker image for the pgBouncer connection pooler.

Value type Example
string perconalab/percona-postgresql-operator:2.3.1-ppg16-pgbouncer

proxy.pgBouncer.exposeSuperusers

Enables or disables exposing superuser user through pgBouncer.

Value type Example
boolean false

proxy.pgBouncer.resources.limits.cpu

Kubernetes CPU limits for a pgBouncer container.

Value type Example
string 200m

proxy.pgBouncer.resources.limits.memory

The Kubernetes memory limits for a pgBouncer container.

Value type Example
string 128Mi

proxy.pgBouncer.expose.type

Specifies the type of Kubernetes Service for pgBouncer.

Value type Example
string ClusterIP

proxy.pgBouncer.expose.annotations

The Kubernetes annotations metadata for pgBouncer.

Value type Example
label pg-cluster-annot: cluster1

proxy.pgBouncer.expose.labels

Set labels for the pgBouncer Service.

Value type Example
label pg-cluster-label: cluster1

proxy.pgBouncer.expose.loadBalancerSourceRanges

The range of client IP addresses from which the load balancer should be reachable (if not set, there is no limitations).

Value type Example
string "10.0.0.0/8"
### proxy.pgBouncer.affinity.podAntiAffinity

Pod anti-affinity, allows setting the standard Kubernetes affinity constraints of any complexity.

Value type Example
subdoc

proxy.pgBouncer.config

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.

Value type Example
subdoc
global:
pool_mode: transaction

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.

proxy.pgBouncer.sidecars.image

Image for the custom sidecar container for pgBouncer Pods.

Value type Example
string mycontainer1:latest

proxy.pgBouncer.sidecars.name

Name of the custom sidecar container for pgBouncer Pods.

Value type Example
string testcontainer

proxy.pgBouncer.sidecars.imagePullPolicy

This option is used to set the policy for the pgBouncer Pod sidecar container.

Value type Example
string Always

proxy.pgBouncer.sidecars.env

The environment variables set as key-value pairs for the custom sidecar container for pgBouncer Pods.

Value type Example
subdoc

proxy.pgBouncer.sidecars.envFrom

The environment variables set as key-value pairs in ConfigMaps for the custom sidecar container for pgBouncer Pods.

Value type Example
subdoc

proxy.pgBouncer.sidecars.command

Command for the custom sidecar container for pgBouncer Pods.

Value type Example
array ["/bin/sh"]

proxy.pgBouncer.sidecars.args

Command arguments for the custom sidecar container for pgBouncer Pods.

Value type Example
array ["-c", "while true; do trap 'exit 0' SIGINT SIGTERM SIGQUIT SIGKILL; done;"]

Patroni Section

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

patroni.dynamicConfiguration

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.

Value type Example
subdoc
postgresql:
parameters:
max_parallel_workers: 2
max_worker_processes: 2
shared_buffers: 1GB
work_mem: 2MB

patroni.switchover.enabled

Enables or disables manual change of the cluster primary instance.

Value type Example
string
true

patroni.switchover.targetInstance

The name of the Pod that should be set as the new primary. When not specified, the new primary will be selected randomly.

Value type Example
string

Custom extensions Section

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

extensions.image

Image for the custom PostgreSQL extension loader sidecar container.

Value type Example
string percona/percona-postgresql-operator:2.3.1

extensions.imagePullPolicy

Policy for the custom extension sidecar container.

Value type Example
string Always

extensions.storage.type

The cloud storage type used for backups. Only s3 type is currently supported.

Value type Example
string s3

extensions.storage.bucket

The Amazon S3 bucket name for prepackaged PostgreSQL custom extensions.

Value type Example
string pg-extensions

extensions.storage.region

The AWS region to use.

Value type Example
string eu-central-1

extensions.storage.secret.name

The Kubernetes secret for the custom extensions storage. It should contain AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY keys.

Value type Example
string cluster1-extensions-secret

extensions.builtin

The key-value pairs which enable or disable Percona Distribution for PostgreSQL builtin extensions .

Value type Example
label pg_stat_monitor: true

extensions.custom.name

Name of the PostgreSQL custom extension.

Value type Example
string pg_cron

extensions.custom.version

Version of the PostgreSQL custom extension.

Value type Example
string 1.6.1

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-06-13