diff --git a/roles/mesh_ingress/tasks/creation.yml b/roles/mesh_ingress/tasks/creation.yml index 66cbd0fe7..b9d1d9293 100644 --- a/roles/mesh_ingress/tasks/creation.yml +++ b/roles/mesh_ingress/tasks/creation.yml @@ -58,21 +58,26 @@ set_fact: _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: apply: yes - definition: "{{ lookup('template', 'route.yml.j2') }}" + definition: "{{ lookup('template', 'ingress.yml.j2') }}" wait: yes wait_timeout: "120" - register: route + register: ingress # 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: - external_hostname: "{{ route.result.status.ingress[0].host }}" - when: is_openshift | bool + external_hostname: "{{ ingress.result.status.ingress[0].host }}" + when: ingress_type == 'route' - name: Create other resources k8s: diff --git a/roles/mesh_ingress/tasks/main.yml b/roles/mesh_ingress/tasks/main.yml index 77e7e69ca..733ea64bb 100644 --- a/roles/mesh_ingress/tasks/main.yml +++ b/roles/mesh_ingress/tasks/main.yml @@ -1,4 +1,8 @@ --- +- name: Lowercase the ingress_type + set_fact: + ingress_type: "{{ ingress_type | lower }}" + - name: Run creation tasks include_tasks: creation.yml when: not finalizer_run diff --git a/roles/mesh_ingress/templates/route.yml.j2 b/roles/mesh_ingress/templates/ingress.yml.j2 similarity index 100% rename from roles/mesh_ingress/templates/route.yml.j2 rename to roles/mesh_ingress/templates/ingress.yml.j2