From 4055980ce696d768ae4237b142cf1dfa01e3dbf0 Mon Sep 17 00:00:00 2001
From: Smaine Kahlouch <smaine.kahlouch@arkena.com>
Date: Tue, 15 Dec 2015 13:14:27 +0100
Subject: [PATCH] ha apiservers for kubelet

---
 roles/kubernetes/node/templates/kubelet.j2 | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/roles/kubernetes/node/templates/kubelet.j2 b/roles/kubernetes/node/templates/kubelet.j2
index 0db8483d1..02fce526f 100644
--- a/roles/kubernetes/node/templates/kubelet.j2
+++ b/roles/kubernetes/node/templates/kubelet.j2
@@ -2,11 +2,7 @@
 Environment="KUBE_LOGTOSTDERR=--logtostderr=true"
 Environment="KUBE_LOG_LEVEL=--v={{ kube_log_level | default('2') }}"
 Environment="KUBE_ALLOW_PRIV=--allow_privileged=true"
-{% if inventory_hostname in groups['kube-master'] %}
-Environment="KUBELET_API_SERVER=--api_servers=http://{{ hostvars[inventory_hostname]['ip'] | default(hostvars[inventory_hostname]['ansible_default_ipv4']['address']) }}:{{ kube_apiserver_insecure_port }}"
-{% else %}
-Environment="KUBELET_API_SERVER=--api_servers=https://{{ groups['kube-master'][0]}}:{{ kube_apiserver_port }}"
-{% endif %}
+Environment="KUBELET_API_SERVER=--api_servers={% for srv in groups['kube-master'] %}https://{{ srv }}:{{ kube_apiserver_port }}{% if not loop.last %},{% endif %}{% endfor %}"
 # The address for the info server to serve on (set to 0.0.0.0 or "" for all interfaces)
 Environment="KUBELET_ADDRESS=--address=0.0.0.0"
 # The port for the info server to serve on
-- 
GitLab