apply custom yaml files
Change-Id: I5c3ee2867380e5c7766fc95b76b40a3dfe09030c
diff --git a/README.rst b/README.rst
index 315a648..4f20de2 100644
--- a/README.rst
+++ b/README.rst
@@ -232,6 +232,20 @@
kubelet: 7bN5hJ9JD4fKjnFTkUKsvVNfuyEddw3r
version: v1.2.4
+Apply custom yaml files
+
+.. code-block:: yaml
+
+ kubernetes:
+ master:
+ services:
+ myservice:
+ enabled: true
+ files:
+ - /srv/kubernetes/myservice-svc.yml
+ - /srv/kubernetes/myservice-pvc.yml
+ - /srv/kubernetes/myservice-deploy.yml
+
Kubernetes with OpenContrail network plugin
------------------------------------------------
diff --git a/kubernetes/master/setup.sls b/kubernetes/master/setup.sls
index f994d6a..58a5a65 100644
--- a/kubernetes/master/setup.sls
+++ b/kubernetes/master/setup.sls
@@ -40,4 +40,17 @@
{%- endif %}
+
+{%- for name, service in master.get('services', {}).items() %}
+{%- if service.get('enabled') %}
+{%- for file in service.get('files', {}) %}
+
+kubernetes_service_{{ name }}_{{ file }}:
+ cmd.run:
+ - name: kubectl apply -f {{ file }}
+
+{%- endfor %}
+{%- endif %}
+{%- endfor %}
+
{%- endif %}
diff --git a/tests/pillar/master_cluster.sls b/tests/pillar/master_cluster.sls
index 05434a1..86f0193 100644
--- a/tests/pillar/master_cluster.sls
+++ b/tests/pillar/master_cluster.sls
@@ -79,3 +79,10 @@
enabled: true
hyperkube:
hash: hnsj0XqABgrSww7Nqo7UVTSZLJUt2XRd
+ services:
+ myservice:
+ enabled: true
+ files:
+ - /srv/kubernetes/myservice-svc.yml
+ - /srv/kubernetes/myservice-pvc.yml
+ - /srv/kubernetes/myservice-deploy.yml