From 5a9c450c7d778fb0d5d6d0f5e133bc693b2ee4a5 Mon Sep 17 00:00:00 2001 From: Rudraksh Pareek Date: Tue, 3 Aug 2021 23:58:10 +0530 Subject: [PATCH 1/6] run a performance test using profile ID Signed-off-by: Rudraksh Pareek --- action.yml | 3 ++- main.sh | 10 +++++----- mesheryctl.sh | 30 ++++++++++++++++++------------ 3 files changed, 25 insertions(+), 18 deletions(-) diff --git a/action.yml b/action.yml index 2e7f671..39e3d46 100644 --- a/action.yml +++ b/action.yml @@ -10,7 +10,8 @@ inputs: default: docker profile_filename: description: "Name of the file containing SMP profile" - required: true + profile_name: + description: "Name of the performance profile" runs: using: "node12" diff --git a/main.sh b/main.sh index b601ced..b6ef6a6 100755 --- a/main.sh +++ b/main.sh @@ -25,12 +25,12 @@ main() { "$SCRIPT_DIR/meshery.sh" "${setupArgs[@]}" commandArgs=() - #if [[ -n "${INPUT_SERVICE_MESH:-}" ]]; then - # commandArgs+=(--service-mesh ${INPUT_SERVICE_MESH}) - #fi - if [[ -n "${INPUT_PROFILE_FILENAME:-}" ]]; then - commandArgs+=(--profile-name ${INPUT_PROFILE_FILENAME}) + commandArgs=(--profile-name ${INPUT_PROFILE_FILENAME}) + fi + + if [[ -n "${INPUT_PROFILE_ID:-}" ]]; then + commandArgs=(--profile-id ${INPUT_PROFILE_ID}) fi "$SCRIPT_DIR/mesheryctl.sh" "${commandArgs[@]}" diff --git a/mesheryctl.sh b/mesheryctl.sh index 2eea8bc..86ed2ba 100755 --- a/mesheryctl.sh +++ b/mesheryctl.sh @@ -17,6 +17,7 @@ main() { #local service_mesh_adapter= #local service_mesh= local perf_profile_name= + local perf_profile_id= parse_command_line "$@" #docker network connect bridge meshery_meshery_1 @@ -27,24 +28,20 @@ main() { mesheryctl system config minikube -t ~/auth.json #echo $spec $service_mesh_adapter - mesheryctl perf apply --file $GITHUB_WORKSPACE/.github/$perf_profile_name -t ~/auth.json + if [ -z "$perf_profile_id" ] + then + #TODO: deploy service mesh once we have SSE client in mesh deploy + #mesheryctl perf view $perf_profile_id -t ~/auth.json -o json + mesheryctl perf apply $perf_profile_id -t ~/Downloads/auth.json + else + mesheryctl perf apply --file $GITHUB_WORKSPACE/.github/$perf_profile_name -t ~/auth.json + fi } parse_command_line() { while : do case "${1:-}" in - #--service-mesh) - # if [[ -n "${2:-}" ]]; then - # # figure out assigning port numbers and adapter names - # service_mesh=$2 - # service_mesh_adapter=${adapters["$2"]} - # shift - # else - # echo "ERROR: '--service-mesh' cannot be empty." >&2 - # exit 1 - # fi - # ;; --profile-name) if [[ -n "${2:-}" ]]; then perf_profile_name=$2 @@ -54,6 +51,15 @@ parse_command_line() { exit 1 fi ;; + --profile-id) + if [[ -n "${2:-}" ]]; then + perf_profile_id=$2 + shift + else + echo "ERROR: '--profile-id' cannot be empty." >&2 + exit 1 + fi + ;; *) break ;; From a904ddcb33cf6d8c58fdafca6712989703bb5d73 Mon Sep 17 00:00:00 2001 From: Rudraksh Pareek Date: Wed, 4 Aug 2021 16:34:48 +0530 Subject: [PATCH 2/6] run performance tests with profile name Signed-off-by: Rudraksh Pareek --- main.sh | 6 +----- meshery.sh | 7 +++++-- mesheryctl.sh | 44 +++++++++++++++++++++++++++++++------------- 3 files changed, 37 insertions(+), 20 deletions(-) diff --git a/main.sh b/main.sh index b6ef6a6..2e9ab4e 100755 --- a/main.sh +++ b/main.sh @@ -18,10 +18,6 @@ main() { setupArgs+=(--platform ${INPUT_PLATFORM}) fi - #if [[ -n "${INPUT_SERVICE_MESH:-}" ]]; then - # setupArgs+=(--service-mesh ${INPUT_SERVICE_MESH}) - #fi - "$SCRIPT_DIR/meshery.sh" "${setupArgs[@]}" commandArgs=() @@ -37,7 +33,7 @@ main() { } get_dependencies() { - sudo wget https://github.com/mikefarah/yq/releases/download/v4.10.0/yq_linux_amd64 -O /usr/bin/yq --quiet + sudo wget https://github.com/mikefarah/yq/releases/download/v4.10.0/yq_linux_amd64 -O /usr/bin/yq --quiet sudo chmod +x /usr/bin/yq } diff --git a/meshery.sh b/meshery.sh index c59b8e5..9701a05 100755 --- a/meshery.sh +++ b/meshery.sh @@ -1,5 +1,9 @@ #!/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() { @@ -10,8 +14,7 @@ main() { parse_command_line "$@" echo "Checking if a k8s cluster exits..." - kubectl config current-context - if [[ $? -eq 0 ]] + if kubectl config current-context then echo "Cluster found" else diff --git a/mesheryctl.sh b/mesheryctl.sh index 86ed2ba..1e4f425 100755 --- a/mesheryctl.sh +++ b/mesheryctl.sh @@ -7,34 +7,52 @@ adapters["istio"]=meshery-istio:10000 adapters["linkerd"]=meshery-linkerd:10001 adapters["consul"]=meshery-consul:10002 adapters["octarine"]=meshery-octarine:10003 -adapters["nsm"]=meshery-nsm:10004 +adapters["network_service_mesh"]=meshery-nsm:10004 adapters["kuma"]=meshery-kuma:10007 adapters["cpx"]=meshery-cpx:10008 -adapters["osm"]=meshery-osm:10009 -adapters["traefik-mesh"]=meshery-traefik-mesh:10006 +adapters["open_service_mesh"]=meshery-osm:10009 +adapters["traefik_mesh"]=meshery-traefik-mesh:10006 main() { - #local service_mesh_adapter= - #local service_mesh= local perf_profile_name= local perf_profile_id= parse_command_line "$@" - #docker network connect bridge meshery_meshery_1 - #docker network connect minikube meshery_meshery_1 - #docker network connect minikube meshery_meshery-"$service_mesh"_1 - #docker network connect bridge meshery_meshery-"$service_mesh"_1 - mesheryctl system config minikube -t ~/auth.json - #echo $spec $service_mesh_adapter + # until meshery's stable release + curl -L https://github.com/DelusionalOptimist/meshery/releases/download/v0.5.44/mesheryctl --output ~/mesheryctl + chmod +x ~/mesheryctl + # perform the test given in the provided profile_id if [ -z "$perf_profile_id" ] then - #TODO: deploy service mesh once we have SSE client in mesh deploy - #mesheryctl perf view $perf_profile_id -t ~/auth.json -o json + + # get the mesh name from performance test config + service_mesh=$(~/mesheryctl perf view test_sm -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_id -t ~/Downloads/auth.json + else + mesheryctl perf apply --file $GITHUB_WORKSPACE/.github/$perf_profile_name -t ~/auth.json + fi } From f6e7723ca3b715b6321cb8cd90fc0bb7007eaa7d Mon Sep 17 00:00:00 2001 From: Rudraksh Pareek Date: Wed, 4 Aug 2021 16:55:16 +0530 Subject: [PATCH 3/6] performance profile name Signed-off-by: Rudraksh Pareek --- main.sh | 6 +++--- mesheryctl.sh | 16 ++++++++-------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/main.sh b/main.sh index 2e9ab4e..7f2d540 100755 --- a/main.sh +++ b/main.sh @@ -22,11 +22,11 @@ main() { commandArgs=() if [[ -n "${INPUT_PROFILE_FILENAME:-}" ]]; then - commandArgs=(--profile-name ${INPUT_PROFILE_FILENAME}) + commandArgs=(--perf-filename ${INPUT_PROFILE_FILENAME}) fi - if [[ -n "${INPUT_PROFILE_ID:-}" ]]; then - commandArgs=(--profile-id ${INPUT_PROFILE_ID}) + if [[ -n "${INPUT_PROFILE_NAME:-}" ]]; then + commandArgs=(--profile-name ${INPUT_PROFILE_NAME}) fi "$SCRIPT_DIR/mesheryctl.sh" "${commandArgs[@]}" diff --git a/mesheryctl.sh b/mesheryctl.sh index 1e4f425..5dda4c0 100755 --- a/mesheryctl.sh +++ b/mesheryctl.sh @@ -14,8 +14,8 @@ adapters["open_service_mesh"]=meshery-osm:10009 adapters["traefik_mesh"]=meshery-traefik-mesh:10006 main() { + local perf_filename= local perf_profile_name= - local perf_profile_id= parse_command_line "$@" @@ -24,7 +24,7 @@ main() { chmod +x ~/mesheryctl # perform the test given in the provided profile_id - if [ -z "$perf_profile_id" ] + if [ -z "$perf_profile_name" ] then # get the mesh name from performance test config @@ -47,11 +47,11 @@ main() { fi - mesheryctl perf apply $perf_profile_id -t ~/Downloads/auth.json + mesheryctl perf apply --profile $perf_profile_name -t ~/Downloads/auth.json else - mesheryctl perf apply --file $GITHUB_WORKSPACE/.github/$perf_profile_name -t ~/auth.json + mesheryctl perf apply --file $GITHUB_WORKSPACE/.github/$perf_filename -t ~/auth.json fi } @@ -60,18 +60,18 @@ parse_command_line() { while : do case "${1:-}" in - --profile-name) + --perf-filename) if [[ -n "${2:-}" ]]; then - perf_profile_name=$2 + perf_filename=$2 shift else echo "ERROR: '--profile-name' cannot be empty." >&2 exit 1 fi ;; - --profile-id) + --profile-name) if [[ -n "${2:-}" ]]; then - perf_profile_id=$2 + perf_profile_name=$2 shift else echo "ERROR: '--profile-id' cannot be empty." >&2 From 401a50b5e6db3662d68bf7bd4af73a12313ea0ec Mon Sep 17 00:00:00 2001 From: Rudraksh Pareek Date: Wed, 4 Aug 2021 17:04:06 +0530 Subject: [PATCH 4/6] hmm Signed-off-by: Rudraksh Pareek --- mesheryctl.sh | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/mesheryctl.sh b/mesheryctl.sh index 5dda4c0..ff08ccb 100755 --- a/mesheryctl.sh +++ b/mesheryctl.sh @@ -27,6 +27,10 @@ main() { 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 test_sm -t ~/auth.json -o json 2>&1 | jq '."service_mesh"' | tr -d '"') @@ -46,12 +50,7 @@ main() { ~/mesheryctl mesh deploy --adapter ${adapters["$service_mesh"]} -t ~/auth.json "$service_mesh" --watch fi - - mesheryctl perf apply --profile $perf_profile_name -t ~/Downloads/auth.json - - else - - mesheryctl perf apply --file $GITHUB_WORKSPACE/.github/$perf_filename -t ~/auth.json + mesheryctl perf apply $perf_profile_name -t ~/auth.json fi } From edae22bc5ecfe3da1ec592254764ca665ae0d168 Mon Sep 17 00:00:00 2001 From: Rudraksh Pareek Date: Thu, 5 Aug 2021 03:19:13 +0530 Subject: [PATCH 5/6] real mesheryctl Signed-off-by: Rudraksh Pareek --- mesheryctl.sh | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/mesheryctl.sh b/mesheryctl.sh index ff08ccb..6a8fcef 100755 --- a/mesheryctl.sh +++ b/mesheryctl.sh @@ -19,10 +19,6 @@ main() { parse_command_line "$@" - # until meshery's stable release - curl -L https://github.com/DelusionalOptimist/meshery/releases/download/v0.5.44/mesheryctl --output ~/mesheryctl - chmod +x ~/mesheryctl - # perform the test given in the provided profile_id if [ -z "$perf_profile_name" ] then @@ -32,7 +28,7 @@ main() { else # get the mesh name from performance test config - service_mesh=$(~/mesheryctl perf view test_sm -t ~/auth.json -o json 2>&1 | jq '."service_mesh"' | tr -d '"') + service_mesh=$(mesheryctl perf view test_sm -t ~/auth.json -o json 2>&1 | jq '."service_mesh"' | tr -d '"') # deploy the mentioned service mesh if needed if [[ $service_mesh != "null" ]] @@ -47,7 +43,7 @@ main() { mesheryctl system config minikube -t ~/auth.json - ~/mesheryctl mesh deploy --adapter ${adapters["$service_mesh"]} -t ~/auth.json "$service_mesh" --watch + mesheryctl mesh deploy --adapter ${adapters["$service_mesh"]} -t ~/auth.json "$service_mesh" --watch fi mesheryctl perf apply $perf_profile_name -t ~/auth.json From f8a8192a2fb0bacf424ffa44a94a552af735cf86 Mon Sep 17 00:00:00 2001 From: Rudraksh Pareek Date: Thu, 5 Aug 2021 03:48:14 +0530 Subject: [PATCH 6/6] err Signed-off-by: Rudraksh Pareek --- mesheryctl.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mesheryctl.sh b/mesheryctl.sh index 6a8fcef..cb510b4 100755 --- a/mesheryctl.sh +++ b/mesheryctl.sh @@ -28,7 +28,7 @@ main() { else # get the mesh name from performance test config - service_mesh=$(mesheryctl perf view test_sm -t ~/auth.json -o json 2>&1 | jq '."service_mesh"' | tr -d '"') + 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" ]]