SGBackup

Creating a backup

The backup CR represent a backup of the cluster. Backups are created automatically by the CronJob generated using the settings in backup configuration or manually by creating a backup CR.


Kind: SGBackup

listKind: SGBackupList

plural: sgbackups

singular: sgbackup


Spec

Property Required Updatable Type Default Description
sgCluster string
The name of the SGCluster from which this backup is/will be taken.
managedLifecycle booolean false
Indicate if this backup is permanent and should not be removed by the automated retention policy.

Example:

apiVersion: stackgres.io/v1
kind: SGBackup
metadata:
  name: backup
spec:
  sgCluster: stackgres
  managedLifecycle: true
status:
  internalName: base_00000002000000000000000E
  sgBackupConfig:
    compression: lz4
    storage:
      s3Compatible:
        awsCredentials:
          secretKeySelectors:
            accessKeyId:
              key: accesskey
              name: minio
            secretAccessKey:
              key: secretkey
              name: minio
        endpoint: http://minio:9000
        enablePathStyleAddressing: true
        bucket: stackgres
        region: k8s
      type: s3Compatible
  process:
    status: Completed
    jobPod: backup-backup-q79zq
    managedLifecycle: true
    timing:
      start: "2020-01-22T10:17:24.983902Z"
      stored: "2020-01-22T10:17:27.183Z"
      end: "2020-01-22T10:17:27.165204Z"
  backupInformation:
    hostname: stackgres-1
    systemIdentifier: "6784708504968245298"
    postgresVersion: "110006"
    pgData: /var/lib/postgresql/data
    size:
      compressed: 6691164
      uncompressed: 24037844
    lsn:
      start: "234881064"
      end: "234881272"
    startWalFile: 00000002000000000000000E

Status

Property Type Description
internalName string
The name of the backup.
process object
backupInformation object
sgBackupConfig object
The name of the backup configuration used to perform this backup.

Backup Process

Property Type Description
status string
Status of the backup.
jobPod string
Name of the pod assigned to the backup. StackGres utilizes internally a locking mechanism based on the pod name of the job that creates the backup.
failure string
If the status is failed this field will contain a message indicating the failure reason.
managedLifecycle boolean
Status (may be transient) until converging to spec.managedLifecycle.
timing object

Backup Timing

Property Type Description
start string
Start time of backup.
end string
End time of backup.
stored string
Time at which the backup is safely stored in the object storage.

Backup Information

Property Type Description
hostname (deprecated) string
Hostname of the instance where the backup is taken from.
sourcePod string
Pod where the backup is taken from.
systemIdentifier string
Postgres system identifier of the cluster this backup is taken from.
postgresVersion string
Postgres version of the server where the backup is taken from.
pgData string
Data directory where the backup is taken from.
size object
lsn object
startWalFile string
WAL segment file name when the backup was started.
controlData object
An object containing data from the output of pg_controldata on the backup.

Backup Size

Property Type Description
compressed integer
Size (in bytes) of the compressed backup.
uncompressed integer
Size (in bytes) of the uncompressed backup.

Backup LSN

Property Type Description
start string
LSN of when the backup started.
end string
LSN of when the backup finished.

Backup Configuration

Property Required Updatable Type Default Description
compression string lz4
Select the backup compression algorithm. Possible options are: lz4, lzma, brotli. The default method is lz4. LZ4 is the fastest method, but compression ratio is the worst. LZMA is way slower, but it compresses backups about 6 times better than LZ4. Brotli is a good trade-off between speed and compression ratio, being about 3 times better than LZ4.
storage object
Backup storage configuration.

Storage Configuration

Property Required Updatable Type Default Description
type string

Specifies the type of object storage used for storing the base backups and WAL segments. Possible values:

  • s3: Amazon Web Services S3 (Simple Storage Service).
  • s3Compatible: non-AWS services that implement a compatibility API with AWS S3.
  • gcs: Google Cloud Storage.
  • azureBlob: Microsoft Azure Blob Storage.
