From 61d05dea58931e0f1bcc077bd212ce6768b09dfe Mon Sep 17 00:00:00 2001
From: Sergii Golovatiuk <sgolovatiuk@mirantis.com>
Date: Thu, 19 Jan 2017 10:07:37 +0100
Subject: [PATCH] Allow to specify number of concurrent DNS queries

ndots creates overhead as every pod creates 5 concurrent connections
that are forwarded to sky dns. Under some circumstances dnsmasq may
prevent forwarding traffic with "Maximum number of concurrent DNS
queries reached" in the logs.

This patch allows to configure the number of concurrent forwarded DNS
queries "dns-forward-max" as well as "cache-size" leaving the default
values as they were before.

Signed-off-by: Sergii Golovatiuk <sgolovatiuk@mirantis.com>
---
 roles/dnsmasq/defaults/main.yml             | 3 +++
 roles/dnsmasq/templates/01-kube-dns.conf.j2 | 3 ++-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/roles/dnsmasq/defaults/main.yml b/roles/dnsmasq/defaults/main.yml
index d1cc17f1d..d8ac8b34b 100644
--- a/roles/dnsmasq/defaults/main.yml
+++ b/roles/dnsmasq/defaults/main.yml
@@ -11,6 +11,9 @@
 #nameservers:
 #  - 127.0.0.1
 
+dns_forward_max: 150
+cache_size: 1000
+
 # Versions
 dnsmasq_version: 2.72
 
diff --git a/roles/dnsmasq/templates/01-kube-dns.conf.j2 b/roles/dnsmasq/templates/01-kube-dns.conf.j2
index 2ce30102f..ff44dbcd1 100644
--- a/roles/dnsmasq/templates/01-kube-dns.conf.j2
+++ b/roles/dnsmasq/templates/01-kube-dns.conf.j2
@@ -27,7 +27,8 @@ log-queries
 {% endif %}
 bogus-priv
 no-negcache
-cache-size=1000
+cache-size={{ cache_size }}
+dns-forward-max={{ dns_forward_max }}
 max-cache-ttl=10
 max-ttl=20
 log-facility=-
-- 
GitLab