From 4b3f1139c70493b9e7625dec9e26a6e40338ff4b Mon Sep 17 00:00:00 2001 From: Jeff Geerling Date: Tue, 3 Dec 2019 14:44:54 -0600 Subject: [PATCH] PR #14 follow-up: Use storageClassName and document new postgres var a little more. --- README.md | 8 +++++--- deploy/crds/tower_v1alpha1_tower_cr_awx.yaml | 1 + deploy/crds/tower_v1alpha1_tower_cr_tower.yaml | 1 + roles/tower/defaults/main.yml | 1 + roles/tower/templates/tower_postgres.yaml.j2 | 7 +++---- 5 files changed, 11 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index d4721424..e2be4819 100644 --- a/README.md +++ b/README.md @@ -64,14 +64,16 @@ If you would like to deploy AWX (the open source upstream of Tower) into your cl tower_task_image: ansible/awx_task:9.0.1 tower_web_image: ansible/awx_web:9.0.1 -### Persistent storage for postfix +### Persistent storage for Postgres -If you need to deploy your persistent storage for postfix to a specific storage class, you can override the default variables in the Tower `spec` with the variable `tower_postgres_storage_class` variable: +If you need to use a specific storage class for Postgres' storage, specify `tower_postgres_storage_class` in your Tower spec: --- spec: ... - tower_postgres_storage_class: managed-nfs-storage + tower_postgres_storage_class: fast-ssd + +If it's not specified, Postgres will store it's data on a volume using the default storage class for your cluster. ## Development diff --git a/deploy/crds/tower_v1alpha1_tower_cr_awx.yaml b/deploy/crds/tower_v1alpha1_tower_cr_awx.yaml index 3e322f5c..fcfb526c 100644 --- a/deploy/crds/tower_v1alpha1_tower_cr_awx.yaml +++ b/deploy/crds/tower_v1alpha1_tower_cr_awx.yaml @@ -29,3 +29,4 @@ spec: tower_postgres_pass: awxpass tower_postgres_image: postgres:9.6 tower_postgres_storage_request: 8Gi + tower_postgres_storage_class: '' diff --git a/deploy/crds/tower_v1alpha1_tower_cr_tower.yaml b/deploy/crds/tower_v1alpha1_tower_cr_tower.yaml index 1aa0a1f6..2ad40b71 100644 --- a/deploy/crds/tower_v1alpha1_tower_cr_tower.yaml +++ b/deploy/crds/tower_v1alpha1_tower_cr_tower.yaml @@ -29,3 +29,4 @@ spec: tower_postgres_pass: awxpass tower_postgres_image: postgres:9.6 tower_postgres_storage_request: 8Gi + tower_postgres_storage_class: '' diff --git a/roles/tower/defaults/main.yml b/roles/tower/defaults/main.yml index a7e2f426..efdbe699 100644 --- a/roles/tower/defaults/main.yml +++ b/roles/tower/defaults/main.yml @@ -31,3 +31,4 @@ tower_rabbitmq_image: rabbitmq:3 tower_postgres_pass: awxpass tower_postgres_image: postgres:9.6 tower_postgres_storage_request: 8Gi +tower_postgres_storage_class: '' diff --git a/roles/tower/templates/tower_postgres.yaml.j2 b/roles/tower/templates/tower_postgres.yaml.j2 index a82ac803..6986e4df 100644 --- a/roles/tower/templates/tower_postgres.yaml.j2 +++ b/roles/tower/templates/tower_postgres.yaml.j2 @@ -53,13 +53,12 @@ spec: volumeClaimTemplates: - metadata: name: postgres -{% if tower_postgres_storage_class is defined %} - annotations: - volume.beta.kubernetes.io/storage-class: '{{ tower_postgres_storage_class }}' -{% endif %} spec: accessModes: - ReadWriteOnce +{% if tower_postgres_storage_class != '' %} + storageClassName: '{{ tower_postgres_storage_class }}' +{% endif %} resources: requests: storage: '{{ tower_postgres_storage_request }}'