s3 if type = s3 object
Amazon Web Services S3 configuration.
s3Compatible if type = s3Compatible object
AWS S3-Compatible API configuration
gcs if type = gcs object
Google Cloud Storage configuration.
azureBlob if type = azureblob object
Azure Blob Storage configuration.

S3

S3 - Amazon Web Services S3 configuration

Property Required Updatable Type Default Description
bucket string
AWS S3 bucket name.
path string
Optional path within the S3 bucket. Note that StackGres generates in any case a folder per StackGres cluster, using the SGCluster.metadata.name.
awsCredentials object
Credentials to access AWS S3 for writing and reading.
region string
AWS S3 region. The Region may be detected using s3:GetBucketLocation, but to avoid giving permissions to this API call or forbid it from the applicable IAM policy, this property must be explicitely specified.
storageClass string
Amazon S3 Storage Class used for the backup object storage. By default, the STANDARD storage class is used. Other supported values include STANDARD_IA for Infrequent Access and REDUCED_REDUNDANCY.

S3 - Amazon Web Services S3 Compatible configuration

Property Required Updatable Type Default Description
bucket string
Bucket name.
path string
Optional path within the S3 bucket. Note that StackGres generates in any case a folder per StackGres cluster, using the SGCluster.metadata.name.
awsCredentials object
Credentials to access AWS S3 for writing and reading.
region string
AWS S3 region. The Region may be detected using s3:GetBucketLocation, but to avoid giving permissions to this API call or forbid it from the applicable IAM policy, this property must be explicitely specified.
storageClass string
Amazon S3 Storage Class used for the backup object storage. By default, the STANDARD storage class is used. Other supported values include STANDARD_IA for Infrequent Access and REDUCED_REDUNDANCY.
endpoint string
Overrides the default url to connect to an S3-compatible service. For example: http://s3-like-service:9000.
enablePathStyleAddressing boolean
Enable path-style addressing (i.e. http://s3.amazonaws.com/BUCKET/KEY) when connecting to an S3-compatible service that lacks support for sub-domain style bucket URLs (i.e. http://BUCKET.s3.amazonaws.com/KEY). Defaults to false.

Amazon Web Services Credentials

Property Required Updatable Type Default Description
secretKeySelectors object
A Kubernetes SecretKeySelector to reference the Secrets that contain the information about the awsCredentials.

Amazon Web Services Secret Key Selector

Property Required Updatable Type Default Description
accessKeyId object
SecretKeySelector containing the AWS Access Key ID secret.
secretAccessKey object
SecretKeySelector containing the AWS Secret Access Key secret.

GSC - Google Cloud Storage configuration

Property Required Updatable Type Default Description
bucket string
GCS bucket name.
path string
Optional path within the GCS bucket. Note that StackGres generates in any case a folder per StackGres cluster, using the SGCluster.metadata.name.
gcpCredentials object
Credentials to access GCS for writing and reading.

GCP Credentials

Property Required Updatable Type Default Description
secretKeySelectors object
A Kubernetes SecretKeySelector to reference the Secrets that contain the information about the Service Account to access GCS.

GCP Secret Key Selector

Property Required Updatable Type Default Description
serviceAccountJSON object
A service account key from GCP. In JSON format, as downloaded from the GCP Console.

AZURE - Azure Blob Storage configuration

Property Required Updatable Type Default Description
bucket string
Azure Blob Storage bucket name.
path string
Optional path within the Azure Blobk bucket. Note that StackGres generates in any case a folder per StackGres cluster, using the SGCluster.metadata.name.
azureCredentials object
Credentials to access Azure Blob Storage for writing and reading.

Azure Credentials

Property Required Updatable Type Default Description
secretKeySelectors object
Kubernetes SecretKeySelectors to reference the Secrets that contain the information about the azureCredentials.

Azure Secret Key Selector

Property Required Updatable Type Default Description
storageAccount object
SecretKeySelector containing the name of the storage account.
accessKey object
SecretKeySelector containing the primary or secondary access key for the storage account.