-
Notifications
You must be signed in to change notification settings - Fork 54
set resource requests and limits on tank object #456
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
Conversation
4197899 to
df625d5
Compare
|
Ran on Docker Desktop's Kubernetes and could see: "resources": {
"limits": {
"cpu": "1",
"memory": "1500Mi"
},
"requests": {
"cpu": "500m",
"memory": "500Mi"
}
}, |
|
CI failed, perhaps because minikube doesn't think it has enough resources to start the tanks |
8765aeb to
ff4ddab
Compare
|
Added a commit to
|
|
An alternative using user-friendly "profiles": willcl-ark#24 |
ada113c to
a11489b
Compare
pinheadmz
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't we just set lower resource usage in the CI so the tests can run as written without any changes?
src/warnet/utils.py
Outdated
|
|
||
| def create_cycle_graph(n: int, version: str, bitcoin_conf: str | None, random_version: bool): | ||
| def create_cycle_graph( | ||
| n: int, version: str, bitcoin_conf: str | None, random_version: bool, resources: dict | None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
resources isnt being used in the function?
|
Error on docker desktop, |
|
I think the bug Im getting is in the default set in schema.json |
|
example fix: diff --git a/src/warnet/graph_schema.json b/src/warnet/graph_schema.json
index aa1518f..4b178a4 100644
--- a/src/warnet/graph_schema.json
+++ b/src/warnet/graph_schema.json
@@ -69,25 +69,13 @@
"comment": "A string of arguments for the lightning network node in command-line format, e.g. '--protocol.wumbo-channels --bitcoin.timelockdelta=80'"
},
"resources": {
- "type": "object",
- "comment": "Kubernetes resource requests and limits for the node",
- "properties": {
- "requests": {
- "type": "object",
- "properties": {
- "cpu": {"type": "string", "default": "500m"},
- "memory": {"type": "string", "default": "500Mi"}
- }
- },
- "limits": {
- "type": "object",
- "properties": {
- "cpu": {"type": "string", "default":"1000m"},
- "memory": {"type": "string", "default":"1500Mi"}
- }
- }
- }
+ "type": "object",
+ "comment": "Kubernetes resource requests and limits for the node",
+ "default": {
+ "requests": {"cpu": "100m", "memory": "250Mi"},
+ "limits": {"cpu": "250m", "memory": "500Mi"}
}
+ }
},
"additionalProperties": false,
"oneOf": [ |
92e2c92 to
7c38f2d
Compare
now that we are explicitly requesting resources, pods will not get scheduled unless the cluster has enough resources to satisfy the initial request. this was causing our current tests to fail, so bump minikubes resources. the tests will be scaled down in the next commits
test with 6 nodes instead of 8. also replace version with image: this sets us up for a later change to remove version from the config completely
we use image for everything now and version is a more of a leftover from before when we didnt have a docker registry set up. in a later commit, we will completely remove version from the jsonschema file
8056b39 to
90ebfd6
Compare
90ebfd6 to
5862a25
Compare
|
Closing as this is now obsolete. We can now configure everything in one place using the network.yaml/node-defaults.yaml and namespaces.yaml/namespace-defaults.yaml helm files. Only thing currently missing is good documentation and examples on how to use the yaml configuration files which I think we will need before tabconf, opened a backlog issue for that here: #496 |
tell k8s up front the min and max CPU, memory we want for a tank. can be overriden from a graph file if a tank needs more/less.
did some testing, and this allows k8s to do autoscaling when trying to start a network. this means if a cluster does not have enough nodes and you try to start a network with 50 tanks, k8s will keep the pods in pending until it adds more nodes to the cluster. this allows for much more graceful cluster management.
annoyingly, if the pod is already scheduled and the workload of the pod increases, k8s can't do cluster autoscaling anymore, but there might be another way to tackle this via vertical scaling. as of today, the best way to handle this would be to set a much higher
limits, which should help? (not tested).testing
tested on digital ocean cluster with autoscaling, has not been tested on Minikube or docker desktop, but should work since requests and limits are not k8s specific config options.