barman

package
v1.23.0 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package barman contains the utilities to interact with barman-cloud.

This package is able to download the backup catalog, given an object store, and to find the required backup to recreate a cluster, given a certain point in time. It can also delete backups according to barman object store configuration and retention policies, and find the latest successful backup. This is useful to recovery from the last consistent state. We detect the possible commands to be executed, fulfilling the barman capabilities, and define an interface for building commands.

A backup catalog is represented by the Catalog structure, and can be created using the NewCatalog function or by downloading it from an object store via GetBackupList. A backup catalog is just a sorted list of BackupInfo objects.

We also have features to gather all the environment variables required for the barman-cloud utilities to work correctly.

The functions which call the barman-cloud utilities (such as GetBackupList) require the environment variables to be passed, and the calling code is supposed gather them (i.e. via the EnvSetCloudCredentials) before calling them. A Kubernetes client is required to get the environment variables, as we need to download the content from the required secrets, but is not required to call barman-cloud.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppendCloudProviderOptionsFromBackup

func AppendCloudProviderOptionsFromBackup(
	options []string,
	backup *v1.Backup,
) ([]string, error)

AppendCloudProviderOptionsFromBackup takes an options array and adds the cloud provider specified in the Backup object

func AppendCloudProviderOptionsFromConfiguration

func AppendCloudProviderOptionsFromConfiguration(
	options []string,
	barmanConfiguration *v1.BarmanObjectStoreConfiguration,
) ([]string, error)

AppendCloudProviderOptionsFromConfiguration takes an options array and adds the cloud provider specified in the Barman configuration object

func CloudWalRestoreOptions added in v1.19.4

func CloudWalRestoreOptions(
	configuration *v1.BarmanObjectStoreConfiguration,
	clusterName string,
) ([]string, error)

CloudWalRestoreOptions returns the options needed to execute the barman command successfully

func DeleteBackupsByPolicy

func DeleteBackupsByPolicy(
	ctx context.Context,
	backupConfig *v1.BackupConfiguration,
	serverName string,
	env []string,
) error

DeleteBackupsByPolicy executes a command that deletes backups, given the Barman object store configuration, the retention policies, the server name and the environment variables

func DeleteBackupsNotInCatalog

func DeleteBackupsNotInCatalog(
	ctx context.Context,
	cli client.Client,
	cluster *v1.Cluster,
	catalog *catalog.Catalog,
) error

DeleteBackupsNotInCatalog deletes all Backup objects pointing to the given cluster that are not present in the backup anymore

func GetBackupByName added in v1.18.3

func GetBackupByName(
	ctx context.Context,
	backupName string,
	serverName string,
	barmanConfiguration *v1.BarmanObjectStoreConfiguration,
	env []string,
) (*catalog.BarmanBackup, error)

GetBackupByName returns the backup data found for a given backup

func GetBackupList

func GetBackupList(
	ctx context.Context,
	barmanConfiguration *v1.BarmanObjectStoreConfiguration,
	serverName string,
	env []string,
) (*catalog.Catalog, error)

GetBackupList returns the catalog reading it from the object store

func GetLatestBackup added in v1.18.3

func GetLatestBackup(
	ctx context.Context,
	serverName string,
	barmanConfiguration *v1.BarmanObjectStoreConfiguration,
	env []string,
) (*catalog.BarmanBackup, error)

GetLatestBackup returns the latest executed backup

func UnmarshalBarmanCloudRestoreExitCode added in v1.21.5

func UnmarshalBarmanCloudRestoreExitCode(exitCode int) error

UnmarshalBarmanCloudRestoreExitCode returns the correct error for a certain barman-cloud-restore exit code

Types

type CloudRestoreError added in v1.21.5

type CloudRestoreError struct {
	// The exit code returned by Barman
	ExitCode int

	// This is true when Barman can return significant error codes
	HasRestoreErrorCodes bool
}

CloudRestoreError is raised when barman-cloud-restore fails

func (*CloudRestoreError) Error added in v1.21.5

func (err *CloudRestoreError) Error() string

Error implements the error interface

func (*CloudRestoreError) IsRetriable added in v1.21.5

func (err *CloudRestoreError) IsRetriable() bool

IsRetriable returns true whether the error is temporary, and it could be a good idea to retry the restore later

Directories

Path Synopsis
Package archiver manages the WAL archiving process
Package archiver manages the WAL archiving process
Package capabilities stores the definition of the type for Barman capabilities
Package capabilities stores the definition of the type for Barman capabilities
Package credentials is used to build environment for barman cloud commands
Package credentials is used to build environment for barman cloud commands
Package restorer manages the WAL restore process
Package restorer manages the WAL restore process
Package spool implements a WAL pooler keeping track of which WALs we have archived
Package spool implements a WAL pooler keeping track of which WALs we have archived

Jump to

Keyboard shortcuts

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