v1beta1

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2025 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package v1 contains API Schema definitions for the v1 API group. +kubebuilder:object:generate=true +groupName=cnpg-extensions.yandex.cloud

Index

Constants

View Source
const (
	DefaultDownloadFileRetries = 5
	DefaultDeltaMaxSteps       = 0
)
View Source
const BackupAllDependentsAnnotationName = "cnpg-plugin-wal-g.yandex.cloud/dependent-backups-all"

BackupAllDependentsAnnotation represents all incremental backups (both direct and indirect) depending on current backup

View Source
const BackupConfigCMFinalizerName = "cnpg-plugin-wal-g.yandex.cloud/backup-config-configmap-protection"

Finalizer added to ConfigMap resources referenced by BackupConfig to protect from accidental deletion It is used to ensure that ConfigMap are not deleted while they are still referenced by a BackupConfig

View Source
const BackupConfigFinalizerName = "cnpg-plugin-wal-g.yandex.cloud/backup-config-cleanup"

Finalizer added to CNPG BackupConfig resources managed by plugin It is used to ensure that backup removed from storage before Backup resource deleted

View Source
const BackupConfigSecretFinalizerName = "cnpg-plugin-wal-g.yandex.cloud/backup-config-secret-protection"

Finalizer added to Secret resources referenced by BackupConfig to protect from accidental deletion It is used to ensure that Secrets are not deleted while they are still referenced by a BackupConfig

View Source
const BackupDirectDependentsAnnotationName = "cnpg-plugin-wal-g.yandex.cloud/dependent-backups-direct"

BackupDirectDependentsAnnotation represents incremental backups which are created from current backup

View Source
const BackupFinalizerName = "cnpg-plugin-wal-g.yandex.cloud/backup-cleanup"

Finalizer added to CNPG Backup resources managed by plugin It is used to ensure that backup removed from storage before Backup resource deleted

View Source
const BackupPgVersionLabelName = "cnpg-plugin-wal-g.yandex.cloud/pg-major"

PGVersionLabel represents PG major version from which backup was created

View Source
const BackupTypeLabelName = "cnpg-plugin-wal-g.yandex.cloud/backup-type"

BackupTypeLabel represents type of created backup (full / incremental)

View Source
const (
	StorageTypeS3 = "s3"
)

Variables

View Source
var (
	// GroupVersion is group version used to register these objects.
	GroupVersion = schema.GroupVersion{Group: "cnpg-extensions.yandex.cloud", Version: "v1beta1"}

	// SchemeBuilder is used to add go types to the GroupVersionKind scheme.
	SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion}

	// AddToScheme adds the types in this group-version to the given scheme.
	AddToScheme = SchemeBuilder.AddToScheme
)

Functions

func BackupConfigIsUsedForArchivation

func BackupConfigIsUsedForArchivation(backupConfigName types.NamespacedName, cluster *cnpgv1.Cluster) bool

BackupConfigIsUsedForArchivation checks whether BackupConfig with specified name is used by CNPG Cluster as configuration for new backups && wal archive

func BackupConfigIsUsedForRecovery

func BackupConfigIsUsedForRecovery(backupConfigName types.NamespacedName, cluster *cnpgv1.Cluster) bool

BackupConfigIsUsedForRecovery checks whether BackupConfig with specified name is used by CNPG Cluster as recovery source

func GetBackupConfigEncryptionSecretName added in v0.2.0

func GetBackupConfigEncryptionSecretName(b *BackupConfig) string

GetBackupConfigEncryptionSecretName returns secret name

Types

type BackupConfig

