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

Use API with script instead of frontend #192

Closed
JulianTS opened this issue Jul 4, 2022 · 6 comments
Closed

Use API with script instead of frontend #192

JulianTS opened this issue Jul 4, 2022 · 6 comments

Comments

@JulianTS
Copy link

JulianTS commented Jul 4, 2022

Hey,

The simulator already helped me a bunch to develop and test custom plugins!!

I discovered the address and port of the server in the documentation but wondered if I can control everything with an extern script via the API instead of the frontend?
Could not find the endpoints for scheduling/deleting pods and retrieving the scores yet which would be important.

Thanks in advance!!

Currently writing my BA about building and evaluating a custom plugin.
I planned to simulate cloud traces for the evaluation so that the measured impact of the plugin is more realistic, but I can't "run" them on a cluster afaik, so the simulator-server would be a great help!

Edit: doc answered a part of my question

@JulianTS JulianTS changed the title Use API with script instead of frontend Where to find all API endpoints of server Jul 4, 2022
@JulianTS JulianTS changed the title Where to find all API endpoints of server Use API with script instead of frontend Jul 4, 2022
@sanposhiho
Copy link
Member

Hello.

The kube-apiserver inside of simulator can be accessed from outside of the simulator. That means you can use kubectl or client-go (or another k8s clients) to create/edit/delete any resource in simulator.

Could not find the endpoints for scheduling/deleting pods and retrieving the scores yet which would be important.

  • To delete Pod, you can use any k8s client as described above.
  • To schedule Pods, you only need to create Pods. (Scheduler automatically find the non-scheduled Pods and try to schedule them)
  • To retrieve scheduling results, you can check the Pod annotation

@JulianTS
Copy link
Author

JulianTS commented Jul 7, 2022

Okay, I found #176 and kubectl worked with the server flag.

But is there a work around without a kubeconfig for client-node as well?
How does the kubeconfig have to look like or how do I configure it correctly so it has access to it on port 3131?

@sanposhiho
Copy link
Member

Probably like this?

apiVersion: v1
kind: Config

clusters:
- cluster:
    server: http://localhost:3131
  name: simulator

contexts:
- context:
    cluster: simulator
  name: simulator

current-context: simulator

@sanposhiho
Copy link
Member

Since not all users are familiar with kubeconfig format, it may be better to add this^ kubeconfig example in doc :)

@sanposhiho
Copy link
Member

sanposhiho commented Jul 9, 2022

I update documents in #197.
If you have other questions or unclear points, please let me know. I'll add to the PR.

@JulianTS
Copy link
Author

the simulation works great, except for some random UnhandledPromiseRejectionWarnings I have to fix now

thanks for your help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants