Service update orchestrations
Change-Id: If7aa71c70c8a37aafc990e685f390da2cd781ff9
diff --git a/README.rst b/README.rst
index 399315c..011617b 100644
--- a/README.rst
+++ b/README.rst
@@ -3,17 +3,12 @@
Kubernetes Formula
==================
-Kubernetes is an open-source system for automating deployment, scaling, and management of containerized applications.
-
-This formula deploys production ready Kubernetes and generate Kubernetes manifests as well.
-
-Based on official Kubernetes salt
-https://github.com/kubernetes/kubernetes/tree/master/cluster/saltbase
-
-Extended on Contrail contribution https://github.com/Juniper/kubernetes/blob/opencontrail-integration/docs/getting-started-guides/opencontrail.md
+Kubernetes is an open-source system for automating deployment, scaling, and
+management of containerized applications. This formula deploys production
+ready Kubernetes and generate Kubernetes manifests as well.
-Sample pillars
+Sample Pillars
==============
**REQUIRED:** Define image to use for hyperkube, CNIs and calicoctl image
@@ -858,37 +853,14 @@
value: one
image_pull_secretes: password
-Documentation and Bugs
-======================
-To learn how to deploy OpenStack Salt, consult the documentation available
-online at:
+More Information
+================
- https://wiki.openstack.org/wiki/OpenStackSalt
+* https://github.com/Juniper/kubernetes/blob
+/opencontrail-integration/docs /getting-started-guides/opencontrail.md
+* https://github.com/kubernetes/kubernetes/tree/master/cluster/saltbase
-In the unfortunate event that bugs are discovered, they should be reported to
-the appropriate bug tracker. If you obtained the software from a 3rd party
-operating system vendor, it is often wise to use their own bug tracker for
-reporting problems. In all other cases use the master OpenStack bug tracker,
-available at:
-
- http://bugs.launchpad.net/openstack-salt
-
-Developers wishing to work on the OpenStack Salt project should always base
-their work on the latest formulas code, available from the master GIT
-repository at:
-
- https://git.openstack.org/cgit/openstack/salt-formula-kubernetes
-
-Developers should also join the discussion on the IRC list, at:
-
- https://wiki.openstack.org/wiki/Meetings/openstack-salt
-
-Copyright and authors
-=====================
-
-(c) 2016 tcp cloud a.s.
-(c) 2016 OpenStack Foundation
Documentation and Bugs
======================
diff --git a/kubernetes/orchestrate/compute_install.sls b/kubernetes/orchestrate/compute_install.sls
new file mode 100644
index 0000000..55b63c4
--- /dev/null
+++ b/kubernetes/orchestrate/compute_install.sls
@@ -0,0 +1,23 @@
+{%- set node_name = salt['pillar.get']('event_originator') %}
+
+cert_state:
+ salt.state:
+ - tgt: '{{ node_name }}'
+ - sls: salt.minion.cert
+ - queue: True
+
+docker_state:
+ salt.state:
+ - tgt: '{{ node_name }}'
+ - sls: docker.host
+ - queue: True
+ - require:
+ - salt: cert_state
+
+pool_state:
+ salt.state:
+ - tgt: '{{ node_name }}'
+ - sls: kubernetes.pool
+ - queue: True
+ - require:
+ - salt: docker_state
diff --git a/kubernetes/orchestrate/compute_upgrade.sls b/kubernetes/orchestrate/compute_upgrade.sls
new file mode 100644
index 0000000..81f26e8
--- /dev/null
+++ b/kubernetes/orchestrate/compute_upgrade.sls
@@ -0,0 +1,54 @@
+{%- set node_name = salt['pillar.get']('event_originator') %}
+{%- set short_name = node_name.split('.')[0] %}
+
+cordon_node:
+ salt.function:
+ - name: cmd.run
+ - tgt: '*01* and I@kubernetes:master'
+ - tgt_type: compound
+ - arg:
+ - kubectl cordon {{ short_name }}
+
+drain_node:
+ salt.function:
+ - name: cmd.run
+ - tgt: '*01* and I@kubernetes:master'
+ - tgt_type: compound
+ - arg:
+ - kubectl drain --force --ignore-daemonsets --grace-period 100 --timeout 120s --delete-local-data {{ short_name }}
+ - require:
+ - salt: cordon_node
+
+cert_state:
+ salt.state:
+ - tgt: '{{ node_name }}'
+ - sls: salt.minion.cert
+ - queue: True
+ - require:
+ - salt: drain_node
+
+docker_state:
+ salt.state:
+ - tgt: '{{ node_name }}'
+ - sls: docker.host
+ - queue: True
+ - require:
+ - salt: cert_state
+
+pool_state:
+ salt.state:
+ - tgt: '{{ node_name }}'
+ - sls: kubernetes.pool
+ - queue: True
+ - require:
+ - salt: docker_state
+
+uncordon_node:
+ salt.function:
+ - name: cmd.run
+ - tgt: '*01* and I@kubernetes:master'
+ - tgt_type: compound
+ - arg:
+ - kubectl uncordon {{ short_name }}
+ - require:
+ - salt: pool_state
diff --git a/kubernetes/orchestrate/control_upgrade.sls b/kubernetes/orchestrate/control_upgrade.sls
new file mode 100644
index 0000000..a33ff1b
--- /dev/null
+++ b/kubernetes/orchestrate/control_upgrade.sls
@@ -0,0 +1 @@
+{%- set node_name = salt['pillar.get']('event_originator') %}
diff --git a/kubernetes/reactor/compute_install.sls b/kubernetes/reactor/compute_install.sls
new file mode 100644
index 0000000..1d43b50
--- /dev/null
+++ b/kubernetes/reactor/compute_install.sls
@@ -0,0 +1,8 @@
+
+orchestrate_kubernetes_compute_install:
+ runner.state.orchestrate:
+ - mods: kubernetes.orchestrate.compute_install
+ - queue: True
+ - pillar:
+ event_originator: {{ data.id }}
+ event_data: {{ data.data }}
diff --git a/kubernetes/reactor/compute_upgrade.sls b/kubernetes/reactor/compute_upgrade.sls
new file mode 100644
index 0000000..d4cd55b
--- /dev/null
+++ b/kubernetes/reactor/compute_upgrade.sls
@@ -0,0 +1,8 @@
+
+orchestrate_kubernetes_compute_upgrade:
+ runner.state.orchestrate:
+ - mods: kubernetes.orchestrate.compute_upgrade
+ - queue: True
+ - pillar:
+ event_originator: {{ data.id }}
+ event_data: {{ data.data }}
diff --git a/kubernetes/reactor/control_upgrade.sls b/kubernetes/reactor/control_upgrade.sls
new file mode 100644
index 0000000..3287670
--- /dev/null
+++ b/kubernetes/reactor/control_upgrade.sls
@@ -0,0 +1,8 @@
+
+orchestrate_kubernetes_control_upgrade:
+ runner.state.orchestrate:
+ - mods: kubernetes.orchestrate.control_upgrade
+ - queue: True
+ - pillar:
+ event_originator: {{ data.id }}
+ event_data: {{ data.data }}