type BackupConfig struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`

	Spec   BackupConfigSpec   `json:"spec,omitempty"`
	Status BackupConfigStatus `json:"status,omitempty"`
}

BackupConfig is the Schema for the backupconfigs API.

func GetBackupConfigForBackup added in v0.2.0

func GetBackupConfigForBackup(ctx context.Context, c client.Client, backup *cnpgv1.Backup) (*BackupConfig, error)

GetBackupConfigForBackup fetches the BackupConfig for a given Backup

func GetBackupConfigForCluster

func GetBackupConfigForCluster(ctx context.Context, c client.Client, cluster *cnpgv1.Cluster) (*BackupConfig, error)

GetBackupConfigForCluster returns BackupConfig object used for making backups If no BackupConfig reference specified in cluster plugin configuration - it will return (nil, nil) If BackupConfig reference specified, but couldn't fetch object - will return (nil, error)

func GetBackupConfigForClusterRecovery

func GetBackupConfigForClusterRecovery(ctx context.Context, c client.Client, cluster *cnpgv1.Cluster) (*BackupConfig, error)

GetBackupConfigForCluster returns BackupConfig object used for restoring from backups If no BackupConfig reference specified in cluster plugin configuration - it will return (nil, nil) If BackupConfig reference specified, but couldn't fetch object - will return (nil, error)

func (*BackupConfig) DeepCopy

func (in *BackupConfig) DeepCopy() *BackupConfig

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

func (*BackupConfig) DeepCopyInto

func (in *BackupConfig) DeepCopyInto(out *BackupConfig)

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

func (*BackupConfig) DeepCopyObject

func (in *BackupConfig) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

func (*BackupConfig) Default added in v0.2.0

func (b *BackupConfig) Default()

func (*BackupConfig) PrefetchSecretsData

func (b *BackupConfig) PrefetchSecretsData(ctx context.Context, c client.Client) (*BackupConfigWithSecrets, error)

type BackupConfigList

type BackupConfigList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata,omitempty"`
	Items           []BackupConfig `json:"items"`
}

BackupConfigList contains a list of BackupConfig.

func (*BackupConfigList) DeepCopy

func (in *BackupConfigList) DeepCopy() *BackupConfigList

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

func (*BackupConfigList) DeepCopyInto

func (in *BackupConfigList) DeepCopyInto(out *BackupConfigList)

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

func (*BackupConfigList) DeepCopyObject

func (in *BackupConfigList) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

type BackupConfigSpec

type BackupConfigSpec struct {
	// How many goroutines to use during backup && wal downloading. Default value is evaluated at runtime
	DownloadConcurrency *int `json:"downloadConcurrency,omitempty"`

	// Disk read rate limit during backup creation in bytes per second. Default value is evaluated at runtime
	UploadDiskRateLimit *int `json:"uploadDiskRateLimitBytesPerSecond,omitempty"`

	// Network upload rate limit during backup uploading in bytes per second. Default value is evaluated at runtime
	UploadNetworkRateLimit *int `json:"uploadNetworkRateLimitBytesPerSecond,omitempty"`

	// How many concurrency streams to use during backup uploading. Default value is evaluated at runtime
	UploadConcurrency *int `json:"uploadConcurrency,omitempty"`

	// How many concurrency streams are reading disk during backup uploading. Default value is evaluated at runtime
	UploadDiskConcurrency *int `json:"uploadDiskConcurrency,omitempty"`

	// How many times failed file will be retried during backup / wal download. Default: 15.
	DownloadFileRetries int `json:"downloadFileRetries,omitempty"`

	// Determines how many delta backups can be between full backups. Defaults to 0.
	DeltaMaxSteps int `json:"deltaMaxSteps,omitempty"`

	// Disable calling fsync after writing files when extracting tar files. Default: false.
	TarDisableFsync bool `json:"tarDisableFsync,omitempty"`

	// Threshold in bytes is size of one backup bundle. Default: 1073741823.
	TarSizeThreshold *int64 `json:"tarSizeThreshold,omitempty"`

	// Backups retention configuration
	Retention BackupRetentionConfig `json:"retention,omitempty"`

	// Backups storage configuration
	Storage StorageConfig `json:"storage"`

	// Resources for wal-g sidecar configurations
	//
	// IMPORTANT: resource changes will NOT trigger auto-update on clusters
	// Manual rollout with pods recreation needed instead
	Resources corev1.ResourceRequirements `json:"resources,omitempty"`

	// Backups encryption configuration
	Encryption BackupEncryptionConfig `json:"encryption,omitempty"`
}

