From 7f9e0fcbacabda12fd3dfb8705f9a2c9f581107b Mon Sep 17 00:00:00 2001 From: Qasim Mehmood <18313886+ThisIsQasim@users.noreply.github.com> Date: Sat, 11 Jan 2025 00:04:10 +0500 Subject: [PATCH] Publish the ingress-nginx service address if manual address not defined and not using host network --- .../ingress_controller/ingress_nginx/defaults/main.yml | 1 + .../templates/ds-ingress-nginx-controller.yml.j2 | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/roles/kubernetes-apps/ingress_controller/ingress_nginx/defaults/main.yml b/roles/kubernetes-apps/ingress_controller/ingress_nginx/defaults/main.yml index 9d7a4c402d3..39480910ab2 100644 --- a/roles/kubernetes-apps/ingress_controller/ingress_nginx/defaults/main.yml +++ b/roles/kubernetes-apps/ingress_controller/ingress_nginx/defaults/main.yml @@ -6,6 +6,7 @@ ingress_nginx_service_nodeport_http: "" ingress_nginx_service_nodeport_https: "" ingress_nginx_service_annotations: {} ingress_publish_status_address: "" +ingress_publish_service: "ingress-nginx/ingress-nginx" ingress_nginx_nodeselector: kubernetes.io/os: "linux" ingress_nginx_tolerations: [] diff --git a/roles/kubernetes-apps/ingress_controller/ingress_nginx/templates/ds-ingress-nginx-controller.yml.j2 b/roles/kubernetes-apps/ingress_controller/ingress_nginx/templates/ds-ingress-nginx-controller.yml.j2 index 7f71592234a..28f1ffeeb9b 100644 --- a/roles/kubernetes-apps/ingress_controller/ingress_nginx/templates/ds-ingress-nginx-controller.yml.j2 +++ b/roles/kubernetes-apps/ingress_controller/ingress_nginx/templates/ds-ingress-nginx-controller.yml.j2 @@ -79,11 +79,12 @@ spec: {% if ingress_nginx_without_class %} - --watch-ingress-without-class=true {% endif %} -{% if ingress_nginx_host_network %} - - --report-node-internal-ip-address -{% endif %} {% if ingress_publish_status_address != "" %} - --publish-status-address={{ ingress_publish_status_address }} +{% elif ingress_nginx_host_network %} + - --report-node-internal-ip-address +{% else %} + - --publish-service={{ ingress_publish_service }} {% endif %} {% for extra_arg in ingress_nginx_extra_args %} - {{ extra_arg }}