From e589a999a8f85cd4676b6bea802758d5e7eef95e Mon Sep 17 00:00:00 2001 From: Yanis Guenane Date: Thu, 25 Feb 2021 11:22:53 +0100 Subject: [PATCH] kind,api_version: Dynamically retrieve those values --- ansible/templates/crd.yml.j2 | 3 --- deploy/awx-operator.yaml | 3 --- deploy/crds/awx_v1beta1_crd.yaml | 3 --- roles/installer/defaults/main.yml | 1 - roles/installer/tasks/update_status.yml | 13 +++++++++---- 5 files changed, 9 insertions(+), 14 deletions(-) diff --git a/ansible/templates/crd.yml.j2 b/ansible/templates/crd.yml.j2 index 78d5ec91..cda5cbc7 100644 --- a/ansible/templates/crd.yml.j2 +++ b/ansible/templates/crd.yml.j2 @@ -26,9 +26,6 @@ spec: deployment_type: description: Name of the deployment type type: string - api_version: - description: API version identified - type: string tower_task_privileged: description: If a privileged security context should be enabled type: boolean diff --git a/deploy/awx-operator.yaml b/deploy/awx-operator.yaml index 9bd17fa2..451a5b78 100644 --- a/deploy/awx-operator.yaml +++ b/deploy/awx-operator.yaml @@ -167,9 +167,6 @@ spec: deployment_type: description: Name of the deployment type type: string - api_version: - description: API version identified - type: string tower_task_privileged: description: If a privileged security context should be enabled type: boolean diff --git a/deploy/crds/awx_v1beta1_crd.yaml b/deploy/crds/awx_v1beta1_crd.yaml index 78d5ec91..cda5cbc7 100644 --- a/deploy/crds/awx_v1beta1_crd.yaml +++ b/deploy/crds/awx_v1beta1_crd.yaml @@ -26,9 +26,6 @@ spec: deployment_type: description: Name of the deployment type type: string - api_version: - description: API version identified - type: string tower_task_privileged: description: If a privileged security context should be enabled type: boolean diff --git a/roles/installer/defaults/main.yml b/roles/installer/defaults/main.yml index a5124e65..d5e40abe 100644 --- a/roles/installer/defaults/main.yml +++ b/roles/installer/defaults/main.yml @@ -1,6 +1,5 @@ --- deployment_type: awx -api_version: '{{ deployment_type }}.ansible.com/v1beta1' tower_task_privileged: false tower_ingress_type: none diff --git a/roles/installer/tasks/update_status.yml b/roles/installer/tasks/update_status.yml index 9e5e1daa..049f0980 100644 --- a/roles/installer/tasks/update_status.yml +++ b/roles/installer/tasks/update_status.yml @@ -1,8 +1,13 @@ --- +- name: Set apiVersion and kind variables + set_fact: + api_version: '{{ hostvars["localhost"]["inventory_file"].split("/")[4:6] | join("/") }}' + kind: '{{ hostvars["localhost"]["inventory_file"].split("/")[6] }}' + - name: Update admin password status operator_sdk.util.k8s_status: api_version: '{{ api_version }}' - kind: "{{ deployment_type | upper }}" + kind: "{{ kind }}" name: "{{ meta.name }}" namespace: "{{ meta.namespace }}" status: @@ -11,7 +16,7 @@ - name: Update admin user status operator_sdk.util.k8s_status: api_version: '{{ api_version }}' - kind: "{{ deployment_type | upper }}" + kind: "{{ kind }}" name: "{{ meta.name }}" namespace: "{{ meta.namespace }}" status: @@ -30,7 +35,7 @@ - name: Update version status operator_sdk.util.k8s_status: api_version: '{{ api_version }}' - kind: "{{ deployment_type | upper }}" + kind: "{{ kind }}" name: "{{ meta.name }}" namespace: "{{ meta.namespace }}" status: @@ -47,7 +52,7 @@ - name: Update URL status operator_sdk.util.k8s_status: api_version: '{{ api_version }}' - kind: "{{ deployment_type | upper }}" + kind: "{{ kind }}" name: "{{ meta.name }}" namespace: "{{ meta.namespace }}" status: