API Reference - v0.6.0 v1

Cloud Native PostgreSQL extends the Kubernetes API defining the following custom resources:

All the resources are defined in the postgresql.k8s.enterprisedb.io/v1alpha1 API.

Please refer to the "Configuration Samples" page" of the documentation for examples of usage.

Below you will find a description of the defined resources:

Backup

Backup is the Schema for the backups API

FieldDescriptionSchemeRequired
metadatametav1.ObjectMetafalse
specSpecification of the desired behavior of the backup. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-statusBackupSpecfalse
statusMost recently observed status of the backup. This data may not be up to date. Populated by the system. Read-only. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-statusBackupStatusfalse

BackupList

BackupList contains a list of Backup

FieldDescriptionSchemeRequired
metadataStandard list metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kindsmetav1.ListMetafalse
itemsList of backups[][Backup](#backup)true

BackupSpec

BackupSpec defines the desired state of Backup

FieldDescriptionSchemeRequired
clusterThe cluster to backupv1.LocalObjectReferencefalse

BackupStatus

BackupStatus defines the observed state of Backup

FieldDescriptionSchemeRequired
s3CredentialsThe credentials to use to upload data to S3S3Credentialstrue
endpointURLEndpoint to be used to upload data to the cloud, overriding the automatic endpoint discoverystringfalse
destinationPathThe path where to store the backup (i.e. s3://bucket/path/to/folder) this path, with different destination folders, will be used for WALs and for datastringtrue
serverNameThe server name on S3, the cluster name is used if this parameter is omittedstringfalse
encryptionEncryption method required to S3 APIstringfalse
backupIdThe ID of the Barman backupstringfalse
phaseThe last backup statusBackupPhasefalse
startedAtWhen the backup was started*metav1.Timefalse
stoppedAtWhen the backup was terminated*metav1.Timefalse
errorThe detected errorstringfalse
commandOutputThe backup command outputstringfalse
commandErrorThe backup command outputstringfalse

AffinityConfiguration

AffinityConfiguration contains the info we need to create the affinity rules for Pods

FieldDescriptionSchemeRequired
enablePodAntiAffinityShould we enable anti affinity or not?booltrue
topologyKeyTopologyKey to use for anti-affinity configuration. See k8s documentation for more info on thatstringtrue

BackupConfiguration

BackupConfiguration defines how the backup of the cluster are taken. Currently the only supported backup method is barmanObjectStore. For details and examples refer to the Backup and Recovery section of the documentation

FieldDescriptionSchemeRequired
barmanObjectStoreThe configuration for the barman-cloud tool suite*BarmanObjectStoreConfigurationfalse

BarmanObjectStoreConfiguration

BarmanObjectStoreConfiguration contains the backup configuration using Barman against an S3-compatible object storage

FieldDescriptionSchemeRequired
s3CredentialsThe credentials to use to upload data to S3S3Credentialstrue
endpointURLEndpoint to be used to upload data to the cloud, overriding the automatic endpoint discoverystringfalse
destinationPathThe path where to store the backup (i.e. s3://bucket/path/to/folder) this path, with different destination folders, will be used for WALs and for datastringtrue
serverNameThe server name on S3, the cluster name is used if this parameter is omittedstringfalse
walThe configuration for the backup of the WAL stream. When not defined, WAL files will be stored uncompressed and may be unencrypted in the object store, according to the bucket default policy.*WalBackupConfigurationfalse
dataThe configuration to be used to backup the data files When not defined, base backups files will be stored uncompressed and may be unencrypted in the object store, according to the bucket default policy.*DataBackupConfigurationfalse

BootstrapConfiguration

BootstrapConfiguration contains information about how to create the PostgreSQL cluster. Only a single bootstrap method can be defined among the supported ones. initdb will be used as the bootstrap method if left unspecified. Refer to the Bootstrap page of the documentation for more information.

FieldDescriptionSchemeRequired
initdbBootstrap the cluster via initdb*BootstrapInitDBfalse
recoveryBootstrap the cluster from a backup*BootstrapRecoveryfalse

BootstrapInitDB

BootstrapInitDB is the configuration of the bootstrap process when initdb is used Refer to the Bootstrap page of the documentation for more information.

FieldDescriptionSchemeRequired
databaseName of the database used by the application. Default: app.stringtrue
ownerName of the owner of the database in the instance to be used by applications. Defaults to the value of the database key.stringtrue
secretName of the secret containing the initial credentials for the owner of the user database. If empty a new secret will be created from scratch*corev1.LocalObjectReferencefalse
redwoodIf we need to enable/disable Redwood compatibility. Requires EPAS and for EPAS defaults to true*boolfalse
optionsThe list of options that must be passed to initdb when creating the cluster[]stringfalse

BootstrapRecovery

BootstrapRecovery contains the configuration required to restore the backup with the specified name and, after having changed the password with the one chosen for the superuser, will use it to bootstrap a full cluster cloning all the instances from the restored primary. Refer to the Bootstrap page of the documentation for more information.

FieldDescriptionSchemeRequired
backupThe backup we need to restorecorev1.LocalObjectReferencetrue
recoveryTargetBy default the recovery will end as soon as a consistent state is reached: in this case that means at the end of a backup. This option allows to fine tune the recovery process*RecoveryTargetfalse

Cluster

Cluster is the Schema for the postgresql API

FieldDescriptionSchemeRequired
metadatametav1.ObjectMetafalse
specSpecification of the desired behavior of the cluster. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-statusClusterSpecfalse
statusMost recently observed status of the cluster. This data may not be up to date. Populated by the system. Read-only. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-statusClusterStatusfalse

ClusterList

ClusterList contains a list of Cluster

FieldDescriptionSchemeRequired
metadataStandard list metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kindsmetav1.ListMetafalse
itemsList of clusters[][Cluster](#cluster)true

ClusterSpec

ClusterSpec defines the desired state of Cluster

FieldDescriptionSchemeRequired
descriptionDescription of this PostgreSQL clusterstringfalse
imageNameName of the container imagestringfalse
postgresUIDThe UID of the postgres user inside the image, defaults to 26int64false
postgresGIDThe GID of the postgres user inside the image, defaults to 26int64false
instancesNumber of instances required in the clusterint32true
minSyncReplicasMinimum number of instances required in synchronous replication with the primary. Undefined or 0 allow writes to complete when no standby is available.int32false
maxSyncReplicasThe target value for the synchronous replication quorum, that can be decreased if the number of ready standbys is lower than this. Undefined or 0 disable synchronous replication.int32false
postgresqlConfiguration of the PostgreSQL serverPostgresConfigurationfalse
bootstrapInstructions to bootstrap this cluster*BootstrapConfigurationfalse
superuserSecretThe secret containing the superuser password. If not defined a new secret will be created with a randomly generated password*corev1.LocalObjectReferencefalse
imagePullSecretsThe list of pull secrets to be used to pull the images. If the license key contains a pull secret that secret will be automatically included.[]corev1.LocalObjectReferencefalse
storageConfiguration of the storage of the instancesStorageConfigurationfalse
startDelayThe time in seconds that is allowed for a PostgreSQL instance to successfully start up (default 30)int32false
stopDelayThe time in seconds that is allowed for a PostgreSQL instance node to gracefully shutdown (default 30)int32false
affinityAffinity/Anti-affinity rules for PodsAffinityConfigurationfalse
resourcesResources requirements of every generated Pod. Please refer to https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ for more information.corev1.ResourceRequirementsfalse
primaryUpdateStrategyStrategy to follow to upgrade the primary server during a rolling update procedure, after all replicas have been successfully updated: it can be automated (unsupervised - default) or manual (supervised)PrimaryUpdateStrategyfalse
backupThe configuration to be used for backups*BackupConfigurationfalse
nodeMaintenanceWindowDefine a maintenance window for the Kubernetes nodes*NodeMaintenanceWindowfalse
licenseKeyThe license key of the cluster. When empty, the cluster operates in trial mode and after the expiry date (default 30 days) the operator will cease any reconciliation attempt. For details, please refer to the license agreement that comes with the operator.stringfalse

ClusterStatus

ClusterStatus defines the observed state of Cluster

FieldDescriptionSchemeRequired
instancesTotal number of instances in the clusterint32false
readyInstancesTotal number of ready instances in the clusterint32false
instancesStatusInstances statusmap[utils.PodStatus][]stringfalse
latestGeneratedNodeID of the latest generated node (used to avoid node name clashing)int32false
currentPrimaryCurrent primary instancestringfalse
targetPrimaryTarget primary instance, this is different from the previous one during a switchover or a failoverstringfalse
pvcCountHow many PVCs have been created by this clusterint32false
jobCountHow many Jobs have been created by this clusterint32false
danglingPVCList of all the PVCs created by this cluster and still available which are not attached to a Pod[]stringfalse
licenseStatusStatus of the licenselicensekey.Statusfalse
writeServiceCurrent write podstringfalse
readServiceCurrent list of read podsstringfalse
phaseCurrent phase of the clusterstringfalse
phaseReasonReason for the current phasestringfalse

DataBackupConfiguration

DataBackupConfiguration is the configuration of the backup of the data directory

FieldDescriptionSchemeRequired
compressionCompress a backup file (a tar file per tablespace) while streaming it to the object store. Available options are empty string (no compression, default), gzip or bzip2.CompressionTypefalse
encryptionWhenever to force the encryption of files (if the bucket is not already configured for that). Allowed options are empty string (use the bucket policy, default), AES256 and aws:kmsEncryptionTypefalse
immediateCheckpointControl whether the I/O workload for the backup initial checkpoint will be limited, according to the checkpoint_completion_target setting on the PostgreSQL server. If set to true, an immediate checkpoint will be used, meaning PostgreSQL will complete the checkpoint as soon as possible. false by default.boolfalse
jobsThe number of parallel jobs to be used to upload the backup, defaults to 2*int32false

NodeMaintenanceWindow

NodeMaintenanceWindow contains information that the operator will use while upgrading the underlying node.

This option is only useful when using local storage, as the Pods can't be freely moved between nodes in that configuration.

FieldDescriptionSchemeRequired
inProgressIs there a node maintenance activity in progress?booltrue
reusePVCReuse the existing PVC (wait for the node to come up again) or not (recreate it elsewhere)*booltrue

PostgresConfiguration

PostgresConfiguration defines the PostgreSQL configuration

FieldDescriptionSchemeRequired
parametersPostgreSQL configuration options (postgresql.conf)map[string]stringfalse
pg_hbaPostgreSQL Host Based Authentication rules (lines to be appended to the pg_hba.conf file)[]stringfalse

RecoveryTarget

RecoveryTarget allows to configure the moment where the recovery process will stop. All the target options except TargetTLI are mutually exclusive.

FieldDescriptionSchemeRequired
targetTLIThe target timeline (\"latest\", \"current\" or a positive integer)stringfalse
targetXIDThe target transaction IDstringfalse
targetNameThe target name (to be previously created with pg_create_restore_point)stringfalse
targetLSNThe target LSN (Log Sequence Number)stringfalse
targetTimeThe target time, in any unambiguous representation allowed by PostgreSQLstringfalse
targetImmediateEnd recovery as soon as a consistent state is reached*boolfalse
exclusiveSet the target to be exclusive (defaults to true)*boolfalse

RollingUpdateStatus

RollingUpdateStatus contains the information about an instance which is being updated

FieldDescriptionSchemeRequired
imageNameThe image which we put into the Podstringtrue
startedAtWhen the update has been startedmetav1.Timefalse

S3Credentials

S3Credentials is the type for the credentials to be used to upload files to S3

FieldDescriptionSchemeRequired
accessKeyIdThe reference to the access key idcorev1.SecretKeySelectortrue
secretAccessKeyThe reference to the secret access keycorev1.SecretKeySelectortrue

StorageConfiguration

StorageConfiguration is the configuration of the storage of the PostgreSQL instances

FieldDescriptionSchemeRequired
storageClassStorageClass to use for database data (PGDATA). Applied after evaluating the PVC template, if available. If not specified, generated PVCs will be satisfied by the default storage class*stringfalse
sizeSize of the storage. Required if not already specified in the PVC template.stringtrue
pvcTemplateTemplate to be used to generate the Persistent Volume Claim*corev1.PersistentVolumeClaimSpecfalse

WalBackupConfiguration

WalBackupConfiguration is the configuration of the backup of the WAL stream

FieldDescriptionSchemeRequired
compressionCompress a WAL file before sending it to the object store. Available options are empty string (no compression, default), gzip or bzip2.CompressionTypefalse
encryptionWhenever to force the encryption of files (if the bucket is not already configured for that). Allowed options are empty string (use the bucket policy, default), AES256 and aws:kmsEncryptionTypefalse

ScheduledBackup

ScheduledBackup is the Schema for the scheduledbackups API

FieldDescriptionSchemeRequired
metadatametav1.ObjectMetafalse
specSpecification of the desired behavior of the ScheduledBackup. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-statusScheduledBackupSpecfalse
statusMost recently observed status of the ScheduledBackup. This data may not be up to date. Populated by the system. Read-only. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-statusScheduledBackupStatusfalse

ScheduledBackupList

ScheduledBackupList contains a list of ScheduledBackup

FieldDescriptionSchemeRequired
metadataStandard list metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kindsmetav1.ListMetafalse
itemsList of clusters[][ScheduledBackup](#scheduledbackup)true

ScheduledBackupSpec

ScheduledBackupSpec defines the desired state of ScheduledBackup

FieldDescriptionSchemeRequired
suspendIf this backup is suspended of not*boolfalse
scheduleThe schedule in Cron format, see https://en.wikipedia.org/wiki/Cron.stringtrue
clusterThe cluster to backupv1.LocalObjectReferencefalse

ScheduledBackupStatus

ScheduledBackupStatus defines the observed state of ScheduledBackup

FieldDescriptionSchemeRequired
lastCheckTimeThe latest time the schedule*metav1.Timefalse
lastScheduleTimeInformation when was the last time that backup was successfully scheduled.*metav1.Timefalse