-
Notifications
You must be signed in to change notification settings - Fork 114
/
undeploy.sh
executable file
·42 lines (35 loc) · 1.05 KB
/
undeploy.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
35
36
37
38
39
40
41
42
#!/bin/sh
CDIR=$(cd `dirname "$0"` && pwd)
cd "$CDIR"
print_red() {
printf '%b' "\033[91m$1\033[0m\n"
}
print_green() {
printf '%b' "\033[92m$1\033[0m\n"
}
#KUBECTL_PARAMS="--context=foo"
NAMESPACE=${NAMESPACE:-monitoring}
KUBECTL="kubectl ${KUBECTL_PARAMS} --namespace=\"${NAMESPACE}\""
INSTANCES="deployment/es-client
deployment/es-data
deployment/es-master
deployment/es-data-master
deployment/kibana-logging-v2
deployment/kubernetes-events-printer
deployment/es-curator
daemonset/fluentd-elasticsearch
service/elasticsearch-logging
service/elasticsearch-discovery
service/kibana-logging
configmap/es-env
configmap/fluentd-config"
for instance in ${INSTANCES}; do
eval "${KUBECTL} delete --ignore-not-found --now \"${instance}\""
done
PODS=$(eval "${KUBECTL} get pods -o name" | awk '/^pod\/es-/ {print $1}' | tr '\n' ' ')
while [ ! "${PODS}" = "" ]; do
echo "Waiting 1 second for ${PODS}pods to shutdown..."
sleep 1
eval "${KUBECTL} delete --now ${PODS}"
PODS=$(eval "${KUBECTL} get pods -o name" | awk '/^pod\/es-/ {print $1}' | tr '\n' ' ')
done