layer5io / meshery-performance-action

GitHub Action for pipelining microservices and Kubernetes performance testing with Meshery
https://layer5.io/projects/nighthawk
Apache License 2.0
29 stars 22 forks source link

Replace `kubectl apply` with `mesheryctl app onboard` command #48

Closed alphaX86 closed 2 years ago

alphaX86 commented 2 years ago

Signed-off-by: Aadhitya A aadhitya864@gmail.com

Description

This PR fixes #20

Notes for Reviewers

Signed commits

leecalcote commented 2 years ago

Does this behave as expected?

alphaX86 commented 2 years ago

I thought it has CI actions inbuilt. Will check and let you know, Lee

gyohuangxin commented 2 years ago

@alphaX86 Hi, do you have any updates?

alphaX86 commented 2 years ago

Heads Up! The adapter port nos are temporary for now... Plus, I need to test the scripts in a VM to ensure it works fine and safe

alphaX86 commented 2 years ago

I just have only one tiny doubt. How you'd login to meshery via "None" provider, without the usage of auth token? It drives me crazy as the --provider flag is missing in mesheryctl

leecalcote commented 2 years ago

For Remote Provider, an infinite token can be assigned.

gyohuangxin commented 2 years ago

@alphaX86 Ready to be reviewed? Have you checked if it works?

alphaX86 commented 2 years ago

I need to test them on a cloud shell but due to limits on my AWS free tier, I could not see them. Plus, some PRs need to be merged on Meshery repo in order to reflect here

@gyohuangxin any suggestions to test the shell script on a remote cloud system with k8s running. Mine has reached limits due to t2.micro CPU

gyohuangxin commented 2 years ago

@alphaX86 Thanks.

some PRs need to be merged on Meshery repo in order to reflect here

So mesheryctl app onboard command cannot work at this stage, right?

@gyohuangxin any suggestions to test the shell script on a remote cloud system with k8s running. Mine has reached limits due to t2.micro CPU

The fastest way is to use this github action on your forked repo, you need to set enhance branch as the default branch, then you can enable action workflows in https://github.com/alphaX86/meshery-smp-action/actions. Then run configurable-benchmark-test, it will deploy k8s and run your changed scripts to deploy meshes and applications. This way doesn't need any other resource. image

alphaX86 commented 2 years ago

Well.. Its system login, because app onboard needs a token to work. I introduced a provider flag and if its merged it'll be good to go for this script

alphaX86 commented 2 years ago

@alphaX86 Thanks.

some PRs need to be merged on Meshery repo in order to reflect here

So mesheryctl app onboard command cannot work at this stage, right?

@gyohuangxin any suggestions to test the shell script on a remote cloud system with k8s running. Mine has reached limits due to t2.micro CPU

The fastest way is to use this github action on your forked repo, you need to set enhance branch as the default branch, then you can enable action workflows in https://github.com/alphaX86/meshery-smp-action/actions. Then run configurable-benchmark-test, it will deploy k8s and run your changed scripts to deploy meshes and applications. This way doesn't need any other resource. image

I'll check it out. Thank you so much

gyohuangxin commented 2 years ago

Well.. Its system login, because app onboard needs a token to work. I introduced a provider flag and if its merged it'll be good to go for this script

Is it there any workaround to let it work now? Because I will work on enabling other meshes and try to use mesheryctl to deploy meshes and apps these days.

alphaX86 commented 2 years ago

Ok, you'd need an infinite lifetime auth token to accomplish this, because system login is prompt based for now and it won't work on pure bash script. Though 'none' provider can be logged in, I had deep trouble to access via script which eventually failed on all methods

The token alone however, some folks only have it... @Revolyssup is there anyway to acquire this token?

gyohuangxin commented 2 years ago

@alphaX86 Thanks for the information 👍 I have one infinite lifetime auth token in fact.

alphaX86 commented 2 years ago

Then it'd be easy for you 🙂👍 thanks @gyohuangxin

alphaX86 commented 2 years ago

A release of Meshery is needed to reflect the changes of system login (PR merged but it's not made public yet). Tests are run, so far good. If a release alone is made in Meshery repo (I'm not forcing it to so, just informing) then changes will reflect on script files as well. Other than login, everything worked pretty fine in a simulated GH Action (except mesh and app due to login issue)

gyohuangxin commented 2 years ago

