Default ingress_type to route when on OpenShift

also rename route.yml.j2 to ingress.yml.j2 since we cover more than just route now
This commit is contained in:
Hao Liu
2024-01-05 09:38:59 -05:00
committed by Christian Adams
parent 48e3a96305
commit 69474557eb
3 changed files with 14 additions and 5 deletions

View File

@@ -58,21 +58,26 @@
set_fact: set_fact:
_image_pull_policy: "{{ awx_spec.image_pull_policy | default(_image_pull_policy, true) }}" _image_pull_policy: "{{ awx_spec.image_pull_policy | default(_image_pull_policy, true) }}"
- name: Apply Route resource - name: Default ingress_type to Route if OpenShift
set_fact:
ingress_type: route
when: is_openshift | bool and ingress_type == 'none'
- name: Apply Ingress resource
k8s: k8s:
apply: yes apply: yes
definition: "{{ lookup('template', 'route.yml.j2') }}" definition: "{{ lookup('template', 'ingress.yml.j2') }}"
wait: yes wait: yes
wait_timeout: "120" wait_timeout: "120"
register: route register: ingress
# TODO: need to wait until the route is ready before we can get the hostname # 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 # right now this will rereconcile until the route is ready
- name: Set external_hostname - name: Set external_hostname
set_fact: set_fact:
external_hostname: "{{ route.result.status.ingress[0].host }}" external_hostname: "{{ ingress.result.status.ingress[0].host }}"
when: is_openshift | bool when: ingress_type == 'route'
- name: Create other resources - name: Create other resources
k8s: k8s:

View File

@@ -1,4 +1,8 @@
--- ---
- name: Lowercase the ingress_type
set_fact:
ingress_type: "{{ ingress_type | lower }}"
- name: Run creation tasks - name: Run creation tasks
include_tasks: creation.yml include_tasks: creation.yml
when: not finalizer_run when: not finalizer_run