forked from pulp/pulp-operator
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Document backup and restore procedures
closes pulp#765
- Loading branch information
1 parent
14b5a7d
commit 08ebb9a
Showing
13 changed files
with
158 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Added steps to configure and run backup/restore procedure. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
# Configuring and Running | ||
|
||
|
||
All the configurations needed to run the backup or restore procedures are made through `PulpBackup` or `PulpRestore` CRs. | ||
|
||
To get the list of fields available in each CR, check [`PulpBackupSpec`](/pulp_operator/backup/#pulpbackupspec) and [`PulpRestoreSpec`](/pulp_operator/restore/#pulprestorespec). | ||
|
||
## Backup | ||
|
||
To configure the backup controller, create a manifest file with the definition of [PulpBackup CR](/pulp_operator/backup/#pulpbackupspec). | ||
For example: | ||
``` | ||
--- | ||
apiVersion: repo-manager.pulpproject.org/v1alpha1 | ||
kind: PulpBackup | ||
metadata: | ||
name: pulpbackup-sample | ||
spec: | ||
deployment_name: pulp | ||
deployment_type: pulp | ||
backup_storage_class: standard | ||
admin_password_secret: example-pulp-admin-password | ||
postgres_configuration_secret: pulp-postgres-configuration | ||
``` | ||
|
||
In the above sample we defined: | ||
|
||
* the name of `Pulp` instance (`deployment_name`), which can be gathered with: | ||
``` | ||
$ kubectl get pulp | ||
NAME AGE | ||
pulp 3m30s | ||
``` | ||
|
||
* the type of deployment (`deployment_type`), in this case `pulp` (but could also be `galaxy` depending on the installation). | ||
* the name of `StorageClass` used to provision the `PVC` to store the backup data (`backup_storage_class`). | ||
* the name of the `Secret` with Pulp admin password (`admin_password_secret`), which can be get by: | ||
``` | ||
$ kubectl get pulp pulp -ojsonpath='{.spec.admin_password_secret}{"\n"}' | ||
pulp-admin-password | ||
``` | ||
|
||
* the name of the `Secret` with PostgreSQL credentials and connection information (`postgres_configuration_secret`). | ||
|
||
After finishing to configure the file, apply the configuration and the Operator will start the backup: | ||
``` | ||
kubectl apply -f <backup_cr_file>.yaml | ||
``` | ||
|
||
|
||
## Restore | ||
|
||
|
||
To configure the restore controller, create a manifest file with the definition of [PulpRestore CR](/pulp_operator/restore/#pulprestorespec). | ||
For example: | ||
``` | ||
--- | ||
apiVersion: repo-manager.pulpproject.org/v1alpha1 | ||
kind: PulpRestore | ||
metadata: | ||
name: pulprestore-sample | ||
spec: | ||
backup_name: pulpbackup-sample | ||
deployment_name: pulp | ||
``` | ||
|
||
In the above sample we defined: | ||
|
||
* the name of `PulpBackup` instance (`backup_name`) | ||
* the name of `Pulp` instance (`deployment_name`). This should be the same defined in the `PulpBackup` CR. | ||
|
||
After finishing to configure the file, apply the configuration and the Operator will start the restore: | ||
``` | ||
kubectl apply -f <restore_cr_file>.yaml | ||
``` | ||
|
||
By default, the restore procedure will reprovision the environment with a single replica of each component. This is to make it easier to review the restore status and the environment health. | ||
It is also possible to restore with the same number of replicas running when the backup was made. To do so, just set the `keep_replicas` field to true, for example: | ||
``` | ||
--- | ||
apiVersion: repo-manager.pulpproject.org/v1alpha1 | ||
kind: PulpRestore | ||
metadata: | ||
name: pulprestore-sample | ||
spec: | ||
backup_name: pulpbackup-sample | ||
deployment_name: pulp | ||
keep_replicas: true | ||
``` | ||
|
||
|
||
After finishing to restore the environment, the operator will create a `ConfigMap` called *`restore-lock`*. It is used to prevent a new controller reconciliation loop to run and override any data changed/created with the "old" data from backup. | ||
To allow the restore controller to run again, delete the *restore-lock* `ConfigMap`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# Overview of backup and restore operations | ||
|
||
|
||
In addition to provisioning Pulp components, the Operator can also be used to backup and restore them. | ||
|
||
!!! note | ||
Before starting a backup, make sure that the namespace has enough storage quota available. | ||
|
||
## Backup | ||
The backup procedure creates a *manager* `Pod` which will be used to execute all the backup tasks: | ||
|
||
* run a `pg_dump` (database dump) on Pulp's database | ||
* do a copy of the Pulp CR instance defined in `deployment_name` | ||
* do a copy of the `Secrets` | ||
* do a copy of `/var/lib/pulp` directory | ||
* delete the *manager* `Pod` to not consume resources | ||
|
||
These data will be stored in a new PVC defined in PulpBackup CR (`backup_pvc` or `backup_storage_class`). | ||
|
||
|
||
!!! note | ||
The current version of the Operator does **not** execute backups of **external** PostgreSQL instances yet. | ||
|
||
|
||
!!! notes | ||
Considering that files stored in Object Storage (like `AWS S3` and/or `Azure Blob`) are not kept in `/var/lib/pulp` directory, they will **not** be copied. If you still need to do a backup of the artifacts stored in Object Storage, please, contact your cloud provider to check the procedure to do so. | ||
|
||
|
||
## Restore | ||
The restore procedure also creates a *manager* `Pod` to execute all the tasks: | ||
|
||
* restore the `Secrets` | ||
* restore Pulp CR instance | ||
* restore Pulp database | ||
* restore `/var/lib/pulp` directory | ||
* delete the *manager* `Pod` to not consume resources | ||
|
||
All data restored comes from the PVC defined in PulpRestore CR (`backup_pvc`). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters