blob: 035a780cb363cc8e432a79eafae49cf5525a2c47 [file] [log] [blame]
earthmant5e1853a2017-08-04 09:02:48 +03001#!/usr/bin/env python
2
3from fabric.api import run
4
5
6def label_node(labels, hostname):
7 if labels:
8 label_list = []
9 for key, value in labels.items():
10 label_pair_string = '%s=%s' % (key, value)
11 label_list.append(label_pair_string)
12 label_string = ' '.join(label_list)
13 command = 'kubectl label nodes %s %s' % (hostname, label_string)
14 run(command)
15
16
17def stop_node(hostname):
18 command = 'kubectl drain %s' % (hostname)
19 run(command)
20
21
22def delete_node(hostname):
23 command = 'kubectl delete no %s' % (hostname)
24 run(command)