api

package
v0.4.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 18, 2025 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package api contains the Pgbackrest types that are used in the CloudNativePG API

Index

Constants

View Source
const (
	// EncryptionTypeNone means just use the bucket configuration
	EncryptionTypeNone = EncryptionType("")

	// EncryptionTypeAES256 means to use AES256 encryption
	EncryptionTypeAES256 = EncryptionType("aes-256-cbc")
)
View Source
const (
	// CompressionTypeNone means no compression is performed
	CompressionTypeNone = CompressionType("")

	// CompressionTypeGzip means gzip compression is performed
	CompressionTypeGzip = CompressionType("gz")

	// CompressionTypeBzip2 means bzip2 compression is performed
	CompressionTypeBzip2 = CompressionType("bz2")

	// CompressionTypeLz4 means lz4 compression is performed
	CompressionTypeLz4 = CompressionType("lz4")

	// CompressionTypeZstd means Zstandard compression is performed
	CompressionTypeZstd = CompressionType("zst")
)
View Source
const (
	// KeyTypeShared Shared keys
	KeyTypeShared = KeyType("shared")
	// KeyTypeAuto Automatically retrieve temporary credentials
	KeyTypeAuto = KeyType("auto")
	// KeyTypeWebID Automatically retrieve web identity credentials
	KeyTypeWebID = KeyType("web-id")
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CompressionType

type CompressionType string

CompressionType encapsulates the available types of compression

type DataBackupConfiguration

type DataBackupConfiguration struct {
	// The number of parallel jobs to be used to upload the backup, defaults
	// to 2
	// +kubebuilder:validation:Minimum=1
	// +optional
	Jobs *int32 `json:"jobs,omitempty"`

	// Control 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.
	// +optional
	ImmediateCheckpoint bool `json:"immediateCheckpoint,omitempty"`

	// Annotations is a list of key value pairs that will be passed to the
	// pgbackrest --annotation option.
	// +optional
	Annotations map[string]string `json:"tags,omitempty"`

	// AdditionalCommandArgs represents additional arguments that can be appended
	// to the 'pgbackrest backup' command-line invocation. These arguments
	// provide flexibility to customize the backup process further according to
	// specific requirements or configurations.
	//
	// Example:
	// In a scenario where specialized backup options are required, such as setting
	// a specific timeout or defining custom behavior, users can use this field
	// to specify additional command arguments.
	//
	// Note:
	// It's essential to ensure that the provided arguments are valid and supported
	// by the 'pgbackrest backup' command, to avoid potential errors or unintended
	// behavior during execution.
	// +optional
	AdditionalCommandArgs []string `json:"additionalCommandArgs,omitempty"`
}

DataBackupConfiguration is the configuration of the backup of the data directory

func (*DataBackupConfiguration) AppendAdditionalBackupCommandArgs added in v0.2.0

func (cfg *DataBackupConfiguration) AppendAdditionalBackupCommandArgs(options []string) []string

AppendAdditionalBackupCommandArgs adds custom arguments as pgbackrest backup command-line options

func (*DataBackupConfiguration) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DataBackupConfiguration.

func (*DataBackupConfiguration) DeepCopyInto

func (in *DataBackupConfiguration) DeepCopyInto(out *DataBackupConfiguration)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type DataRestoreConfiguration added in v0.2.0

type DataRestoreConfiguration struct {
	// The number of parallel jobs to be used to download the main backup.
	// +kubebuilder:validation:Minimum=1
	// +optional
	Jobs *int32 `json:"jobs,omitempty"`

	// AdditionalCommandArgs represents additional arguments that can be appended
	// to the 'pgbackrest restore' command-line invocation. These arguments
	// provide flexibility to customize the restore process further according to
	// specific requirements or configurations.
	//
	// Note:
	// It's essential to ensure that the provided arguments are valid and supported
	// by the 'pgbackrest restore' command, to avoid potential errors or unintended
	// behavior during execution.
	// +optional
	AdditionalCommandArgs []string `json:"additionalCommandArgs,omitempty"`
}

DataRestoreConfiguration is the configuration of the main backup restore process (pgbackrest restore call) which is then followed by a series of WAL restore (pgbackrest archive-get) calls using the WalBackupConfiguration

func (*DataRestoreConfiguration) AppendAdditionalRestoreCommandArgs added in v0.2.0

func (cfg *DataRestoreConfiguration) AppendAdditionalRestoreCommandArgs(options []string) []string

AppendAdditionalRestoreCommandArgs adds custom arguments as pgbackrest restore command-line options

func (*DataRestoreConfiguration) DeepCopy added in v0.2.0

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DataRestoreConfiguration.

func (*DataRestoreConfiguration) DeepCopyInto added in v0.2.0

func (in *DataRestoreConfiguration) DeepCopyInto(out *DataRestoreConfiguration)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type EncryptionType

type EncryptionType string

EncryptionType encapsulated the available types of encryption

type KeyType added in v0.4.0

type KeyType string

KeyType is the type of key used for S3 credentials

type PgbackrestConfiguration

type PgbackrestConfiguration struct {
	Repositories []PgbackrestRepository `json:"repositories"`

	// The 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.
	// +optional
	Wal *WalBackupConfiguration `json:"wal,omitempty"`

	// The 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.
	// +optional
	Data *DataBackupConfiguration `json:"data,omitempty"`

	// The configuration to be used to restore the data files
	// +optional
	Restore *DataRestoreConfiguration `json:"restore,omitempty"`

	// Compress a WAL file before sending it to the object store. Available
	// options are empty string (no compression, default), `gz`, `bz2`, `lz4` or 'zst'.
	// +kubebuilder:validation:Enum=gz;bz2;lz4;zst
	// +optional
	Compression CompressionType `json:"compression,omitempty"`

	// Pgbackrest stanza (name used in the archive store), the cluster name is used if
	// this parameter is omitted
	// +optional
	Stanza string `json:"stanza,omitempty"`
}

PgbackrestConfiguration is the configuration of all pgBackRest operations

func (*PgbackrestConfiguration) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PgbackrestConfiguration.

func (*PgbackrestConfiguration) DeepCopyInto

func (in *PgbackrestConfiguration) DeepCopyInto(out *PgbackrestConfiguration)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type PgbackrestCredentials

type PgbackrestCredentials struct {
	// The credentials to use to upload data to S3
	// +optional
	AWS *S3Credentials `json:"s3Credentials,omitempty"`
}

PgbackrestCredentials an object containing the potential credentials for each cloud provider

func (PgbackrestCredentials) ArePopulated

func (credentials PgbackrestCredentials) ArePopulated() bool

ArePopulated checks if the passed set of credentials contains something

func (*PgbackrestCredentials) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PgbackrestCredentials.

func (*PgbackrestCredentials) DeepCopyInto

func (in *PgbackrestCredentials) DeepCopyInto(out *PgbackrestCredentials)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type PgbackrestRepository

type PgbackrestRepository struct {
	// The potential credentials for each cloud provider
	PgbackrestCredentials `json:",inline"`

	// Whether to use the client-side encryption of files.
	// Allowed options are empty string (no encryption, default) and
	// `aes-256-cbc` (recommended, requires EncryptionKey defined)
	// +kubebuilder:validation:Enum="aes-256-cbc"
	// +optional
	Encryption EncryptionType `json:"encryption,omitempty"`
	// +optional
	EncryptionKey *machineryapi.SecretKeySelector `json:"encryptionKey,omitempty"`

	// Endpoint to be used to upload data to the cloud,
	// overriding the automatic endpoint discovery
	// +optional
	EndpointURL string `json:"endpointURL,omitempty"`

	// EndpointCA store the CA bundle of the pgbackrest endpoint.
	// Useful when using self-signed certificates to avoid
	// errors with certificate issuer and pgbackrest
	// +optional
	EndpointCA *machineryapi.SecretKeySelector `json:"endpointCA,omitempty"`
	// DisableVerifyTLS toggles strict certificate validation.
	// +optional
	DisableVerifyTLS bool `json:"disableVerifyTLS,omitempty"`

	// The path in the bucket where to store the backup (i.e. path/to/folder).
	// Must start with a slash character.
	// +kubebuilder:validation:Pattern=(/[a-zA-Z]*)+
	DestinationPath string `json:"destinationPath"`
	// +kubebuilder:validation:MinLength=1
	Bucket string `json:"bucket"`

	// The retention policy for backups.
	// If at least full backup retention isn't configured, both backups and WAL archives
	// will be stored in the repository indefinitely.
	// Note that automatic expiration happens only after a backup is created.
	// +optional
	Retention *PgbackrestRetention `json:"retention,omitempty"`
}

PgbackrestRepository contains configuration of a single Pgbackrest backup target repository, including all data needed to properly connect and authenticate with a selected object store.

func (*PgbackrestRepository) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PgbackrestRepository.

func (*PgbackrestRepository) DeepCopyInto

func (in *PgbackrestRepository) DeepCopyInto(out *PgbackrestRepository)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type PgbackrestRetention

type PgbackrestRetention struct {
	// Number of backups worth of continuous WAL to retain.
	// Can be used to aggressively expire WAL segments and save disk space.
	// However, doing so negates the ability to perform PITR from the backups with
	// expired WAL and is therefore not recommended.
	// +optional
	// +kubebuilder:validation:Maximum=9999999
	// +kubebuilder:validation:Minimum=1
	Archive int32 `json:"archive,omitempty"`

	// Backup type for WAL retention.
	// It is recommended that this setting not be changed from the default which will
	// only expire WAL in conjunction with expiring full backups.
	// Available options are `full` (default), `diff` or `incr`.
	// +optional
	// +kubebuilder:validation:Enum=full;diff;incr
	ArchiveType string `json:"archiveType,omitempty"`

	// Full backup retention count/time (in days)
	// When a full backup expires, all differential and incremental backups associated
	// with the full backup will also expire.
	// +optional
	// +kubebuilder:validation:Maximum=9999999
	// +kubebuilder:validation:Minimum=1
	Full int32 `json:"full,omitempty"`

	// Retention type for full backups.
	//  Determines whether the repo-retention-full setting represents a time period
	// (days) or count of full backups to keep.
	// Available options are `count` (default) and `time`.
	// +optional
	// +kubebuilder:validation:Enum=count;time
	FullType string `json:"fullType,omitempty"`

	// Number of differential backups to retain.
	// When a differential backup expires, all incremental backups associated with the
	// differential backup will also expire.
	// Note that full backups are included in the count of differential backups for the
	// purpose of expiration
	// +optional
	// +kubebuilder:validation:Maximum=9999999
	// +kubebuilder:validation:Minimum=1
	Diff int32 `json:"diff,omitempty"`

	// Days of backup history manifests to retain.
	// When a differential backup expires, all incremental backups associated with the
	// differential backup will also expire.
	// Note that full backups are included in the count of differential backups for the
	// purpose of expiration
	// Defaults to not set, which means those files are never removed. Set to 0 to
	// retain the backup history only for unexpired backups.
	// +optional
	// +kubebuilder:validation:Maximum=9999999
	// +kubebuilder:validation:Minimum=0
	History *int32 `json:"history,omitempty"`
}

PgbackrestRetention an object containing the backup retention time for all backup types supported by pgbackrest.

func (*PgbackrestRetention) DeepCopy

func (in *PgbackrestRetention) DeepCopy() *PgbackrestRetention

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PgbackrestRetention.

func (*PgbackrestRetention) DeepCopyInto

func (in *PgbackrestRetention) DeepCopyInto(out *PgbackrestRetention)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type S3Credentials

type S3Credentials struct {
	// KeyType specifies the type of key used for S3 credentials
	// +optional
	// +kubebuilder:default:=shared
	KeyType KeyType `json:"keyType,omitempty"`

	// The reference to the access key ID
	// +optional
	AccessKeyIDReference *machineryapi.SecretKeySelector `json:"accessKeyId,omitempty"`

	// The reference to the secret access key
	// +optional
	SecretAccessKeyReference *machineryapi.SecretKeySelector `json:"secretAccessKey,omitempty"`

	// The reference to the secret containing the region name.
	// For S3-compatible stores like Ceph any value can be used.
	// +kubebuilder:validation:MinLength=1
	Region string `json:"region,omitempty"`

	// S3 Repository URI style, either "host" (default) or "path".
	// TODO: Enforce values via Enum like iin compression.
	// +optional
	URIStyle string `json:"uriStyle,omitempty"`
}

S3Credentials is the type for the credentials to be used to upload files to S3. It can be provided in two alternative ways:

- explicitly passing accessKeyId and secretAccessKey

- inheriting the role from the pod environment by setting inheritFromIAMRole to true

func (*S3Credentials) DeepCopy

func (in *S3Credentials) DeepCopy() *S3Credentials

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new S3Credentials.

func (*S3Credentials) DeepCopyInto

func (in *S3Credentials) DeepCopyInto(out *S3Credentials)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type WalBackupConfiguration

type WalBackupConfiguration struct {
	// Number of WAL files to be either archived in parallel (when the
	// PostgreSQL instance is archiving to a backup object store) or
	// restored in parallel (when a PostgreSQL standby is fetching WAL
	// files from a recovery object store). If not specified, WAL files
	// will be processed one at a time. It accepts a positive integer as a
	// value - with 1 being the minimum accepted value.
	// +kubebuilder:validation:Minimum=1
	// +optional
	MaxParallel int `json:"maxParallel,omitempty"`
	// Additional arguments that can be appended to the 'pgbackrest archive-push'
	// command-line invocation. These arguments provide flexibility to customize
	// the WAL archive process further, according to specific requirements or configurations.
	//
	// Example:
	// In a scenario where specialized backup options are required, such as setting
	// a specific timeout or defining custom behavior, users can use this field
	// to specify additional command arguments.
	//
	// Note:
	// It's essential to ensure that the provided arguments are valid and supported
	// by the 'pgbackrest archive-push' command, to avoid potential errors or unintended
	// behavior during execution.
	// +optional
	ArchiveAdditionalCommandArgs []string `json:"archiveAdditionalCommandArgs,omitempty"`

	// Additional arguments that can be appended to the 'pgbackrest restore'
	// command-line invocation. These arguments provide flexibility to customize
	// the WAL restore process further, according to specific requirements or configurations.
	//
	// Example:
	// In a scenario where specialized backup options are required, such as setting
	// a specific timeout or defining custom behavior, users can use this field
	// to specify additional command arguments.
	//
	// Note:
	// It's essential to ensure that the provided arguments are valid and supported
	// by the 'pgbackrest restore' command, to avoid potential errors or unintended
	// behavior during execution.
	// +optional
	RestoreAdditionalCommandArgs []string `json:"restoreAdditionalCommandArgs,omitempty"`
}

WalBackupConfiguration is the configuration of the backup of the WAL stream

func (*WalBackupConfiguration) AppendAdditionalArchiveGetCommandArgs added in v0.2.0

func (cfg *WalBackupConfiguration) AppendAdditionalArchiveGetCommandArgs(options []string) []string

AppendAdditionalArchiveGetCommandArgs adds custom arguments as pgbackrest archive-get command-line options

func (*WalBackupConfiguration) AppendAdditionalArchivePushCommandArgs added in v0.2.0

func (cfg *WalBackupConfiguration) AppendAdditionalArchivePushCommandArgs(options []string) []string

AppendAdditionalArchivePushCommandArgs adds custom arguments as pgbackrest archive-push command-line options

func (*WalBackupConfiguration) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WalBackupConfiguration.

func (*WalBackupConfiguration) DeepCopyInto

func (in *WalBackupConfiguration) DeepCopyInto(out *WalBackupConfiguration)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL