From 3cbcd6f18983765f7a2c6aff5bae3fedd6a688f6 Mon Sep 17 00:00:00 2001
From: Smaine Kahlouch <smaine.kahlouch@arkena.com>
Date: Sat, 12 Dec 2015 19:06:57 +0100
Subject: [PATCH] Calico uses the loadbalancer to reach etcd if
 'loadbalancer_address' is defined. The loadbalancer has to be configured
 first

---
 roles/network_plugin/tasks/calico.yml                 | 2 +-
 roles/network_plugin/templates/network-environment.j2 | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/roles/network_plugin/tasks/calico.yml b/roles/network_plugin/tasks/calico.yml
index 818dab709..c507d66e1 100644
--- a/roles/network_plugin/tasks/calico.yml
+++ b/roles/network_plugin/tasks/calico.yml
@@ -12,7 +12,7 @@
 - name: Calico | Configure calico-node desired pool
   shell: calicoctl pool add {{ kube_pods_subnet }}
   environment:
-     ETCD_AUTHORITY: "{{ groups['kube-master'][0] }}:2379"
+     ETCD_AUTHORITY: "{{ loadbalancer_address | default(groups['kube-master'][0]) }}:2379"
   run_once: true
 
 - name: Calico | Write calico-node systemd init file
diff --git a/roles/network_plugin/templates/network-environment.j2 b/roles/network_plugin/templates/network-environment.j2
index 2b89eb7e8..53ab5f15a 100755
--- a/roles/network_plugin/templates/network-environment.j2
+++ b/roles/network_plugin/templates/network-environment.j2
@@ -10,7 +10,7 @@ KUBERNETES_MASTER={{ groups['kube-master'][0] }}
 
 # Location of etcd cluster used by Calico.  By default, this uses the etcd
 # instance running on the Kubernetes Master
-ETCD_AUTHORITY={{ groups['kube-master'][0] }}:2379
+ETCD_AUTHORITY={{ loadbalancer_address | default(groups['kube-master'][0]) }}:2379
 
 # The kubernetes-apiserver location - used by the calico plugin
 KUBE_API_ROOT=http://{{ groups['kube-master'][0] }}:{{kube_apiserver_insecure_port}}/api/v1/
-- 
GitLab