api

package
v0.0.0-...-ae6c240 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2024 License: Apache-2.0 Imports: 4 Imported by: 3

Documentation

Overview

Package api contains the Barman 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("AES256")

	// EncryptionTypeNoneAWSKMS means to use aws:kms encryption
	EncryptionTypeNoneAWSKMS = EncryptionType("aws:kms")
)
View Source
const (
	// CompressionTypeNone means no compression is performed
	CompressionTypeNone = CompressionType("")

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

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

	// CompressionTypeSnappy means snappy compression is performed
	CompressionTypeSnappy = CompressionType("snappy")
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AzureCredentials

type AzureCredentials struct {
	// The connection string to be used
	// +optional
	ConnectionString *machineryapi.SecretKeySelector `json:"connectionString,omitempty"`

	// The storage account where to upload data
	// +optional
	StorageAccount *machineryapi.SecretKeySelector `json:"storageAccount,omitempty"`

	// The storage account key to be used in conjunction
	// with the storage account name
	// +optional
	StorageKey *machineryapi.SecretKeySelector `json:"storageKey,omitempty"`

	// A shared-access-signature to be used in conjunction with
	// the storage account name
	// +optional
	StorageSasToken *machineryapi.SecretKeySelector `json:"storageSasToken,omitempty"`

	// Use the Azure AD based authentication without providing explicitly the keys.
	// +optional
	InheritFromAzureAD bool `json:"inheritFromAzureAD,omitempty"`
}

AzureCredentials is the type for the credentials to be used to upload files to Azure Blob Storage. The connection string contains every needed information. If the connection string is not specified, we'll need the storage account name and also one (and only one) of:

- storageKey - storageSasToken

- inheriting the credentials from the pod environment by setting inheritFromAzureAD to true

func (*AzureCredentials) DeepCopy

func (in *AzureCredentials) DeepCopy() *AzureCredentials

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

func (*AzureCredentials) DeepCopyInto

func (in *AzureCredentials) DeepCopyInto(out *AzureCredentials)

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

func (*AzureCredentials) ValidateAzureCredentials

func (azure *AzureCredentials) ValidateAzureCredentials(path *field.Path) field.ErrorList

ValidateAzureCredentials checks and validates the azure credentials

type BarmanCredentials

type BarmanCredentials struct {
	// The credentials to use to upload data to Google Cloud Storage
	// +optional
	Google *GoogleCredentials `json:"googleCredentials,omitempty"`

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

	// The credentials to use to upload data to Azure Blob Storage
	// +optional
	Azure *AzureCredentials `json:"azureCredentials,omitempty"`
}

BarmanCredentials an object containing the potential credentials for each cloud provider

func (BarmanCredentials) ArePopulated

func (crendentials BarmanCredentials) ArePopulated() bool

ArePopulated checks if the passed set of credentials contains something

func (*BarmanCredentials) DeepCopy

func (in *BarmanCredentials) DeepCopy() *BarmanCredentials

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

func (*BarmanCredentials) DeepCopyInto

func (in *BarmanCredentials) DeepCopyInto(out *BarmanCredentials)

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

type BarmanObjectStoreConfiguration

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

	// 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 barman endpoint.
	// Useful when using self-signed certificates to avoid
	// errors with certificate issuer and barman-cloud-wal-archive
	// +optional
	EndpointCA *machineryapi.SecretKeySelector `json:"endpointCA,omitempty"`

	// The 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 data
	// +kubebuilder:validation:MinLength=1
	DestinationPath string `json:"destinationPath"`

	// The server name on S3, the cluster name is used if this
	// parameter is omitted
	// +optional
	ServerName string `json:"serverName,omitempty"`

	// 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"`

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

	// HistoryTags is a list of key value pairs that will be passed to the
	// Barman --history-tags option.
	// +optional
	HistoryTags map[string]string `json:"historyTags,omitempty"`
}

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

func (*BarmanObjectStoreConfiguration) DeepCopy

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

func (*BarmanObjectStoreConfiguration) DeepCopyInto

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

type CompressionType

type CompressionType string

CompressionType encapsulates the available types of compression

type DataBackupConfiguration

