-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathshutdown-cluster.sh
81 lines (67 loc) · 4.19 KB
/
shutdown-cluster.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#!/bin/bash
# oc login
oc login -u=admin -p=Passw0rd!
# Gracefully shutdown Aspera CP4I instance
REPLICAS=0
NAMESPACE=aspera
oc scale deploy aspera-1-aspera-hsts-aej --replicas=$REPLICAS -n $NAMESPACE
oc scale deploy aspera-1-aspera-hsts-ascp-loadbalancer --replicas=$REPLICAS -n $NAMESPACE
oc scale deploy aspera-1-aspera-hsts-ascp-swarm --replicas=$REPLICAS -n $NAMESPACE
oc scale deploy aspera-1-aspera-hsts-http-proxy --replicas=$REPLICAS -n $NAMESPACE
oc scale deploy aspera-1-aspera-hsts-node-api --replicas=$REPLICAS -n $NAMESPACE
oc scale deploy aspera-1-aspera-hsts-node-master --replicas=$REPLICAS -n $NAMESPACE
oc scale deploy aspera-1-aspera-hsts-noded-loadbalancer --replicas=$REPLICAS -n $NAMESPACE
oc scale deploy aspera-1-aspera-hsts-noded-swarm --replicas=$REPLICAS -n $NAMESPACE
oc scale deploy aspera-1-aspera-hsts-prometheus-endpoint --replicas=$REPLICAS -n $NAMESPACE
oc scale deploy aspera-1-aspera-hsts-stats --replicas=$REPLICAS -n $NAMESPACE
oc scale deploy aspera-1-aspera-hsts-tcp-proxy --replicas=$REPLICAS -n $NAMESPACE
oc scale statefulset aspera-1-redis-ha-sentinel --replicas=$REPLICAS -n $NAMESPACE
oc scale statefulset aspera-1-redis-ha-server --replicas=$REPLICAS -n $NAMESPACE
sleep 5
oc delete pods --all -n $NAMESPACE --force --grace-period=0
# Gracefully shutdown Asset Repo CP4I instance
REPLICAS=0
NAMESPACE=integration
oc scale deploy assetrepo-1-asset-files-api --replicas=$REPLICAS -n $NAMESPACE
oc scale deploy assetrepo-1-catalog-api --replicas=$REPLICAS -n $NAMESPACE
oc scale deploy assetrepo-1-clt-haproxy --replicas=$REPLICAS -n $NAMESPACE
oc scale deploy assetrepo-1-dc-main --replicas=$REPLICAS -n $NAMESPACE
oc scale deploy assetrepo-1-portal-catalog --replicas=$REPLICAS -n $NAMESPACE
oc scale deploy assetrepo-1-portal-common-api --replicas=$REPLICAS -n $NAMESPACE
oc scale deploy assetrepo-1-redis-ha-sentinel --replicas=$REPLICAS -n $NAMESPACE
oc scale deploy assetrepo-1-redis-ha-server --replicas=$REPLICAS -n $NAMESPACE
oc scale sts assetrepo-1-clt-db --replicas=$REPLICAS -n $NAMESPACE
sleep 5
# Gracefully shutdown Event Streams CP4I instance
NAMESPACE=eventstreams
oc scale deploy es-1-ibm-es-access-controller-deploy --replicas=$REPLICAS -n $NAMESPACE
oc scale deploy es-1-ibm-es-collector-deploy --replicas=$REPLICAS -n $NAMESPACE
oc scale deploy es-1-ibm-es-indexmgr-deploy --replicas=$REPLICAS -n $NAMESPACE
oc scale deploy es-1-ibm-es-proxy-deploy --replicas=$REPLICAS -n $NAMESPACE
oc scale deploy es-1-ibm-es-rest-deploy --replicas=$REPLICAS -n $NAMESPACE
oc scale deploy es-1-ibm-es-rest-producer-deploy --replicas=$REPLICAS -n $NAMESPACE
oc scale deploy es-1-ibm-es-rest-proxy-deploy --replicas=$REPLICAS -n $NAMESPACE
oc scale deploy es-1-ibm-es-ui-deploy --replicas=$REPLICAS -n $NAMESPACE
oc scale sts es-1-ibm-es-elastic-sts --replicas=$REPLICAS -n $NAMESPACE
oc scale sts es-1-ibm-es-kafka-sts --replicas=$REPLICAS -n $NAMESPACE
oc scale sts es-1-ibm-es-schemaregistry-sts --replicas=$REPLICAS -n $NAMESPACE
oc scale sts es-1-ibm-es-zookeeper-sts --replicas=$REPLICAS -n $NAMESPACE
sleep 12
#make all nodes unschedulable and drain pods
#oc adm cordon node1
#oc adm cordon node2
#oc adm cordon node3
#oc adm cordon node4
#oc adm cordon node5
#oc adm cordon node6
#oc adm cordon node7
#oc adm cordon common
#oc adm drain --ignore-daemonsets --delete-local-data --force --grace-period=30 node1
#oc adm drain --ignore-daemonsets --delete-local-data --force --grace-period=30 node2
#oc adm drain --ignore-daemonsets --delete-local-data --force --grace-period=30 node3
#oc adm drain --ignore-daemonsets --delete-local-data --force --grace-period=30 node4
#oc adm drain --ignore-daemonsets --delete-local-data --force --grace-period=30 node5
#oc adm drain --ignore-daemonsets --delete-local-data --force --grace-period=30 node6
#oc adm drain --ignore-daemonsets --delete-local-data --force --grace-period=30 node7
#oc adm drain --ignore-daemonsets --delete-local-data --force --grace-period=30 common
exit 0