-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathexec-cima-example.sh
executable file
·52 lines (42 loc) · 1.38 KB
/
exec-cima-example.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
#!/bin/bash
# Script to execute CIMA example pod
set -e
MEASUREMENT=false
EVENTLOG=false
CC_REPORT=false
VERIFY=false
usage() { echo "Usage: $0 [-m get measurement] [-e get event logs] [-r get cc report] [-v verify event logs]"; exit 1; }
while getopts ":mervh" option; do
case "${option}" in
m) MEASUREMENT=true;;
e) EVENTLOG=true;;
r) CC_REPORT=true;;
v) VERIFY=true;;
h) usage;;
*) echo "Invalid option: -${OPTARG}" >&2
usage
;;
esac
done
echo "Exeute the script to get measurement, event log and CC report"
POD_NAME=$(kubectl get po -n cima | grep -i cima-example | grep Running | awk '{ print $1 }')
if [[ -z "$POD_NAME" ]]; then
echo "No cima-example pod with status running! Please check your deployment."
exit 1
fi
if [ $MEASUREMENT == true ]; then
echo "==> Get Measurements"
kubectl exec -it "$POD_NAME" -n cima -- python3 py_sdk_example.py -m
fi
if [ $EVENTLOG == true ]; then
echo "==> Get Event logs"
kubectl exec -it "$POD_NAME" -n cima -- python3 py_sdk_example.py -e
fi
if [ $CC_REPORT == true ]; then
echo "==> Get CC_REPORT"
kubectl exec -it "$POD_NAME" -n cima -- python3 py_sdk_example.py -r
fi
if [ $VERIFY == true ]; then
echo "==> Verify event logs"
kubectl exec -it "$POD_NAME" -n cima -- python3 py_sdk_example.py -v
fi