Skip to content

Commit

Permalink
Added extra steps for LoadBalancer handling in templating of SSH conf…
Browse files Browse the repository at this point in the history
…iguration
  • Loading branch information
jharmison-redhat committed Feb 17, 2021
1 parent e6e401f commit f3906cb
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
17 changes: 11 additions & 6 deletions roles/gitea-ocp/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,17 @@
_gitea_actual_route: "{{ r_route.resources[0].spec.host }}"

- name: Get external hostname from Service if external SSH is needed
k8s_info:
api_version: v1
kind: Service
name: "{{ _gitea_name }}"
namespace: "{{ _gitea_namespace }}"
register: gitea_service
block:
- name: Recover LB service details
k8s_info:
api_version: v1
kind: Service
name: "{{ _gitea_name }}-ssh"
namespace: "{{ _gitea_namespace }}"
register: _gitea_lb_service
- name: Register LB service hostname
set_fact:
_gitea_lb_address: '{{ _gitea_lb_service.resources[0].status.loadBalancer.ingress[0].hostname }}'
when: _gitea_load_balancer

- name: Set Route dependant OpenShift Objects for Gitea to {{ _gitea_state }}
Expand Down
2 changes: 1 addition & 1 deletion roles/gitea-ocp/templates/config_map.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ data:

[server]
ROOT_URL = {{ 'http' if not _gitea_ssl|bool else 'https' }}://{{ _gitea_actual_route|default(_gitea_expose_uri) }}
SSH_DOMAIN = {{ gitea_service.resources[0].status.loadBalancer.ingress[0].hostname | default(_gitea_expose_uri) }}
SSH_DOMAIN = {{ _gitea_lb_address|default(_gitea_actual_route|default(_gitea_expose_uri)) }}
DOMAIN = {{ _gitea_actual_route|default(_gitea_expose_uri) }}
HTTP_PORT = 3000
SSH_PORT = 2022
Expand Down

0 comments on commit f3906cb

Please sign in to comment.