From decbcdc4238fc393ad56b6663223b8034ed78ed9 Mon Sep 17 00:00:00 2001 From: Florent Monbillard Date: Mon, 21 Jan 2019 04:27:42 -0500 Subject: [PATCH] Use external LB IP for external api endpoint (#4060) * Use external LB IP for external api endpoint Use loadbalancer_apiserver.address instead of apiserver_loadbalancer_domain_name for kudadm init --apiserver-advertise-address argument https://kubernetes.io/docs/reference/setup-tools/kubeadm/kubeadm-init/#options states apiserver-advertise-address needs to be a IPv4 or IPv6 address * only use loadbalancer IP if it is defined --- roles/kubernetes/client/tasks/main.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/roles/kubernetes/client/tasks/main.yml b/roles/kubernetes/client/tasks/main.yml index 8afb5c530..2d5db3e80 100644 --- a/roles/kubernetes/client/tasks/main.yml +++ b/roles/kubernetes/client/tasks/main.yml @@ -2,13 +2,13 @@ - name: Set external kube-apiserver endpoint set_fact: external_apiserver_address: >- - {%- if loadbalancer_apiserver is defined and loadbalancer_apiserver.port is defined -%} - {{ apiserver_loadbalancer_domain_name }} + {%- if loadbalancer_apiserver is defined and loadbalancer_apiserver.address is defined -%} + {{ loadbalancer_apiserver.address }} {%- else -%} {{ kube_apiserver_access_address }} {%- endif -%} external_apiserver_port: >- - {%- if loadbalancer_apiserver is defined and loadbalancer_apiserver.port is defined -%} + {%- if loadbalancer_apiserver is defined and loadbalancer_apiserver.address and loadbalancer_apiserver.port is defined -%} {{ loadbalancer_apiserver.port|default(kube_apiserver_port) }} {%- else -%} {{ kube_apiserver_port }}