forked from apache-spark-on-k8s/kubernetes-HDFS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
remove_hdfs_from_kube.sh
executable file
·34 lines (29 loc) · 1.28 KB
/
remove_hdfs_from_kube.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/bin/bash
echo "Removing HDFS datanode."
helm del --purge my-hdfs-datanode
echo "Removing HDFS namenode."
helm del --purge my-hdfs-namenode
echo "Removing HDFS config."
helm del --purge my-hdfs-config
echo "Removing tiller-deploy in kube-system namespace."
kubectl -n "kube-system" delete deployment tiller-deploy
echo "Removing helm account."
kubectl delete -f installHelm/helm-account.yaml
# Delete hdfs namenode datanode labels from nodes.
labeled_node_name=`kubectl get nodes --show-labels |grep hdfs-datanode-exclude |grep hdfs-namenode-selector |cut -d ' ' -f1`
if [ "${labeled_node_name}" != "" ]; then
echo "Removing hdfs labels from node: ${labeled_node_name}"
kubectl label node ${labeled_node_name} hdfs-namenode-selector-
kubectl label node ${labeled_node_name} hdfs-datanode-exclude-
fi
# Check if all the labels are deleted.
kubectl get nodes --show-labels |grep hdfs-datanode-exclude >/dev/null
if [ "$?" != "0" ]; then
echo "Please check below existing labeled nodes for hdfs:"
kubectl get nodes --show-labels |grep hdfs-datanode-exclude
fi
kubectl get nodes --show-labels |grep hdfs-namenode-selector >/dev/null
if [ "$?" != "0" ]; then
echo "Please check below existing labeled nodes for hdfs:"
kubectl get nodes --show-labels |grep hdfs-namenode-selector
fi