CouchbaseBackupRestore Resource

In order to restore data to a cluster from a Persistent Volume Claim you will need to create a CouchbaseBackupRestore object.

A CouchbaseBackupRestore object will spawn a restore job that restores the latest backup file or a specific backup file from a existing Persistent Volume Claim.

The following YAML shows all possible fields that may be configured for a CouchbaseBackupRestore. This configuration is not valid and is only for illustrative purposes.

All available CouchbaseBackupRestore configuration parameters
apiVersion: couchbase.com/v2
kind: CouchbaseBackupRestore
metadata:
  name: my-restore
  labels:
    cluster: my-cluster
spec:
  backup: my-backup
  repo: cb-example-2020-02-12T19_00_03
  start:
    int: 1
    str: oldest
  end:
    int: 1
    str: latest
  backOffLimit: 2
  logRetention: 24h

Top-Level Definitions

The following are the top-level parameters that can be defined:

apiVersion: couchbase.com/v2
kind: CouchbaseBackupRestore
metadata:
  name: my-restore
  labels:
    cluster: my-cluster

apiVersion

The apiVersion defines which version of the resource this configuration refers to.

Field rules: This field is required and must be set to couchbase.com/v2

kind

The kind defines the type of resource this configuration refers to.

Field rules: This field is required and must be set to CouchbaseBackupRestore

metadata.name

The metadata name defines the name of the resource. The name must be unique for the kind defined.

Field rules: This field is required and must be unique as described above.

metadata.labels

The metadata labels allow the resource to be tagged so that it is only selected by specific CouchbaseCluster resources. Further details about resource selection can be found on the Couchbase Resources and RBAC page.

Field rules: This field is optional and must be a map of string key/value pairs.

spec

The following are parameters that may be set on the CouchbaseBackup:

spec:
  backup: my-backup
  repo: cb-example-2020-02-12T19_00_03
  start:
    int: 1
    str: oldest
  end:
    int: 1
    str: latest
  backOffLimit: 2
  logRetention: 24h

spec.backup

This field defines where we will be restoring from. When the operator sees a CouchbaseBackup object, it creates a corresponding Persistent Volume Claim of the same name. As long as this Persistent Volume Claim of the same value as spec.backup exists, a restore should be performed. If spec.repo is empty, the corresponding CouchbaseBackup will need to exist in order to populate that field, see below for further details.

Field rules: This field is required and must be the name of an existing Persistent Volume Claim.

spec.repo

This field defines the repo name where the backup we which to restore is located. If this field is empty the Operator will attempt to look for the existing CouchbaseBackup object defined by the value in spec.backup, and retrieve the value from status.repo of that CouchbaseBackup object. If the Operator cannot find that CouchbaseBackup object or status.repo does not exist, the CouchbaseBackupRestore will be rejected.

Field rules: This field is optional only when the CouchbaseBackup object defined by the field spec.backup exists and has performed at least one backup since its creation.

spec.start

This field defines the sole backup to restore or the first backup to take in a range of backups to restore. spec.start requires exactly one argument of either int or str. spec.start.int accepts an integer defining the index of the first backup with 1 being the oldest backup. spec.start.str accepts the keywords "oldest", "latest" or the specific filename of the backup.

These arguments are passed straight through to cbbackupmgr. See cbbackupmgr restore for further details.

Field rules: This field is required and a valid value in either int or str is required, but not both.

spec.end

This field defines the last backup to take in a range of backups. spec.end requires exactly one argument of either int or str. spec.end.int accepts an integer defining the index of the first backup with 1 being the oldest backup. spec.end.str accepts the keywords "oldest", "latest" or the specific filename of the backup.

If this field is not specified then we only restore the one backup that is represented in spec.start. Alternatively if it is specified and it is the same value as spec.start the expected behaviour of taking a "range" of a singular backup is performed.

These arguments are passed straight through to cbbackupmgr. See cbbackupmgr restore for further details.

Field rules: This field is optional and a valid value in either int or str is required, but not both.

spec.backOffLimit

This field defines the amount of times the restore job will try to perform a restore. Once it has reached the backOffLimit the job will no longer run and a new CouchbaseBackupRestore object will have to be created.

Field rules: This field is optional and must be any non-negative integer.

spec.logRetention

This field defines the time period in which to retain backup logs. Older logs outside this time frame are deleted. On each run of a restore job logging takes place which is stored on the Persistent Volume of the same name as the CouchbaseBackup object defined by spec.backup.

Field rules: This field is optional and defaults to 168h (7 days). If specified it must contain a decimal number and a unit suffix such as s, m or h. The decimal number cannot be negative.