-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathasdc_update.sh
More file actions
executable file
·63 lines (54 loc) · 2.35 KB
/
asdc_update.sh
File metadata and controls
executable file
·63 lines (54 loc) · 2.35 KB
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
####################################################################################################
# OpenDroneMap on k8s for ASDC DronesVL
# Owen Kaluza, Monash University, August 2020
#
# - This script applies any changes to deployment settings to the live cluster
#
# ./asdc_update.sh - update the configmaps and secrets only
# use this to quickly apply modified values to the live cluster.
#
####################################################################################################
if [[ ${BASH_SOURCE[0]} != $0 ]]; then
printf "script '%s' is sourced in\n" "${BASH_SOURCE[0]}"
return
fi
#Load the settings, setup openstack and kubectl
source settings.env
#####################################################
echo "Upating ConfigMaps and Secret data for FluxCD..."
#####################################################
#Apply the configMap and secret data for fluxcd
#Get content of the setup scripts
export NODEODM_SETUP_SCRIPT_CONTENT=$(cat scripts/node_setup.sh | sed 's/\(.*\)/ \1/')
export WEBODM_SETUP_SCRIPT_CONTENT=$(cat scripts/asdc_init.sh | sed 's/\(.*\)/ \1/')
export DATABASE_CHECK_SCRIPT_CONTENT=$(cat scripts/db_check.sh | sed 's/\(.*\)/ \1/')
export JUPYTERHUB_CONFIG_SCRIPT_CONTENT=$(cat scripts/jupyterhub_config.py | envsubst | sed 's/\(.*\)/ \1/')
export JUPYTERHUB_START_SCRIPT_CONTENT=$(cat scripts/asdc-start-notebook.sh | sed 's/\(.*\)/ \1/')
kubectl delete secret jwt-keys-secret
kubectl create secret generic jwt-keys-secret \
--from-file=public_key=$JWT_KEY.pub \
--from-file=private_key=$JWT_KEY
#Export all required settings env variables to this ConfigMap
apply_template flux-configmap.yaml
#####################################################
echo "Checking database volume size..."
#####################################################
#Check DB storage volume size has not been increased in settings.env
DBSIZE=$(openstack volume show db-storage -f value -c size)
if [ ${DB_VOLUME_SIZE} -gt ${DBSIZE} ]; then
echo "RESIZING DB VOLUME, delete pods..."
kubectl delete deployment db
echo "sleep 10"
sleep 10
echo "Delete pv/pvc"
kubectl delete pvc db-pvc
kubectl delete pv db-volume
echo "sleep 5"
sleep 5
echo "Resize now"
openstack volume set --size ${DB_VOLUME_SIZE} db-storage
fi
#Apply changes
if [ "$1" != "noflux" ]; then
flux reconcile kustomization apps --with-source
fi