PostgresRestore Synopsis

apiVersion: sql.tanzu.vmware.com/v1
kind: PostgresRestore
metadata:
  name: restore-sample
spec:
  sourceBackup:
    name: backup-sample
  targetInstance:
    name: postgres-sample
#    spec:
#      highAvailability:
#        enabled: true
#   pitr:
#     type: <latest|time|lsn|transaction>
#     target: <lsn-value|transaction-id-value>
#     timestamp: <timestamp-value>
#     bestEffort: <true|false>
#     sourceBackupLocation:
#       name: <backup-location-name>
#       stanzaName: <sample-stanza-name>
#       set: <backup-restore-label>

The list below explains the properties that can be set for the PostgresRestore resource.

Metadata

name

Type: String
Required
Default: n/a
The name of the PostgresRestore. Must be unique within a namespace.
Example:
restore-sample

Spec

The spec describes the desired state for the Postgres backup object.

sourceBackup

Type: Object
Optional
Default: n/a

  • name
    Type: String
    Required
    Default: n/a
    The name of the PostgresBackup that represents the backup artifact to restore.
    Must be in the same namespace as the PostgresRestore.
    Example
    backup-sample

targetInstance

Type: Object
Required
Default: n/a

  • name
    Type: String
    Required
    Default: n/a
    The name of the target instance where the sourceBackup should be restored.
    In case of in-place restore, this should be the source instance where the sourceBackup was taken
    Example
    my-target-instance

  • spec
    Type: Object
    Optional
    Default: n/a
    The desired state of the target Postgres resource that will be created for restore.
    Example

    postgresVersion:
      name: postgres-15
    highAvailability:
      enabled: false
    

pointInTime

Type: string
Optional
Default: n/a
This field has been deprecated in favor of spec.pitr.type with the value set to time.

pitr

Type: Object
Optional
Default: n/a

  • type
    Type: String
    Required
    Default: n/a
    The type of recovery you want to perform. The possible values are latest, timestamp, lsn and transaction.
    Example
    latest

  • target
    Type: String
    Optional
    Default: n/a
    This field is only supported when the value of spec.pitr.type is set to lsn or transaction. It specifies the target lsn or transaction id for the restore.
    Example
    0/4000060 or 791

  • timestamp
    Type: String
    Optional
    Default: n/a
    This field is only supported when the value of spec.pitr.type is set to time. It specifies the desired time to use as a restore target.
    Example
    2022-05-26T18:30:00-04:00

  • bestEffort
    Type: Boolean
    Optional
    Default: false
    This field is only supported when the value of spec.pitr.type is set to time. When set to true, it specifies that Postgres should restore to the latest write-ahead-log (WAL) record if an invalid recovery time is provided.
    Example
    false

  • sourceBackupLocation
    Type: Object
    Required
    Default: n/a
    Specifies the backup location that contains the backups to clone from. Example

    sourceBackupLocation:
      name: my-backup-location
      stanzaName: prod-instance-012345abcd
      set: 
    
    • name
      Type: String
      Required
      Default: n/a
      Specifies the name of a backup location.

    • stanzaName
      Type: String
      Required
      Default: n/a
      Specifies the name of a stanza within the location.

    • set
      Type: String
      Optional
      Default: n/a
      Is an optional field that specifies a Pgbackrest backup to use for restore.
      When used, set should be the backup that was a taken before the desired restore point.
      Example
      20230622-114327F

Status

The status fields show the observed status of the PostgresRestore object and the values are updated by the controller that handles Backup/Restore in the instance.

phase

Type: string
This field shows the current state of a PostgresRestore CR. It can be either empty or have any of the following values:

  • Running
  • RecreatingNodes
  • RecreatingPrimary
  • RecreatingSecondary
  • WaitForPrimary
  • Finalizing
  • Succeeded
  • Failed. All these phases are related to some internal processing that the operator does to achieve a restore. The terminal phasees are Failed or Succeeded.

timeStarted

Type: time
This field denotes the time when the restore started

timeCompleted

Type: time
This field indicates the time when the restore got completed. This field is populated once the PostgresRestore CR reaches Failed or Succeeded state.

Message

Type: time
This field shows some error/useful messages for why a restore is stuck or pending.
Example:
Instance postgres-sample does not specify spec.backupLocation.name

conditions

Type: Object
This field shows the state of the PostgresRestore resource.
Example:

conditions:
- lastTransitionTime: "2023-06-28T15:34:18Z"
  message: Postgres was unable to reach '2023-06-28 16:32:43+00'. Restoring to the
    last completed transaction at '2023-06-28 15:31:44.855676+00'.
  reason: ResetRecoveryConfigSuccessful
  status: "True"
  type: BestEffortRecoveryApplied
check-circle-line exclamation-circle-line close-line
Scroll to top icon