From 87757d4fcf283c83346a2916efd6eb4638e40d1f Mon Sep 17 00:00:00 2001
From: Spencer Smith <robertspencersmith@gmail.com>
Date: Wed, 25 May 2016 12:56:45 -0400
Subject: [PATCH] provides initial docker options support

---
 inventory/group_vars/all.yml                  | 4 ++++
 roles/network_plugin/calico/templates/docker  | 6 +++---
 roles/network_plugin/flannel/templates/docker | 4 ++--
 roles/network_plugin/weave/templates/docker   | 2 +-
 4 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/inventory/group_vars/all.yml b/inventory/group_vars/all.yml
index 2a27a4a27..1c9853a14 100644
--- a/inventory/group_vars/all.yml
+++ b/inventory/group_vars/all.yml
@@ -128,3 +128,7 @@ dns_server: "{{ kube_service_addresses|ipaddr('net')|ipaddr(2)|ipaddr('address')
 #http_proxy: ""
 #https_proxy: ""
 #no_proxy: ""
+
+##A string of extra options to pass to the docker daemon.
+##This string should be exactly as you wish it to appear.
+#docker_options: ""
diff --git a/roles/network_plugin/calico/templates/docker b/roles/network_plugin/calico/templates/docker
index 332b7503f..28518499e 100644
--- a/roles/network_plugin/calico/templates/docker
+++ b/roles/network_plugin/calico/templates/docker
@@ -1,8 +1,8 @@
 # Deployed by Ansible
 {% if ansible_service_mgr in ["sysvinit","upstart"] and kube_network_plugin == "flannel" and ansible_os_family == "Debian" %}
-DOCKER_OPTS="--bip={{ flannel_subnet }} --mtu={{ flannel_mtu }}"
+DOCKER_OPTS="--bip={{ flannel_subnet }} --mtu={{ flannel_mtu }} {% if docker_options is defined %}{{ docker_options }}{% endif %}"
 {% elif kube_network_plugin == "flannel" and ansible_os_family == "RedHat" %}
-DOCKER_NETWORK_OPTIONS="--bip={{ flannel_subnet }} --mtu={{ flannel_mtu }}"
+DOCKER_NETWORK_OPTIONS="--bip={{ flannel_subnet }} --mtu={{ flannel_mtu }} {% if docker_options is defined %}{{ docker_options }}{% endif %}"
 {% elif kube_network_plugin == "flannel" %}
-OPTIONS="--bip={{ flannel_subnet }} --mtu={{ flannel_mtu }}"
+OPTIONS="--bip={{ flannel_subnet }} --mtu={{ flannel_mtu }} {% if docker_options is defined %}{{ docker_options }}{% endif %}"
 {% endif %}
diff --git a/roles/network_plugin/flannel/templates/docker b/roles/network_plugin/flannel/templates/docker
index 832135400..7946d2b3d 100644
--- a/roles/network_plugin/flannel/templates/docker
+++ b/roles/network_plugin/flannel/templates/docker
@@ -1,7 +1,7 @@
 # Deployed by Ansible
 {% if (ansible_service_mgr in ["sysvinit","upstart"] and kube_network_plugin == "flannel" and ansible_os_family == "Debian") or
    (kube_network_plugin == "flannel" and ansible_os_family == "CoreOS") %}
-DOCKER_OPTS="--bip={{ flannel_subnet }} --mtu={{ flannel_mtu }}"
+DOCKER_OPTS="--bip={{ flannel_subnet }} --mtu={{ flannel_mtu }} {% if docker_options is defined %}{{ docker_options }}{% endif %}"
 {% elif kube_network_plugin == "flannel" %}
-OPTIONS="--bip={{ flannel_subnet }} --mtu={{ flannel_mtu }}"
+OPTIONS="--bip={{ flannel_subnet }} --mtu={{ flannel_mtu }} {% if docker_options is defined %}{{ docker_options }}{% endif %}"
 {% endif %}
diff --git a/roles/network_plugin/weave/templates/docker b/roles/network_plugin/weave/templates/docker
index 970ea051d..05d6f9535 100644
--- a/roles/network_plugin/weave/templates/docker
+++ b/roles/network_plugin/weave/templates/docker
@@ -1,2 +1,2 @@
 # Deployed by Ansible
-DOCKER_OPTS=""
+DOCKER_OPTS="{% if docker_options is defined %}{{ docker_options }}{% endif %}"
-- 
GitLab