@alphaX86 Great! Thanks for your information. A question not related to this PR, can we use mesheryctl app aboard to deploy some demo apps for Kuma, Consul, Appmesh or Cilium? I'm onboarding them into GH action, but confused about how to deploy demo apps on them.

alphaX86 commented 2 years ago

mesheryctl app onboard is generic command and should work on all service meshes. To onboard an app, you'd need a YAML file containing the properties of app to be onboarded or a GitHub link referencing the file. I still didn't test the command fully on action but will test on my system and let you know further

gyohuangxin commented 2 years ago

Thanks. It would be great if we can aboard any app on any mesh.

alphaX86 commented 2 years ago

~@piyushsingariya error obtained in app onboard, any idea on what's the cause?~ image

alphaX86 commented 2 years ago

~@piyushsingariya error obtained in app onboard, any idea on what's the cause?~ ![image]

NVM, I'm getting error 500 now image

alphaX86 commented 2 years ago

Sure 👍 I'll add and check

On Tue, 24 May 2022, 1:17 pm Xin Huang, @.***> wrote:

@.**** commented on this pull request.

@alphaX86 https://github.com/alphaX86 Does it only happen on Istio? It seems Istio didn't deployed properly.

In .github/workflows/scripts/istio_deploy.sh https://github.com/layer5io/meshery-smp-action/pull/48#discussion_r880168965 :

-kubectl apply -f samples/bookinfo/platform/kube/bookinfo.yaml -kubectl apply -f samples/bookinfo/networking/bookinfo-gateway.yaml +sleep 10 +#mesheryctl system login --provider None +echo 'E' | mesheryctl mesh deploy adapter meshery-istio:10000 --token "./.github/workflows/auth.json"

Probably the Istio didn't deploy completely, can we add a sleep and a check here?

— Reply to this email directly, view it on GitHub https://github.com/layer5io/meshery-smp-action/pull/48#pullrequestreview-982743381, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOGAOQTAHJ3EDVJEFG2W2OLVLSCRFANCNFSM5UBCNGAQ . You are receiving this because you were mentioned.Message ID: @.***>

alphaX86 commented 2 years ago

Ok, I found a possible cause of the error, currently minikube has size of only 2GB which indeed of course, bookinfo app won't work at all. I'll change the config of cluster and get back

gyohuangxin commented 2 years ago

@alphaX86 Do you have any updates?

alphaX86 commented 2 years ago

@gyohuangxin nothing solid, the k8s deprecation error was found to occur on old k8s resources found on manifests, needs changes on that side, then only pattern apply would work flawless. Other issue like error 500 is common in pattern it seems after talks last week

gyohuangxin commented 2 years ago

the k8s deprecation error was found to occur on old k8s resources found on manifests

I'm confused about it. Can you show the error log? Does it occur after using medyagh/setup-minikube@v0.0.7?

alphaX86 commented 2 years ago

the k8s deprecation error was found to occur on old k8s resources found on manifests

I'm confused about it. Can you show the error log? Does it occur after using medyagh/setup-minikube@v0.0.7?

It was produced earlier and it's disappearing somehow (I'm also confused). And no, it's not occuring due to new setup-minikube action

gyohuangxin commented 2 years ago

Got it, I will also have a try if I have the cycles.

gyohuangxin commented 2 years ago

@hershd23 Can you help try this?

gyohuangxin commented 2 years ago

@hershd23 Can you help try this?

hershd23 commented 2 years ago

Yep I'll give this a shot

hershd23 commented 2 years ago

https://github.com/hershd23/meshery-smp-action/runs/6867611798?check_suite_focus=true#step:5:226

Currently the tmate step keeps on printing the link to connect to the common terminal. It doesn't reach the next task. Any fixes for this @alphaX86 ?

Edit :- Found a way by creating a file named continue in the project directory, is there a better way?

hershd23 commented 2 years ago

https://github.com/hershd23/meshery-smp-action/actions/runs/2490527037

@gyohuangxin @alphaX86 still getting familiar with the issue, pulled up @alphaX86 's latest changes and the pattern apply works fine. Checking for app onboard

hershd23 commented 2 years ago

https://github.com/hershd23/meshery-smp-action/runs/6868235120?check_suite_focus=true

Linkerd + wrk2 combination working fine with app onboard

Are there specific cases that are not working @gyohuangxin @alphaX86 @leecalcote, that I should test?

alphaX86 commented 2 years ago

