add support for kubernetes vrouter

Change-Id: I073e56db05b4f4f0dce0386e58c661507b351008
diff --git a/README.rst b/README.rst
index 017b3a9..f414d29 100644
--- a/README.rst
+++ b/README.rst
@@ -588,6 +588,20 @@
           password: none
           token: none
         ...
+
+Kubernetes vrouter nodes
+------------------------
+
+Vrouter configuration on a kubernetes node(s)
+
+.. code-block:: yaml
+
+    opencontrail:
+      ...
+      compute:
+        engine: kubernetes
+      ...
+
 Usage
 =====
 
diff --git a/metadata/service/vrouter/kubernetes/cluster.yml b/metadata/service/vrouter/kubernetes/cluster.yml
new file mode 100644
index 0000000..039364a
--- /dev/null
+++ b/metadata/service/vrouter/kubernetes/cluster.yml
@@ -0,0 +1,25 @@
+applications:
+- opencontrail
+classes:
+- service.opencontrail.support
+parameters:
+  _param:
+    opencontrail_version: 2.2
+  opencontrail:
+      common:
+        version: ${_param:opencontrail_version}
+        identity:
+          engine: kubernetes
+      compute:
+        engine: kubernetes
+        version: ${_param:opencontrail_version}
+        enabled: True
+        discovery:
+          host: ${_param:cluster_vip_address}
+        interface:
+          address: ${_param:opencontrail_compute_address}
+          dev: ${_param:opencontrail_compute_iface}
+          gateway: ${_param:opencontrail_compute_gateway}
+          mask: ${_param:opencontrail_compute_iface_mask}
+          dns: ${_param:opencontrail_compute_dns}
+          mtu: 9000
\ No newline at end of file
diff --git a/metadata/service/vrouter/kubernetes/single.yml b/metadata/service/vrouter/kubernetes/single.yml
new file mode 100644
index 0000000..c1a64b0
--- /dev/null
+++ b/metadata/service/vrouter/kubernetes/single.yml
@@ -0,0 +1,25 @@
+applications:
+- opencontrail
+classes:
+- service.opencontrail.support
+parameters:
+  _param:
+    opencontrail_version: 2.2
+  opencontrail:
+      common:
+        version: ${_param:opencontrail_version}
+        identity:
+          engine: kubernetes
+      compute:
+        engine: kubernetes
+        version: ${_param:opencontrail_version}
+        enabled: True
+        discovery:
+          host: ${_param:contrail_discovery_host}
+        interface:
+          address: ${_param:opencontrail_compute_address}
+          dev: ${_param:opencontrail_compute_iface}
+          gateway: ${_param:opencontrail_compute_gateway}
+          mask: ${_param:opencontrail_compute_iface_mask}
+          dns: ${_param:opencontrail_compute_dns}
+          mtu: 9000
\ No newline at end of file
diff --git a/opencontrail/compute.sls b/opencontrail/compute.sls
index f08aee1..231900c 100644
--- a/opencontrail/compute.sls
+++ b/opencontrail/compute.sls
@@ -85,4 +85,20 @@
   service.enabled:
   - names: {{ compute.services }}
 
+{%- if compute.get('engine', 'openstack') == 'kubernetes' %}
+
+kubernetes_packages:
+  pkg.installed:
+    - names:
+      - bridge-utils
+      - ethtool
+      - opencontrail-kubelet
+
+/usr/libexec/kubernetes/kubelet-plugins/net/exec/opencontrail/opencontrail:
+  file.symlink:
+    - target: /usr/bin/opencontrail-kubelet-plugin
+    - makedirs: true
+
+{%- endif %}
+
 {%- endif %}
diff --git a/tests/pillar/vrouter_kubernetes.sls b/tests/pillar/vrouter_kubernetes.sls
new file mode 100644
index 0000000..86aa79f
--- /dev/null
+++ b/tests/pillar/vrouter_kubernetes.sls
@@ -0,0 +1,18 @@
+opencontrail:
+  common:
+    version: 2.2
+    identity:
+      engine: kubernetes
+  compute:
+    engine: kubernetes
+    version: 2.2
+    enabled: True
+    discovery:
+      host: 127.0.0.1
+    interface:
+      address: 127.0.0.1
+      dev: eth0
+      gateway: 127.0.0.1
+      mask: /24
+      dns: 127.0.0.1
+      mtu: 9000
\ No newline at end of file