add cni plugins for k8s 1.3.5+

Change-Id: I12efa7a9e84d69a96d51fd38d8efbc9367c4b8e7
diff --git a/kubernetes/files/calico/calico.conf b/kubernetes/files/calico/calico.conf
index dcd0c85..97810eb 100644
--- a/kubernetes/files/calico/calico.conf
+++ b/kubernetes/files/calico/calico.conf
@@ -6,5 +6,8 @@
     "log_level": "info",
     "ipam": {
         "type": "calico-ipam"
+    },
+    "kubernetes": {
+        "kubeconfig": "/etc/kubernetes/kubelet.kubeconfig"
     }
 }
\ No newline at end of file
diff --git a/kubernetes/files/configmap.yml b/kubernetes/files/configmap.yml
index 29cb1a6..d2469c0 100644
--- a/kubernetes/files/configmap.yml
+++ b/kubernetes/files/configmap.yml
@@ -12,7 +12,7 @@
   {%- set service_config_files = load_support_file(support_fragment_file, configmap.pillar, configmap.get('grains', {}))|load_yaml %}
   {%- for service_config_name, service_config in service_config_files.config.iteritems() %}
   {{ service_config_name }}: |
-{{ load_support_file(service_config.source|replace('salt://', ''), configmap.pillar, configmap.get('grains', {}))|indent(4) }}
+    {{ load_support_file(service_config.source|replace('salt://', ''), configmap.pillar, configmap.get('grains', {}))|indent(4) }}
   {%- endfor %}
   {%- endif %}
   {%- endfor %}
diff --git a/kubernetes/files/kubelet/kubelet.kubeconfig b/kubernetes/files/kubelet/kubelet.kubeconfig
index 7b68dc9..951288a 100644
--- a/kubernetes/files/kubelet/kubelet.kubeconfig
+++ b/kubernetes/files/kubelet/kubelet.kubeconfig
@@ -7,7 +7,7 @@
 clusters:
 - cluster:
     certificate-authority: /etc/kubernetes/ssl/kubelet-client.crt
-#    server: https://{{ pool.apiserver.host }}:443
+    server: https://{{ pool.apiserver.host }}:443
   name: cluster.local
 contexts:
 - context:
diff --git a/kubernetes/pool/cni.sls b/kubernetes/pool/cni.sls
new file mode 100644
index 0000000..76db340
--- /dev/null
+++ b/kubernetes/pool/cni.sls
@@ -0,0 +1,15 @@
+{%- from "kubernetes/map.jinja" import pool with context %}
+{%- if pool.enabled %}
+
+cni-tar:
+  archive:
+    - extracted
+    - user: root
+    - name: /opt/cni/bin
+    - source: https://github.com/containernetworking/cni/releases/download/{{ pool.cni.version }}/cni-{{ pool.cni.version }}.tgz
+    - tar_options: v
+    - source_hash: md5={{ pool.cni.hash }}
+    - archive_format: tar
+    - if_missing: /opt/cni/bin/loopback
+
+{%- endif %}
\ No newline at end of file
diff --git a/kubernetes/pool/init.sls b/kubernetes/pool/init.sls
index 81a7366..6f56c27 100644
--- a/kubernetes/pool/init.sls
+++ b/kubernetes/pool/init.sls
@@ -4,6 +4,7 @@
 {%- if pool.network.engine == "calico" %}
 - kubernetes.pool.calico
 {%- endif %}
+- kubernetes.pool.cni
 - kubernetes.pool.kubelet
 {%- if pool.network.engine == "flannel" %}
 - kubernetes.pool.flannel
diff --git a/metadata/service/pool/cluster.yml b/metadata/service/pool/cluster.yml
index 437fb34..ea0bc8a 100644
--- a/metadata/service/pool/cluster.yml
+++ b/metadata/service/pool/cluster.yml
@@ -41,4 +41,7 @@
           - host: ${_param:cluster_node02_address}
             port: 4001
           - host: ${_param:cluster_node03_address}
-            port: 4001
\ No newline at end of file
+            port: 4001
+      cni:
+        version: v0.3.0
+        hash: 58237532e1b2b1be1fb3d12457da85f5
\ No newline at end of file
diff --git a/metadata/service/pool/single.yml b/metadata/service/pool/single.yml
index 8c3f04b..f3cb7c0 100644
--- a/metadata/service/pool/single.yml
+++ b/metadata/service/pool/single.yml
@@ -34,4 +34,7 @@
         etcd:
           members:
             - host: ${_param:master_address}
-              port: 4001
\ No newline at end of file
+              port: 4001
+      cni:
+        version: v0.3.0
+        hash: 58237532e1b2b1be1fb3d12457da85f5
\ No newline at end of file
diff --git a/tests/pillar/pool_cluster.sls b/tests/pillar/pool_cluster.sls
index d58a25d..f639738 100644
--- a/tests/pillar/pool_cluster.sls
+++ b/tests/pillar/pool_cluster.sls
@@ -46,3 +46,6 @@
           port: 4001
     hyperkube:
       hash: hnsj0XqABgrSww7Nqo7UVTSZLJUt2XRd
+    cni:
+      version: v0.3.0
+      hash: 58237532e1b2b1be1fb3d12457da85f5
\ No newline at end of file