forked from openshift/origin-aggregated-logging
-
Notifications
You must be signed in to change notification settings - Fork 0
/
run.sh
executable file
·59 lines (56 loc) · 1.39 KB
/
run.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
#!/bin/bash
set -ex
project=${PROJECT:-default}
mode=${MODE:-install}
dir=${SCRATCH_DIR:-_output} # for writing files to bundle into secrets
# only needed for writing a kubeconfig:
master_url=${MASTER_URL:-https://kubernetes.default.svc.cluster.local:443}
master_ca=${MASTER_CA:-/var/run/secrets/kubernetes.io/serviceaccount/ca.crt}
token_file=${TOKEN_FILE:-/var/run/secrets/kubernetes.io/serviceaccount/token}
mkdir -p $dir
# set up configuration for openshift client
if [ -n "${WRITE_KUBECONFIG}" ]; then
# craft a kubeconfig, usually at $KUBECONFIG location
oc config set-cluster master \
--api-version='v1' \
--certificate-authority="${master_ca}" \
--server="${master_url}"
oc config set-credentials account \
--token="$(cat ${token_file})"
oc config set-context current \
--cluster=master \
--user=account \
--namespace="${project}"
oc config use-context current
fi
for file in scripts/*.sh; do source $file; done
case "${mode}" in
install)
install_logging
;;
uninstall)
scaleDown || :
delete_logging
;;
reinstall)
scaleDown || :
delete_logging
install_logging
;;
migrate)
uuid_migrate
;;
upgrade)
upgrade_logging
;;
stop)
scaleDown
;;
start)
scaleUp
;;
*)
echo "Invalid mode provided. One of ['install'|'uninstall'|'reinstall'|'migrate'|'upgrade'|'start'|'stop'] was expected";
exit 1
;;
esac