BackupConfigSpec defines the desired state of BackupConfig.

func (*BackupConfigSpec) DeepCopy

func (in *BackupConfigSpec) DeepCopy() *BackupConfigSpec

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

func (*BackupConfigSpec) DeepCopyInto

func (in *BackupConfigSpec) DeepCopyInto(out *BackupConfigSpec)

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

type BackupConfigSpecWithSecrets

type BackupConfigSpecWithSecrets struct {
	BackupConfigSpec
	Storage    StorageConfigWithSecrets           `json:"storage"`
	Encryption *BackupEncryptionConfigWithSecrets `json:"encryption,omitempty"`
}

backupConfigSpec defines the BackupConfigSpec extended with secrets data

func (*BackupConfigSpecWithSecrets) DeepCopy

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

func (*BackupConfigSpecWithSecrets) DeepCopyInto

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

type BackupConfigStatus

type BackupConfigStatus struct {
}

BackupConfigStatus defines the observed state of BackupConfig.

func (*BackupConfigStatus) DeepCopy

func (in *BackupConfigStatus) DeepCopy() *BackupConfigStatus

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

func (*BackupConfigStatus) DeepCopyInto

func (in *BackupConfigStatus) DeepCopyInto(out *BackupConfigStatus)

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

type BackupConfigWithSecrets

type BackupConfigWithSecrets struct {
	BackupConfig
	Spec BackupConfigSpecWithSecrets `json:"spec,omitempty"`
}

BackupConfigWithSecrets defines the BackupConfig with embedded secrets data (ex. S3 credentials)

func GetBackupConfigWithSecretsForBackup added in v0.2.0

func GetBackupConfigWithSecretsForBackup(
	ctx context.Context,
	c client.Client,
	backup *cnpgv1.Backup,
) (*BackupConfigWithSecrets, error)

GetBackupConfigWithSecretsForBackup fetches the BackupConfig with secrets for a given Backup

func (*BackupConfigWithSecrets) DeepCopy

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

func (*BackupConfigWithSecrets) DeepCopyInto

func (in *BackupConfigWithSecrets) DeepCopyInto(out *BackupConfigWithSecrets)

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

type BackupEncryptionConfig added in v0.2.0

type BackupEncryptionConfig struct {
	// Method used for backup encryption.
	// Currently "libsodium" method supported only.
	// Use "none" or leave empty to disable encryption.
	Method string `json:"method,omitempty"`

	// Name of the existing secret with entryption keys.
	//
	// If empty / not provided - secret will be generated automatically
	// with name "<backupconfig-name>-encryption" and random key
	//
	// For "libsodium" method secret should contain single key "libsodiumKey"
	// containing hex-encoded 32-bytes length key i.e. created with `openssl rand -hex 32`
	ExistingEncryptionSecretName string `json:"encryptionSecret,omitempty"`
}

func (*BackupEncryptionConfig) DeepCopy added in v0.2.0

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

func (*BackupEncryptionConfig) DeepCopyInto added in v0.2.0

func (in *BackupEncryptionConfig) DeepCopyInto(out *BackupEncryptionConfig)

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

type BackupEncryptionConfigWithSecrets added in v0.2.0

type BackupEncryptionConfigWithSecrets struct {
	BackupEncryptionConfig
	EncryptionKeyData string
}

BackupEncryptionConfigWithSecrets defines encryption configuration with embedded secrets data

func (*BackupEncryptionConfigWithSecrets) DeepCopy added in v0.2.0

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

func (*BackupEncryptionConfigWithSecrets) DeepCopyInto added in v0.2.0

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

type BackupRetentionConfig added in v0.2.0

