kubernetes-sigs / kube-scheduler-simulator

The simulator for the Kubernetes scheduler
Apache License 2.0
795 stars 135 forks source link

Cannot integrate custom plugins into the emulator #341

Closed a-c-dream closed 7 months ago

a-c-dream commented 8 months ago

I've looked at #311 but it doesn't solve the problem. @yz2001zzx Did you solve your problem? I had the same problem as you. I also modified /kube-scheduler-simulator/simulator/scheduler/config/plugin.go and I also modified simulator/config.yaml like @tmishina said but when I add NodeNumber in Web UI I still I get error code 500. Is it possible that I have to rebuild after modifying it, but when I rebuild I get the error image @sanposhiho Can you offer some solutions?

sanposhiho commented 8 months ago

Seemingly your screenshot shows that your golang code isn't compiled correctly. Any mistake in your implementation?

a-c-dream commented 8 months ago

As I said above, I only modified /kube-scheduler-simulator/simulator/scheduler/config/plugin.go image and simulator/config.yaml image What's in the picture is the modified part.If you don't make these two changes you can build and run normally, but with the above changes the build fails! The following diagram shows the normal operation without modifying these two parts. image

sanposhiho commented 8 months ago

Can you push your change into your fork repo so that I can reproduce your problem

a-c-dream commented 8 months ago

I have forked the repo. The URL is https://github.com/a-c-dream/kube-scheduler-simulator

sanposhiho commented 8 months ago

In simulator/scheduler/config/plugin.go, you forgot to import the nodenumber package. See https://github.com/kubernetes-sigs/kube-scheduler-simulator/pull/342

a-c-dream commented 8 months ago

As you can see, I am a novice in go, I tried to import nodenumber by following the path below but it doesn't work. Please guide me how to import nodenumber package, thanks a lot! image image

sanposhiho commented 8 months ago

@a-c-dream like - https://github.com/a-c-dream/kube-scheduler-simulator/pull/1/files

a-c-dream commented 7 months ago

First of all, thanks to your guide, I imported the package and it successfully built. But unfortunately, now it doesn't work properly. It won't schedule after creating a new pod. It also doesn't respond when I click on the settings button, and I found the following error in the network packet. image

sanposhiho commented 7 months ago

Can you update your fork repo with your current implementation (that you was able to build) and give me the steps to reproduce the issue?

a-c-dream commented 7 months ago

I have pulled my code to here

sanposhiho commented 7 months ago

and how did you run up your simulator?

a-c-dream commented 7 months ago

sudo make docker_build_and_up

sanposhiho commented 7 months ago

@a-c-dream you have to revert this change in simulator/config.yaml. The container doesn't have this scheduler config file. https://github.com/kubernetes-sigs/kube-scheduler-simulator/compare/master...a-c-dream:kube-scheduler-simulator:master#diff-6c17503c0a94d95e3b3186d67743562aadb4307b8f044673147a0f2d60fabc98

  1. Revert the above change
  2. make docker_build_server
  3. make docker_up_local

It makes the simulator work in my laptop.

a-c-dream commented 7 months ago

Thank you very much for your help, it's now up and running! image Here's some of the process, hopefully it'll be a little helpful to anyone who encounters this problem later on. Revert the simulator/config.yaml change image Build and run it, then set nodeNumber to be enabled in the web UI. image

yz2001zzx commented 6 months ago

I still have an issue.

yz2001zzx commented 6 months ago

image

I have built the simulator by "sudo make docker_build_and_up " with configuration above without specifying the KubeSchedulerConfigPath. But I still get 500 error code

yz2001zzx commented 6 months ago

no worries, I've figured it out.