forked from nasa/harmony
-
Notifications
You must be signed in to change notification settings - Fork 0
/
deploy-services
executable file
·58 lines (52 loc) · 1.75 KB
/
deploy-services
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
#!/bin/bash
# create back end services for Harmony
env_save=$(export -p)
set -a
source "env-defaults"
source ".env"
set +a
eval "$env_save"
if [[ -z "${HOST_VOLUME_PATH}" ]]; then
echo "HOST_VOLUME_PATH must be set before running this script"
exit 1
fi
. ./bin/create-k8s-config-maps-and-secrets
# create the query-cmr service
file="tasks/service-runner/config/query-cmr-sidecar.yaml"
if [ ! -f "$file" ]; then
echo "query-cmr-sidecar.yml was not found."
exit 1
fi
echo "Deploying $file using volume mount path $HOST_VOLUME_PATH"
envsubst < $file | kubectl apply -f - -n harmony
# create the other services
file="tasks/service-runner/config/service-template.yaml"
for service in ${LOCALLY_DEPLOYED_SERVICES//,/ }
do
# set up enviornment variables for service
export SERVICE_NAME=${service}
var_prefix=`echo $service | tr 'a-z' 'A-Z' | tr '-' '_'`
declare ${var_prefix}_IMAGE
varname=${var_prefix}_IMAGE
export SERVICE_IMAGE=${!varname}
declare ${var_prefix}_REQUESTS_CPU
varname=${var_prefix}_REQUESTS_CPU
export SERVICE_REQUESTS_CPU=${!varname}
declare ${var_prefix}_REQUESTS_MEMORY
varname=${var_prefix}_REQUESTS_MEMORY
export SERVICE_REQUESTS_MEMORY=${!varname}
declare ${var_prefix}_LIMITS_CPU
varname=${var_prefix}_LIMITS_CPU
export SERVICE_LIMITS_CPU=${!varname}
declare ${var_prefix}_LIMITS_MEMORY
varname=${var_prefix}_LIMITS_MEMORY
export SERVICE_LIMITS_MEMORY=${!varname}
declare ${var_prefix}_WORKING_DIR
varname=${var_prefix}_WORKING_DIR
export SERVICE_WORKING_DIR=${!varname}
declare ${var_prefix}_INVOCATION_ARGS
varname=${var_prefix}_INVOCATION_ARGS
export SERVICE_INVOCATION_ARGS=${!varname}
echo "Deploying $service using volume mount path $HOST_VOLUME_PATH"
envsubst < $file | kubectl apply -f - -n harmony
done