Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add documentation for cleaning up backup resources #402

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions backup/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ You can also refer [the official instructions](https://github.com/ansible/awx-op
- [Instruction](#instruction)
- [Prepare for Backup](#prepare-for-backup)
- [Back up AWX manually](#back-up-awx-manually)
- [Clean up Backup objects](#clean-up-backup-objects)
- [awx-operator-controller-manager is unresponsive](#awx-operator-controller-manager-is-unresponsive)
- [Appendix: Back up AWX using Ansible](#appendix-back-up-awx-using-ansible)

## Instruction
Expand Down Expand Up @@ -93,6 +95,55 @@ total 736
-rw-r--r--. 1 26 26 833184 Jun 6 06:51 tower.db
```

### Clean up Backup Objects
!!Ensure your backup data has been transferred from the backup directory before running the commands!!

After completing and transferring the backup, it is recommended to clean up the backup resource created by AWX Operator. Keeping many of these resources around may result in the `awx-operator-controller-manager` becoming unresponsive, and thus creating new backups impossible.

Browse the existing backup objects:
```sh
kubectl get awxbackup -n awx
```

Delete the resources:
!!Ensure your backup data has been transferred from the backup directory before running the commands!!
```sh
kubectl -n awx delete awxbackup <name> # delete a single resource
kubectl -n awx delete awxbackup --all # delete all resources
```

#### awx-operator-controller-manager is unresponsive

!!Ensure your backup data has been transferred from the backup directory before running the commands!!

If you are unable to delete the resources (e.g. the delete command hangs), the following commands will help clean up the resources.

First, scale down the unresponsive AWX Operator controller manager:

```sh
kubectl -n awx scale deployment/awx-operator-controller-manager --replicas=0
```

!!Ensure your backup data has been transferred from the backup directory before running the command!!

Second, patch remove each backup resource's finalizer, ensuring the resource can get deleted.

```sh
kubectl get awxbackup -n awx -o json | jq '.items[] | .metadata.name' | xargs -I{} kubectl patch awxbackup {} -n awx --type=json -p='[{"op": "remove", "path": "/metadata/finalizers"}]'
```

Browse the existing backup objects again, to see that the resources are no longer present:

```sh
kubectl get awxbackup -n awx
```

Finally, scale up the manager:

```sh
kubectl -n awx scale deployment/awx-operator-controller-manager --replicas=1
```

## Appendix: Back up AWX using Ansible

An example simple playbook for Ansible is also provided in this repository. This can be used with `ansible-playbook`, `ansible-runner`, and AWX. It can be also used with the scheduling feature on AWX too.
Expand Down