Skip to content

RunRestore

A RunRestore object can be created to manually trigger a namespace restore via kubectl. Each RunRestore corresponds to a single restore task.

Please note that a restore launched from the Afi portal doesn't create the corresponding RunRestore object, instead, a RunRestore object is created only via kubectl and should have a unique name.

An example RunRestore YAML is shown below:

apiVersion: k8sbackup.afi.ai/v1alpha1
kind: RunRestore
metadata:
  namespace: postgresql-restored
  generateName: postgresql-
spec:
  policy:
    selectors: []
  archiveRef: 01GM47ZVFB4KKNXPP6Z0C6AA21
  pit: 1
  waitStableState: true
  • namespace field in metadata section points to a restore destination namespace. Please note that this namespace should be created before a restore, it isn't created automatically.
  • generateName field is used to generate a unique name for a new RunRestore object.
  • policy.selectors field in spec section is used to recover specific objects from namespace backup that match the selectors (selectors field usage is similar to its usage in BackupPolicy settings), for example, to recover objects of a specific kind or with a specific label.
  • archiveRef field is a backup archive identifier (you can get it by listing Archive objects inside a restore source namespace).
  • pit field (point-in-time abbreviation) is a snapshot number inside the backup archive. It may be omitted to request a restore from the most up-to-date snapshot.
  • waitStableState field defines if the recovery task should wait until the restored application reaches a stable state (in particular, all StatefulSets at a desired number of replicas, all Pods ready, etc.).

You can run a restore by creating a RunRestore object as follows:

 kubectl create -f afi-runrestore.yaml

You can list restores launched to a specific namespace as follows:

kubectl get runrestore -n postgresql