type BackupRetentionConfig struct {
	// Whether to disable S3 storage cleanup on BackupConfig deletion.
	// Useful when managing storage retention by S3 lifecycle policies.
	// When true, the operator will skip storage cleanup when BackupConfig is deleted.
	// +kubebuilder:default:=false
	// +optional
	IgnoreForBackupConfigDeletion bool `json:"ignoreForBackupConfigDeletion,omitempty"`

	// Whether to disable S3 storage cleanup on individual Backup resource deletion.
	// Useful when managing storage retention by S3 lifecycle policies.
	// When true, the operator will skip storage cleanup when individual Backup resources are deleted.
	// +kubebuilder:default:=false
	// +optional
	IgnoreForBackupDeletion bool `json:"ignoreForBackupDeletion,omitempty"`

	// Whether to ignore manually created backups in retention policy
	//
	// IMPORTANT: Automatically created backups should have OwnerReference with
	// ScheduledBackup or Cluster resource to be treated as auto backups!
	// (.spec.backupOwnerReference: "self" or "cluster" in ScheduledBackup resource)
	// +kubebuilder:default:=false
	// +optional
	IgnoreForManualBackups bool `json:"ignoreForManualBackups,omitempty"`

	// Minimal number of full backups to keep, this will keep backups
	// even if backup should be deleted due to DeleteBackupsAfter policy
	// Default is 5 backups
	// +kubebuilder:default:=5
	// +kubebuilder:validation:Minimum=0
	// +kubebuilder:validation:Maximum=99
	// +optional
	MinBackupsToKeep int `json:"minBackupsToKeep,omitempty"`

	// DeleteBackupsAfter is the retention policy to be used for backups
	// and WALs (i.e. '60d'). It is expressed in the form
	// of `XXu` where `XX` is a positive integer and `u` is in `[dwmh]` -
	// days, weeks, months, hours (i.e. '7d', '4w', '1m', '6h').
	// Different units should not be used at the same time
	// If not specified - backups will not be deleted automatically
	// +kubebuilder:validation:Pattern=^[1-9][0-9]*[dwmh]$
	// +optional
	DeleteBackupsAfter string `json:"deleteBackupsAfter,omitempty"`
}

func (*BackupRetentionConfig) DeepCopy added in v0.2.0

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

func (*BackupRetentionConfig) DeepCopyInto added in v0.2.0

func (in *BackupRetentionConfig) DeepCopyInto(out *BackupRetentionConfig)

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

type BackupType added in v0.2.0

type BackupType string

BackupType is string enumeration for backup types, can only be "full" or "incremental"

const BackupTypeFull BackupType = "full"
const BackupTypeIncremental BackupType = "incremental"

type CustomCAReference added in v0.2.2

type CustomCAReference struct {
	// Kind of the resource containing the CA certificate
	// Can be either "ConfigMap" or "Secret"
	// +kubebuilder:validation:Enum=ConfigMap;Secret
	Kind string `json:"kind"`

	// Name of the ConfigMap or Secret containing the CA certificate
	Name string `json:"name"`

	// Key in the ConfigMap or Secret containing the CA certificate
	Key string `json:"key"`
}

CustomCAReference defines a reference to a custom CA certificate stored in a ConfigMap or Secret

func (*CustomCAReference) DeepCopy added in v0.2.2

func (in *CustomCAReference) DeepCopy() *CustomCAReference

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

func (*CustomCAReference) DeepCopyInto added in v0.2.2

func (in *CustomCAReference) DeepCopyInto(out *CustomCAReference)

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

type S3StorageConfig