type DataBackupConfiguration struct {
	// Compress a backup file (a tar file per tablespace) while streaming it
	// to the object store. Available options are empty string (no
	// compression, default), `gzip`, `bzip2` or `snappy`.
	// +kubebuilder:validation:Enum=gzip;bzip2;snappy
	// +optional
	Compression CompressionType `json:"compression,omitempty"`

	// Whenever 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:kms`
	// +kubebuilder:validation:Enum=AES256;"aws:kms"
	// +optional
	Encryption EncryptionType `json:"encryption,omitempty"`

	// 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"`

	// AdditionalCommandArgs represents additional arguments that can be appended
	// to the 'barman-cloud-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 'barman-cloud-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) AppendAdditionalCommandArgs

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

AppendAdditionalCommandArgs adds custom arguments as barman-cloud-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 EncryptionType

type EncryptionType string

EncryptionType encapsulated the available types of encryption

type GoogleCredentials

type GoogleCredentials struct {
	// The secret containing the Google Cloud Storage JSON file with the credentials
	// +optional
	ApplicationCredentials *machineryapi.SecretKeySelector `json:"applicationCredentials,omitempty"`

	// If set to true, will presume that it's running inside a GKE environment,
	// default to false.
	// +optional
	GKEEnvironment bool `json:"gkeEnvironment,omitempty"`
}

GoogleCredentials is the type for the Google Cloud Storage credentials. This needs to be specified even if we run inside a GKE environment.

func (*GoogleCredentials) DeepCopy

func (in *GoogleCredentials) DeepCopy() *GoogleCredentials

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

func (*GoogleCredentials) DeepCopyInto

func (in *GoogleCredentials) DeepCopyInto(out *GoogleCredentials)

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

func (*GoogleCredentials) ValidateGCSCredentials

func (gcs *GoogleCredentials) ValidateGCSCredentials(path *field.Path) field.ErrorList

ValidateGCSCredentials validates the GCS credentials

type S3Credentials

type S3Credentials struct {
	// 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
	// +optional
	RegionReference *machineryapi.SecretKeySelector `json:"region,omitempty"`

	// The references to the session key
	// +optional
	SessionToken *machineryapi.SecretKeySelector `json:"sessionToken,omitempty"`

	// Use the role based authentication without providing explicitly the keys.
	// +optional
	InheritFromIAMRole bool `json:"inheritFromIAMRole,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.

func (*S3Credentials) ValidateAwsCredentials

func (s3 *S3Credentials) ValidateAwsCredentials(path *field.Path) field.ErrorList

ValidateAwsCredentials validates the AWS Credentials

type WalBackupConfiguration

type WalBackupConfiguration struct {
	// Compress a WAL file before sending it to the object store. Available
	// options are empty string (no compression, default), `gzip`, `bzip2` or `snappy`.
	// +kubebuilder:validation:Enum=gzip;bzip2;snappy
	// +optional
	Compression CompressionType `json:"compression,omitempty"`

	// Whenever 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:kms`
	// +kubebuilder:validation:Enum=AES256;"aws:kms"
	// +optional
	Encryption EncryptionType `json:"encryption,omitempty"`

	// 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 'barman-cloud-wal-archive'
	// 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 'barman-cloud-wal-archive' command, to avoid potential errors or unintended
	// behavior during execution.
	// +optional
	ArchiveAdditionalCommandArgs []string `json:"archiveAdditionalCommandArgs,omitempty"`

	// Additional arguments that can be appended to the 'barman-cloud-wal-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 'barman-cloud-wal-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) AppendArchiveAdditionalCommandArgs

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

AppendArchiveAdditionalCommandArgs adds custom arguments as barman-cloud-wal-archive command-line options

func (*WalBackupConfiguration) AppendRestoreAdditionalCommandArgs

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

AppendRestoreAdditionalCommandArgs adds custom arguments as barman-cloud-wal-restore 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.

Directories

Path Synopsis
Package webhooks provides a set of functions and types for validating the data structures contained in the api pkg.
Package webhooks provides a set of functions and types for validating the data structures contained in the api pkg.

Jump to

Keyboard shortcuts

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