forked from layer5io/meshery-performance-action
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmesheryctl.sh
executable file
·84 lines (67 loc) · 2.02 KB
/
mesheryctl.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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#!/usr/bin/env bash
SCRIPT_DIR=$(dirname -- "$(readlink -f "${BASH_SOURCE[0]}" || realpath "${BASH_SOURCE[0]}")")
declare -A adapters
adapters["istio"]=meshery-istio:10000
adapters["linkerd"]=meshery-linkerd:10001
adapters["consul"]=meshery-consul:10002
adapters["octarine"]=meshery-octarine:10003
adapters["network_service_mesh"]=meshery-nsm:10004
adapters["kuma"]=meshery-kuma:10007
adapters["cpx"]=meshery-cpx:10008
adapters["open_service_mesh"]=meshery-osm:10009
adapters["traefik_mesh"]=meshery-traefik-mesh:10006
main() {
local perf_filename=
local perf_profile_name=
parse_command_line "$@"
# perform the test given in the provided profile_id
if [ -z "$perf_profile_name" ]
then
mesheryctl perf apply --file $GITHUB_WORKSPACE/.github/$perf_filename -t ~/auth.json
else
# get the mesh name from performance test config
service_mesh=$(mesheryctl perf view $perf_profile_name -t ~/auth.json -o json 2>&1 | jq '."service_mesh"' | tr -d '"')
# deploy the mentioned service mesh if needed
if [[ $service_mesh != "null" ]]
then
shortName=$(echo ${adapters["$service_mesh"]} | cut -d '-' -f2 | cut -d ':' -f1)
docker network connect bridge meshery_meshery_1
docker network connect minikube meshery_meshery_1
docker network connect bridge meshery_meshery-"$shortName"_1
docker network connect minikube meshery_meshery-"$shortName"_1
mesheryctl system config minikube -t ~/auth.json
mesheryctl mesh deploy --adapter ${adapters["$service_mesh"]} -t ~/auth.json "$service_mesh" --watch
fi
mesheryctl perf apply $perf_profile_name -t ~/auth.json
fi
}
parse_command_line() {
while :
do
case "${1:-}" in
--perf-filename)
if [[ -n "${2:-}" ]]; then
perf_filename=$2
shift
else
echo "ERROR: '--profile-name' cannot be empty." >&2
exit 1
fi
;;
--profile-name)
if [[ -n "${2:-}" ]]; then
perf_profile_name=$2
shift
else
echo "ERROR: '--profile-id' cannot be empty." >&2
exit 1
fi
;;
*)
break
;;
esac
shift
done
}
main "$@"