From 1bcf6f46656f224c3568a597858e1ce41e3235c8 Mon Sep 17 00:00:00 2001 From: Andy Krohg Date: Mon, 8 Feb 2021 10:55:28 -0500 Subject: [PATCH] Use load balancer hostname for SSH --- roles/gitea-ocp/tasks/main.yml | 9 +++++++++ roles/gitea-ocp/templates/config_map.yml.j2 | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/roles/gitea-ocp/tasks/main.yml b/roles/gitea-ocp/tasks/main.yml index 3f368b6..59857d4 100644 --- a/roles/gitea-ocp/tasks/main.yml +++ b/roles/gitea-ocp/tasks/main.yml @@ -52,6 +52,15 @@ set_fact: _gitea_actual_route: "{{ r_route.resources[0].spec.host }}" +- name: Get External IP for SSH + k8s_info: + api_version: v1 + kind: Service + name: "{{ _gitea_name }}" + namespace: "{{ _gitea_namespace }}" + register: gitea_service + when: _gitea_external_ip + - name: Set Route dependant OpenShift Objects for Gitea to {{ _gitea_state }} k8s: state: "{{ _gitea_state }}" diff --git a/roles/gitea-ocp/templates/config_map.yml.j2 b/roles/gitea-ocp/templates/config_map.yml.j2 index 692eb69..39e9dad 100644 --- a/roles/gitea-ocp/templates/config_map.yml.j2 +++ b/roles/gitea-ocp/templates/config_map.yml.j2 @@ -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_actual_route|default(_gitea_expose_uri) }} + SSH_DOMAIN = {{ gitea_service.resources[0].status.loadBalancer.ingress[0].hostname | default(_gitea_expose_uri) }} DOMAIN = {{ _gitea_actual_route|default(_gitea_expose_uri) }} HTTP_PORT = 3000 SSH_PORT = 2022