-
Notifications
You must be signed in to change notification settings - Fork 6
/
force_update.sh
executable file
·38 lines (32 loc) · 1.17 KB
/
force_update.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
#!/usr/bin/env bash
source connect.sh
# force an update for a K8S deployment by setting a label with unix timestamp
[ "${1}" == "" ] && echo "usage: ./force_update.sh <deployment_name|all>" && exit 1
ALL_DEPLOYMENT_NAMES="auth
list-manager
data-api
search-api
app-generic-item
app-main-page
app-search
socialmap-app-main-page
openprocure-app-main-page
nginx"
patch_deployment() {
kubectl patch deployment "${1}" -p "{\"spec\":{\"template\":{\"metadata\":{\"labels\":{\"date\":\"`date +'%s'`\"}}}}}"
}
if [ "${1}" == "all" ]; then
RES=0
for deployment_name in $ALL_DEPLOYMENT_NAMES; do
echo "${deployment_name}"
! patch_deployment "${deployment_name}" && RES=1
done
[ "${RES}" != "0" ] && exit "${RES}"
for deployment_name in $ALL_DEPLOYMENT_NAMES; do
echo "${deployment_name}"
kubectl rollout status deployment "${deployment_name}"
done
exit "${RES}"
else
patch_deployment "${1}" && kubectl rollout status deployment "${1}"
fi