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
This commit is contained in:
Florent Monbillard 2019-01-21 04:27:42 -05:00 committed by Matthew Mosesohn
parent e3ffa21303
commit decbcdc423

View file

@ -2,13 +2,13 @@
- name: Set external kube-apiserver endpoint - name: Set external kube-apiserver endpoint
set_fact: set_fact:
external_apiserver_address: >- external_apiserver_address: >-
{%- if loadbalancer_apiserver is defined and loadbalancer_apiserver.port is defined -%} {%- if loadbalancer_apiserver is defined and loadbalancer_apiserver.address is defined -%}
{{ apiserver_loadbalancer_domain_name }} {{ loadbalancer_apiserver.address }}
{%- else -%} {%- else -%}
{{ kube_apiserver_access_address }} {{ kube_apiserver_access_address }}
{%- endif -%} {%- endif -%}
external_apiserver_port: >- 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) }} {{ loadbalancer_apiserver.port|default(kube_apiserver_port) }}
{%- else -%} {%- else -%}
{{ kube_apiserver_port }} {{ kube_apiserver_port }}