https://github.com/hershd23/meshery-smp-action/runs/6867611798?check_suite_focus=true#step:5:226

Currently the tmate step keeps on printing the link to connect to the common terminal. It doesn't reach the next task. Any fixes for this @alphaX86 ?

Edit :- Found a way by creating a file named continue in the project directory, is there a better way?

Tmate is used to debug the current session actually @hershd23 that is, you need to open the link and type :wq then the shell will be activated. Once you finished debugging you need to exit the shell by exit command. Then only it'll proceed to next step of action

alphaX86 commented 2 years ago

https://github.com/hershd23/meshery-smp-action/runs/6868235120?check_suite_focus=true

Linkerd + wrk2 combination working fine with app onboard

Are there specific cases that are not working @gyohuangxin @alphaX86 @leecalcote, that I should test?

Check for Istio config and let us know :) I'm just busy with exams this whole month that's why seeking help from you @hershd23 ... :)

gyohuangxin commented 2 years ago

@hershd23 Thanks for this testing, I saw the 500 error message in your testing of mesheryctl pattern apply on Istio: https://github.com/hershd23/meshery-smp-action/runs/6867816269?check_suite_focus=true#step:4:69. Did you check whether the pattern is working well?

gyohuangxin commented 2 years ago

https://github.com/hershd23/meshery-smp-action/runs/6868235120?check_suite_focus=true

Linkerd + wrk2 combination working fine with app onboard

Are there specific cases that are not working @gyohuangxin @alphaX86 @leecalcote, that I should test?

IOM, the app onboard or pattern apply can achieve our goal. We prefer pattern apply because we can implement more interesting things on it in the future. Therefore, we should make sure at this time:

  1. We can use mesheryctl to deploy each mesh (Istio, Linkerd, OSM) in github action. Make sure this command works well: https://github.com/layer5io/meshery-smp-action/pull/48/files#diff-9708a03424bc77988703c3ef86daa584385ea618a3d48e55842e537d22620444R14
  2. We can use pattern apply to deploy pattern on each mesh and the performance tests works well.
hershd23 commented 2 years ago

@gyohuangxin you're right

Basically the pattern apply command is erroring out, the trace isn't helpful

runner@fv-az204-655:~/work/meshery-smp-action/meshery-smp-action$ mesheryctl pattern apply -f "https://github.com/service-mesh-patterns/service-mesh-patterns/blob/master/samples/bookInfoPattern.yaml" --token "./.github/workflows/auth.json"
Error: Response Status Code 500, possible Server Error
hershd23 commented 2 years ago
meshery-7bfb4d5c9c-dzplb        |       time="2022-06-14T18:10:00Z" level=error msg="readdirent /tmp/service-mesh-patterns/1655230199991602250/samples/bookInfoPattern.yaml: not a directory" app=meshery code=2167 probable-cause="Cannot save the Pattern due to wrong path or URL" severity=2 short-description="Error failed to import pattern" suggested-remediation="Check if the given path or URL of the Pattern is correct"
meshery-7bfb4d5c9c-dzplb        |       time="2022-06-14T18:12:52Z" level=error msg="readdirent /tmp/service-mesh-patterns/1655230372443385636/samples/bookInfoPattern.yaml: not a directory" app=meshery code=2167 probable-cause="Cannot save the Pattern due to wrong path or URL" severity=2 short-description="Error failed to import pattern" suggested-remediation="Check if the given path or URL of the Pattern is correct"
meshery-7bfb4d5c9c-dzplb        |       time="2022-06-14T18:12:55Z" level=error msg="readdirent /tmp/service-mesh-patterns/1655230375138899338/samples/bookInfoPattern.yaml: not a directory" app=meshery code=2167 probable-cause="Cannot save the Pattern due to wrong path or URL" severity=2 short-description="Error failed to import pattern" suggested-remediation="Check if the given path or URL of the Pattern is correct"

Checked the system logs got this