type S3StorageConfig struct {
	// e.g. s3://bucket/path/to/folder
	// Mutually exclusive with PrefixFrom
	Prefix string `json:"prefix,omitempty"`

	// Reference to get prefix value from Secret or ConfigMap
	// Mutually exclusive with Prefix
	// +optional
	PrefixFrom *ValueFromSource `json:"prefixFrom,omitempty"`

	// S3 Region
	// Mutually exclusive with RegionFrom
	Region string `json:"region,omitempty"`

	// Reference to get region value from Secret or ConfigMap
	// Mutually exclusive with Region
	// +optional
	RegionFrom *ValueFromSource `json:"regionFrom,omitempty"`

	// S3 endpoint url
	// Mutually exclusive with EndpointURLFrom
	EndpointURL string `json:"endpointUrl,omitempty"`

	// Reference to get endpoint URL value from Secret or ConfigMap
	// Mutually exclusive with EndpointURL
	// +optional
	EndpointURLFrom *ValueFromSource `json:"endpointUrlFrom,omitempty"`

	// To enable path-style addressing (i.e., http://s3.amazonaws.com/BUCKET/KEY)
	// when connecting to an S3-compatible service that lack of support for
	// sub-domain style bucket URLs (i.e., http://BUCKET.s3.amazonaws.com/KEY)
	ForcePathStyle bool `json:"forcePathStyle,omitempty"`

	// S3 storage class used for backup files.
	// Default is "STANDARD". Other supported values include
	// "STANDARD_IA" for Infrequent Access and
	// "REDUCED_REDUNDANCY" for Reduced Redundancy.
	StorageClass string `json:"storageClass,omitempty"`

	// Custom CA certificate reference for S3 endpoint
	// Can be specified in either ConfigMap or Secret
	CustomCA *CustomCAReference `json:"customCA,omitempty"`

	AccessKeyIDRef     *corev1.SecretKeySelector `json:"accessKeyId,omitempty"`
	AccessKeySecretRef *corev1.SecretKeySelector `json:"accessKeySecret,omitempty"`
}

S3StorageConfig defines S3-specific configuration for object storage

func (*S3StorageConfig) DeepCopy

func (in *S3StorageConfig) DeepCopy() *S3StorageConfig

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

func (*S3StorageConfig) DeepCopyInto

func (in *S3StorageConfig) DeepCopyInto(out *S3StorageConfig)

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

type S3StorageConfigWithSecrets

type S3StorageConfigWithSecrets struct {
	S3StorageConfig
	AccessKeyID     string
	AccessKeySecret string
	CACertData      string // Custom CA certificate data for S3 endpoint
	// Resolved values from references
	ResolvedPrefix      string // Resolved value from Prefix or PrefixFrom
	ResolvedRegion      string // Resolved value from Region or RegionFrom
	ResolvedEndpointURL string // Resolved value from EndpointURL or EndpointURLFrom
}

s3StorageConfigWithSecrets defines S3-specific configuration with embedded secrets data (AccessKeyID && AccessKeySecret)

func (*S3StorageConfigWithSecrets) DeepCopy

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

func (*S3StorageConfigWithSecrets) DeepCopyInto

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

type StorageConfig

type StorageConfig struct {
	StorageType StorageType      `json:"type"`         // Type of storage to use, currently supported "s3" only
	S3          *S3StorageConfig `json:"s3,omitempty"` // S3-specific parameters
}

StorageConfig defines object storage configuration for BackupConfig

func (*StorageConfig) DeepCopy

func (in *StorageConfig) DeepCopy() *StorageConfig

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

func (*StorageConfig) DeepCopyInto

func (in *StorageConfig) DeepCopyInto(out *StorageConfig)

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

type StorageConfigWithSecrets

type StorageConfigWithSecrets struct {
	StorageConfig
	S3 *S3StorageConfigWithSecrets `json:"s3,omitempty"` // S3-specific parameters
}

storageConfigWithSecrets defines object storage configuration extended with secrets data

func (*StorageConfigWithSecrets) DeepCopy

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

func (*StorageConfigWithSecrets) DeepCopyInto

func (in *StorageConfigWithSecrets) DeepCopyInto(out *StorageConfigWithSecrets)

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

type StorageType

type StorageType string

type ValueFromSource added in v0.2.2

type ValueFromSource struct {
	// Reference to a key in a Secret
	// +optional
	SecretKeyRef *corev1.SecretKeySelector `json:"secretKeyRef,omitempty"`

	// Reference to a key in a ConfigMap
	// +optional
	ConfigMapKeyRef *corev1.ConfigMapKeySelector `json:"configMapKeyRef,omitempty"`
}

ValueFromSource defines a reference to a value stored in a Secret or ConfigMap

func (*ValueFromSource) DeepCopy added in v0.2.2

func (in *ValueFromSource) DeepCopy() *ValueFromSource

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

func (*ValueFromSource) DeepCopyInto added in v0.2.2

func (in *ValueFromSource) DeepCopyInto(out *ValueFromSource)

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