update metadata for dns autoscaler

Using `enabled: True` to conform with the rest of metadata structures.
Introductiong poll-perios-seconds parameter

Change-Id: I127114ad6bcdd03476baad0c2d5831f2e953349e
diff --git a/README.rst b/README.rst
index 16f967b..f34f877 100644
--- a/README.rst
+++ b/README.rst
@@ -57,6 +57,23 @@
             netchecker:
               enabled: true
 
+Enable autoscaler for dns addon. Poll period can be skipped.
+
+.. code-block:: yaml
+
+    kubernetes:
+        master:
+          addons:
+            dns:
+              domain: cluster.local
+              enabled: true
+              replicas: 1
+              server: 10.254.0.10
+              autoscaler:
+                enabled: true
+                poll-period-seconds: 60
+
+
 Pass aditional parameters to daemons:
 
 .. code-block:: yaml
diff --git a/kubernetes/files/kube-addons/dns/kubedns-autoscaler.yaml b/kubernetes/files/kube-addons/dns/kubedns-autoscaler.yaml
index 508f19c..be4190b 100644
--- a/kubernetes/files/kube-addons/dns/kubedns-autoscaler.yaml
+++ b/kubernetes/files/kube-addons/dns/kubedns-autoscaler.yaml
@@ -1,3 +1,4 @@
+{%- from "kubernetes/map.jinja" import master with context %}
 apiVersion: extensions/v1beta1
 kind: Deployment
 metadata:
@@ -28,5 +29,8 @@
           # If using small nodes, "nodesPerReplica" should dominate.
           - --default-params={"linear":{"coresPerReplica":256,"nodesPerReplica":10,"min":2}}
           - --logtostderr=true
+          {%- if master.addons.dns.autoscaler.get('poll-period-seconds')  %}
+          - --poll-period-seconds={{ master.addons.dns.autoscaler.get('poll-period-seconds') }}
+          {%- endif %}
           - --v=2
 
diff --git a/kubernetes/master/kube-addons.sls b/kubernetes/master/kube-addons.sls
index e7f5324..610e85f 100644
--- a/kubernetes/master/kube-addons.sls
+++ b/kubernetes/master/kube-addons.sls
@@ -54,7 +54,7 @@
     - dir_mode: 755
     - makedirs: True
 
-{% if master.addons.dns.get('autoscaler', True) %}
+{% if master.addons.dns.get('autoscaler', {}).get('enabled', True) %}
 
 /etc/kubernetes/addons/dns/kubedns-autoscaler.yaml:
   file.managed:
diff --git a/metadata/service/master/cluster.yml b/metadata/service/master/cluster.yml
index 4995be5..bba8867 100644
--- a/metadata/service/master/cluster.yml
+++ b/metadata/service/master/cluster.yml
@@ -32,7 +32,8 @@
         dns:
           enabled: true
           replicas: 1
-          autoscaler: True
+          autoscaler:
+            enabled: true
           domain: cluster.local
           server: 10.254.0.10
           dnsmasq:
diff --git a/metadata/service/master/single.yml b/metadata/service/master/single.yml
index f6dacbe..4a52299 100644
--- a/metadata/service/master/single.yml
+++ b/metadata/service/master/single.yml
@@ -27,7 +27,8 @@
         dns:
           enabled: true
           replicas: 1
-          autoscaler: True
+          autoscaler:
+            enabled: true
           domain: cluster.local
           server: 10.254.0.10
           dnsmasq:
diff --git a/tests/pillar/master_cluster.sls b/tests/pillar/master_cluster.sls
index 36cf4d5..c253e9d 100644
--- a/tests/pillar/master_cluster.sls
+++ b/tests/pillar/master_cluster.sls
@@ -11,7 +11,8 @@
         enabled: true
         replicas: 1
         server: 10.254.0.10
-        autoscaler: True
+        autoscaler:
+          enabled: true
       heapster_influxdb:
         enabled: true
         public_ip: 185.22.97.132