hershd23 commented 2 years ago
runner@fv-az204-655:~/work/meshery-smp-action/meshery-smp-action$ mesheryctl pattern apply -f "https://raw.githubusercontent.com/service-mesh-patterns/service-mesh-patterns/master/samples/bookInfoPattern.yaml" --token "./.github/workflows/auth.json"
pattern successfully applied
successfully deployed application productpage
successfully deployed application reviews-v1
successfully deployed application reviews-v3
successfully deployed application details
successfully deployed application ratings
created Gateway "sample-app-gateway" in namespace "default"
applied trait "meshmap" on service "reviews-v2"
applied trait "meshmap" on service "reviews-v3"
applied trait "meshmap" on service "reviews"
applied trait "meshmap" on service "reviews-v1"
applied trait "meshmap" on service "productpage"
applied trait "meshmap" on service "ratings"
applied trait "meshmap" on service "sample-app-gateway"
applied trait "meshmap" on service "bookinfo-vs"
applied trait "meshmap" on service "details"
created VirtualService "bookinfo-vs" in namespace "default"
applied trait "meshmap" on service "reviews-v2"
applied trait "meshmap" on service "reviews-v3"
applied trait "meshmap" on service "reviews"
applied trait "meshmap" on service "reviews-v1"
applied trait "meshmap" on service "productpage"
applied trait "meshmap" on service "ratings"
applied trait "meshmap" on service "sample-app-gateway"
applied trait "meshmap" on service "bookinfo-vs"
applied trait "meshmap" on service "details"
successfully deployed application reviews-v2
runner@fv-az204-655:~/work/meshery-smp-action/meshery-smp-action$ kubectl get pods
NAME                           READY   STATUS              RESTARTS   AGE
details-69648f48b4-rc8qf       0/1     ContainerCreating   0          4s
productpage-76dc999cf7-4j4d6   0/1     ContainerCreating   0          4s
ratings-6dfcc745f-drn9k        0/1     ContainerCreating   0          4s
reviews-v1-dbcdfd648-9shdd     0/1     ContainerCreating   0          4s
reviews-v2-7bb7dd9fc-jfnjz     0/1     ContainerCreating   0          4s
reviews-v3-784c4996f9-4rqhm    0/1     ContainerCreating   0          4s

Ah simply changing to download from raw file works!

https://raw.githubusercontent.com/service-mesh-patterns/service-mesh-patterns/master/samples/bookInfoPattern.yaml

hershd23 commented 2 years ago

The run is successful, more importantly we are sure that the pattern got applied

It has an error towards the end, I don't know how relevant that is

https://github.com/hershd23/meshery-smp-action/runs/6886559987?check_suite_focus=true#step:6:1709

Error getting context: json: cannot unmarshal array into Go value of type map[string]interface {}

Any ideas @gyohuangxin @alphaX86 @leecalcote ?

hershd23 commented 2 years ago

Another comment, I feel for mesheryctl pattern apply one of the most basic errors would be that the URL is wrong or the file cannot be downloaded from that URL. We should have a better error message :)

runner@fv-az204-655:~/work/meshery-smp-action/meshery-smp-action$ mesheryctl pattern apply -f "https://github.com/service-mesh-patterns/service-mesh-patterns/blob/master/samples/bookInfoPattern.yaml" --token "./.github/workflows/auth.json"
Error: Response Status Code 500, possible Server Error
hershd23 commented 2 years ago

@gyohuangxin should I also change the linkerd task from app onboard to pattern apply and test?

Or let it be as is?

hershd23 commented 2 years ago

Also should I be making my own PR on this issue? Or suggest changes to this one itself? Not sure of @alphaX86 's availability due to his exams

gyohuangxin commented 2 years ago

@gyohuangxin should I also change the linkerd task from app onboard to pattern apply and test?

Or let it be as is?

Yes, we should keep the method of deployment the same and also test on OSM.

gyohuangxin commented 2 years ago

Also should I be making my own PR on this issue? Or suggest changes to this one itself? Not sure of @alphaX86 's availability due to his exams

Your own PR makes sense.

alphaX86 commented 2 years ago

You're cleared to make a PR @hershd23 I'll close this staled one

alphaX86 commented 2 years ago

The script will be updated and tested. I'll do this in today evening and let you know when it's done

On Thu, 28 Apr 2022, 7:15 am Xin Huang, @.***> wrote:

@alphaX86 https://github.com/alphaX86 Hi, do you have any updates?

— Reply to this email directly, view it on GitHub https://github.com/layer5io/meshery-smp-action/pull/48#issuecomment-1111649437, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOGAOQUR4HMXRQ6I5UIZ26TVHHUTLANCNFSM5UBCNGAQ . You are receiving this because you were mentioned.Message ID: @.***>

gyohuangxin commented 2 years ago

@alphaX86 Thank you very much!