Add owner ref on AWXMeshIngress to AWX

This way when AWX is deleted associated AWXMeshIngress will all be deleted as well
This commit is contained in:
Hao Liu
2023-11-03 11:12:15 -04:00
committed by Christian Adams
parent 9761c78fe9
commit 122995fda7
4 changed files with 25 additions and 0 deletions

View File

@@ -39,6 +39,7 @@ spec:
- --leader-elect
- --leader-election-id=awx-operator
image: controller:latest
imagePullPolicy: Always
name: awx-manager
env:
- name: ANSIBLE_GATHERING

View File

@@ -1,4 +1,6 @@
deployment_type: awx
set_self_owneref: true
_control_plane_ee_image: quay.io/ansible/awx-ee:latest
_image_pull_policy: Always

View File

@@ -24,6 +24,26 @@
set_fact:
awx_spec: "{{ awx_instance.resources[0].spec }}"
- name: Set owner_reference of AWXMeshIngress to related AWX instance
k8s:
state: present
definition:
apiVersion: awx.ansible.com/v1beta1
kind: AWX
name: "{{ deployment_name }}"
namespace: "{{ ansible_operator_meta.namespace }}"
metadata:
name: "{{ deployment_name }}"
namespace: "{{ ansible_operator_meta.namespace }}"
ownerReferences:
- apiVersion: awx.ansible.com/v1beta1
blockOwnerDeletion: true
controller: true
kind: AWX
name: "{{ deployment_name }}"
uid: "{{ awx_instance.resources[0].metadata.uid }}"
when: set_self_owneref | bool
- name: Set user provided control plane ee image
set_fact:
_custom_control_plane_ee_image: "{{ awx_spec.control_plane_ee_image }}"
@@ -48,6 +68,7 @@
when: is_openshift | bool
# TODO: need to wait until the route is ready before we can get the hostname
# right now this will rereconcile until the route is ready
- name: Set external_hostname
set_fact:

View File

@@ -22,6 +22,7 @@
kind: AWXRestore
role: restore
snakeCaseParameters: False
- version: v1alpha1
group: awx.ansible.com
kind: AWXMeshIngress