-
Notifications
You must be signed in to change notification settings - Fork 42
/
Copy pathupdate.sh
executable file
·71 lines (56 loc) · 1.35 KB
/
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
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
#!/usr/bin/env bash
# Script to Update PSO Arrays configurations after modification of values.yaml
usage()
{
echo "Usage : $0 -f <values.yaml>"
exit
}
if [[ "$1" == "-h" || "$1" == "--help" ]]; then
usage
fi
while (("$#")); do
case "$1" in
-f)
if [ "$#" -lt 2 ]; then
usage
exit
fi
VALUESFILE="$2"
shift
shift
;;
-h|--help|*)
usage
exit
;;
esac
done
if [[ -z ${VALUESFILE} || ! -f ${VALUESFILE} ]]; then
usage
echo "File ${VALUESFILE} for values.yaml does not exist"
exit 1
fi
# Find out if this is OpenShift
OC=/usr/bin/oc
if [ -f "$OC" ]; then
KUBECTL=oc
ORCHESTRATOR=openshift
else
KUBECTL=kubectl
ORCHESTRATOR=k8s
fi
# Discover which namespace we have installed PSO in
NAMESPACE=`$KUBECTL get deployment --all-namespaces | grep pure-provisioner | awk '{print $1}' -`
if [ -z $NAMESPACE ]; then
echo "Error: Please confirm Namespace for PSO"
exit 1
fi
# Discover the image we are currently using
IMAGE=`$KUBECTL describe deployment pso-operator -n $NAMESPACE | grep Image | awk '{print $2}' -`
if [ -z $IMAGE ]; then
echo "Error: Failed to identify image being used"
exit 1
fi
# Quietly Reinstall PSO
./install.sh --image=$IMAGE --namespace=$NAMESPACE --orchestrator=$ORCHESTRATOR -f $VALUESFILE > /dev/null 2>&1
$KUBECTL rollout status deployment pure-provisioner -n $NAMESPACE >/dev/null 2>&1