Set ownerRef to null for restore created AWX object to avoid garbage collection

- Set defaults for pg type to satisfy conditional
This commit is contained in:
Christian M. Adams
2021-04-22 23:27:28 -04:00
parent 867bc258b9
commit 3e444da7bc
3 changed files with 15 additions and 4 deletions

View File

@@ -1,6 +1,6 @@
---
- name: Check for default PostgreSQL configuration
- name: Get PostgreSQL configuration
k8s_info:
kind: Secret
namespace: '{{ meta.namespace }}'
@@ -19,11 +19,11 @@
awx_postgres_database: "{{ pg_config['resources'][0]['data']['database'] | b64decode }}"
awx_postgres_port: "{{ pg_config['resources'][0]['data']['port'] | b64decode }}"
awx_postgres_host: "{{ pg_config['resources'][0]['data']['host'] | b64decode }}"
awx_postgres_type: "{{ _postgres_configuration['resources'][0]['data']['type'] | b64decode | default('unmanaged') }}"
awx_postgres_type: "{{ pg_config['resources'][0]['data']['type'] | b64decode | default('unmanaged') }}"
- name: Default label selector to custom resource generated postgres
set_fact:
postgres_label_selector: "app.kubernetes.io/name={{ meta.name }}-postgres"
postgres_label_selector: "app.kubernetes.io/name={{ tower_name }}-postgres"
when: postgres_label_selector is not defined
- name: Get the postgres pod information

View File

@@ -26,3 +26,13 @@
# TODO: Add logic to allow users to provide override values here,
# or to specify spec values that were not in the backed up AWX object.
# This may involve changing how we back up the spec section of the AWX object
- name: Remove ownerReferences to prevent garbage collection of new AWX CRO
k8s:
definition:
apiVersion: '{{ api_version }}'
kind: AWX
metadata:
name: '{{ tower_name }}'
namespace: '{{ meta.namespace }}'
ownerReferences: null

View File

@@ -26,10 +26,11 @@
awx_postgres_database: "{{ pg_config['resources'][0]['data']['database'] | b64decode }}"
awx_postgres_port: "{{ pg_config['resources'][0]['data']['port'] | b64decode }}"
awx_postgres_host: "{{ pg_config['resources'][0]['data']['host'] | b64decode }}"
awx_postgres_type: "{{ pg_config['resources'][0]['data']['type'] | b64decode | default('unmanaged') }}"
- name: Default label selector to custom resource generated postgres
set_fact:
postgres_label_selector: "app.kubernetes.io/name={{ meta.name }}-postgres"
postgres_label_selector: "app.kubernetes.io/name={{ tower_name }}-postgres"
when: postgres_label_selector is not defined
- name: Get the postgres pod information