Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modify bash script and action variables #61

Merged
merged 10 commits into from
Aug 29, 2022
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/configurable-benchmark-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ jobs:
.github/workflows/scripts/${{ github.event.inputs.service_mesh }}_deploy.sh
shell: bash

- name: Initiate tmate session
uses: mxschmitt/action-tmate@v3
#- name: Initiate tmate session
# uses: mxschmitt/action-tmate@v3

- name: Run Benchmark Tests
uses: layer5io/meshery-smp-action@master
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/scripts/istio_deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ fi

sleep 10
#mesheryctl system login --provider None
echo 'E' | mesheryctl mesh deploy adapter meshery-istio:10000 --token "./.github/workflows/auth.json"
echo | mesheryctl mesh deploy adapter meshery-istio:10000 --namespace "istio-system" --token "./.github/workflows/auth.json"
sleep 100
echo "Onboarding application... Standby for few minutes..."
mesheryctl pattern apply -f "https://raw.githubusercontent.com/service-mesh-patterns/service-mesh-patterns/master/samples/bookInfoPattern.yaml" --token "./.github/workflows/auth.json"
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/scripts/linkerd_deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ fi

curl -fsL https://run.linkerd.io/emojivoto.yml --output emojivoto.yml
sleep 10
mesheryctl system login --provider None
mesheryctl mesh deploy adapter meshery-linkerd:10001
#mesheryctl system login --provider None
echo | mesheryctl mesh deploy adapter meshery-linkerd:10001 --token "./.github/workflows/auth.json"
echo "Onboarding application... Standby for few minutes..."
mesheryctl app onboard -f "./emojivoto.yml"
mesheryctl app onboard -f "./emojivoto.yml" -t "./.github/workflows/auth.json"
#mesheryctl pattern apply -f "./emojivoto.yml"

# Wait for the application to be ready
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/scripts/osm_deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ fi

curl -fsL https://raw.githubusercontent.com/openservicemesh/osm-docs/main/manifests/apps/bookstore.yaml --output bookstore.yaml
sleep 10
mesheryctl system login --provider None
mesheryctl mesh deploy adapter meshery-osm:10009
#mesheryctl system login --provider None
echo | mesheryctl mesh deploy adapter meshery-osm:10009 --token "./.github/workflows/auth.json"
echo "Onboarding application... Standby for few minutes..."
mesheryctl app onboard -f "./bookstore.yaml"
mesheryctl app onboard -f "./bookstore.yaml" -t "./.github/workflows/auth.json"
#mesheryctl pattern apply -f "https://raw.githubusercontent.com/openservicemesh/osm-docs/main/manifests/apps/bookstore.yaml" --token "./.github/workflows/auth.json"

sleep 100
Expand Down
202 changes: 101 additions & 101 deletions meshery.sh
Original file line number Diff line number Diff line change
@@ -1,101 +1,101 @@
#!/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 PLATFORM=docker

parse_command_line "$@"

echo "Checking if a k8s cluster exits..."
if kubectl config current-context
then
echo "Cluster found"
else
printf "Cluster not found. \nCreating one...\n"
create_k8s_cluster
echo "Cluster created successfully!"
fi

if [[ -z $provider_token ]]
then
printf "Token not provided.\nUsing local provider...\n"
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
cat ~/auth.json

kubectl config view --minify --flatten > ~/minified_config
mv ~/minified_config ~/.kube/config

curl -L https://git.io/meshery | sudo PLATFORM=$PLATFORM bash - &

sleep 60
}

create_k8s_cluster() {
curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64
sudo install minikube-linux-amd64 /usr/local/bin/minikube
sudo apt update -y
sudo apt install conntrack
minikube version
minikube start --driver=none --kubernetes-version=v1.20.7
sleep 40
}

meshery_config() {
mkdir ~/.meshery
config='{"contexts":{"local":{"endpoint":"http://localhost:9081","token":"Default","platform":"docker","adapters":[],"channel":"stable","version":"latest"}},"current-context":"local","tokens":[{"location":"auth.json","name":"Default"}]}'

echo $config | yq e '."contexts"."local"."adapters"[0]="'$1'"' -P - > ~/.meshery/config.yaml

cat ~/.meshery/config.yaml
}

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
PLATFORM=$2
shift
else
echo "ERROR: '-p|--platform' cannot be empty." >&2
exit 1
fi
;;
#--service-mesh)
# if [[ -n "${2:-}" ]]; then
# meshery_config "meshery-$2"
# shift
# else
# echo "ERROR: '--service-mesh' cannot be empty." >&2
# exit 1
# fi
# ;;
*)
break
;;
esac
shift
done
}

main "$@"
#!/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 PLATFORM=docker
parse_command_line "$@"
echo "Checking if a k8s cluster exits..."
if kubectl config current-context
then
echo "Cluster found"
else
printf "Cluster not found. \nCreating one...\n"
create_k8s_cluster
echo "Cluster created successfully!"
fi
if [[ -z $provider_token ]]
then
printf "Token not provided.\nUsing local provider...\n"
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
cat ~/auth.json
kubectl config view --minify --flatten > ~/minified_config
mv ~/minified_config ~/.kube/config
curl -L https://meshery.io/install | sudo PLATFORM=$PLATFORM bash - &
sleep 60
}
create_k8s_cluster() {
curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64
sudo install minikube-linux-amd64 /usr/local/bin/minikube
sudo apt update -y
sudo apt install conntrack
minikube version
minikube start --driver=none --kubernetes-version=v1.20.7
sleep 40
}
meshery_config() {
mkdir ~/.meshery
config='{"contexts":{"local":{"endpoint":"http://localhost:9081","token":"Default","platform":"docker","adapters":[],"channel":"stable","version":"latest"}},"current-context":"local","tokens":[{"location":"auth.json","name":"Default"}]}'
echo $config | yq e '."contexts"."local"."adapters"[0]="'$1'"' -P - > ~/.meshery/config.yaml
cat ~/.meshery/config.yaml
}
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
PLATFORM=$2
shift
else
echo "ERROR: '-p|--platform' cannot be empty." >&2
exit 1
fi
;;
#--service-mesh)
# if [[ -n "${2:-}" ]]; then
# meshery_config "meshery-$2"
# shift
# else
# echo "ERROR: '--service-mesh' cannot be empty." >&2
# exit 1
# fi
# ;;
*)
break
;;
esac
shift
done
}
main "$@"