Skip to content

Commit

Permalink
Default ingress_type to route when on OpenShift
Browse files Browse the repository at this point in the history
also rename route.yml.j2 to ingress.yml.j2 since we cover more than just route now
  • Loading branch information
TheRealHaoLiu committed Jan 5, 2024
1 parent 888bb1c commit 4ef6a56
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
15 changes: 10 additions & 5 deletions roles/mesh_ingress/tasks/creation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 4 additions & 0 deletions roles/mesh_ingress/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -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
Expand Down
File renamed without changes.

0 comments on commit 4ef6a56

Please sign in to comment.