aboutsummaryrefslogtreecommitdiffstats
path: root/cloudify/scripts/tasks.py
diff options
context:
space:
mode:
Diffstat (limited to 'cloudify/scripts/tasks.py')
-rw-r--r--cloudify/scripts/tasks.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/cloudify/scripts/tasks.py b/cloudify/scripts/tasks.py
new file mode 100644
index 0000000000..035a780cb3
--- /dev/null
+++ b/cloudify/scripts/tasks.py
@@ -0,0 +1,24 @@
+#!/usr/bin/env python
+
+from fabric.api import run
+
+
+def label_node(labels, hostname):
+ if labels:
+ label_list = []
+ for key, value in labels.items():
+ label_pair_string = '%s=%s' % (key, value)
+ label_list.append(label_pair_string)
+ label_string = ' '.join(label_list)
+ command = 'kubectl label nodes %s %s' % (hostname, label_string)
+ run(command)
+
+
+def stop_node(hostname):
+ command = 'kubectl drain %s' % (hostname)
+ run(command)
+
+
+def delete_node(hostname):
+ command = 'kubectl delete no %s' % (hostname)
+ run(command)