From 54efda1a25bf69e6313603819e9c99ea957a09ab Mon Sep 17 00:00:00 2001 From: "Christian M. Adams" Date: Tue, 23 Mar 2021 17:15:15 -0400 Subject: [PATCH] Use default cluster storage class if none is provided --- roles/backup/README.md | 3 +++ roles/backup/templates/backup_pvc.yml.j2 | 2 ++ 2 files changed, 5 insertions(+) diff --git a/roles/backup/README.md b/roles/backup/README.md index e3f35116..f5fe33a4 100644 --- a/roles/backup/README.md +++ b/roles/backup/README.md @@ -36,6 +36,7 @@ Finally, use `kubectl` to create the awx instance in your cluster: #> kubectl apply -f backup-awx.yml ``` +The resulting pvc will contain a backup tar that can be used to restore to a new deployment. Future backups will also be stored in separate tars on the same pvc. Role Variables @@ -47,6 +48,8 @@ A custom, pre-created pvc can be used by setting the following variables. tower_backup_pvc: 'awx-backup-volume-claim' ``` +> If no pvc or storage class is provided, the cluster's default storage class will be used to create the pvc. + This role will automatically create a pvc using a Storage Class if provided: ``` diff --git a/roles/backup/templates/backup_pvc.yml.j2 b/roles/backup/templates/backup_pvc.yml.j2 index ca1411f0..3f918dda 100644 --- a/roles/backup/templates/backup_pvc.yml.j2 +++ b/roles/backup/templates/backup_pvc.yml.j2 @@ -7,7 +7,9 @@ metadata: spec: accessModes: - ReadWriteOnce +{% if tower_postgres_storage_class != '' %} storageClassName: {{ tower_postgres_storage_class }} +{% endif %} resources: requests: storage: {{ tower_backup_size | default('5Gi', true) }}