generated from layer5io/layer5-repo-template
-
Notifications
You must be signed in to change notification settings - Fork 10
/
meshery.sh
62 lines (51 loc) · 1.18 KB
/
meshery.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
#!/usr/bin/env bash
set -o errexit
set -o nounset
set -o pipefail
SCRIPT_DIR=$(dirname -- "$(readlink -f "${BASH_SOURCE[0]}" || realpath "${BASH_SOURCE[0]}")")
main() {
local provider_token=
local meshery_platform=
parse_command_line "$@"
if [[ -z $provider_token ]]
then
printf "Token not provided.\n Using local provider..."
echo '{ "meshery-provider": "None", "token": null }' | jq -c '.token = ""'> ~/auth.json
else
echo '{ "meshery-provider": "Meshery", "token": null }' | jq -c '.token = "'$provider_token'"' > ~/auth.json
fi
kubectl config view --minify --flatten > ~/minified_config
mv ~/minified_config ~/.kube/config
curl -L https://meshery.io/install | PLATFORM=$meshery_platform bash -
sleep 30
}
parse_command_line() {
while :
do
case "${1:-}" in
-t|--provider-token)
if [[ -n "${2:-}" ]]; then
provider_token=$2
shift
else
echo "ERROR: '-t|--provider_token' cannot be empty." >&2
exit 1
fi
;;
-p|--platform)
if [[ -n "${2:-}" ]]; then
meshery_platform=$2
shift
else
echo "ERROR: '-p|--platform' cannot be empty." >&2
exit 1
fi
;;
*)
break
;;
esac
shift
done
}
main "$@"