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
pull/4075/head
Florent Monbillard 2019-01-21 04:27:42 -05:00 committed by Matthew Mosesohn
parent e3ffa21303
commit decbcdc423
1 changed files with 3 additions and 3 deletions

View File

@ -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 }}